Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fuchsia] [packaging] Layout debug symbols for Fuchsia #13338

Merged
merged 7 commits into from
Oct 25, 2019

Conversation

iskakaushik
Copy link
Contributor

This packages and moves the relevant symbols to the right
locations in root_out_dir, but doesn't upload them to CIPD
yet. That will be done in a following change.

Refer: go/flutter-fuchsia-packaging for more information.

This packages and moves the relevant symbols to the right
locations in root_out_dir, but doesn't upload them to CIPD
yet. That will be done in a following change.

Refer: go/flutter-fuchsia-packaging for more information.
@iskakaushik iskakaushik added CQ+1 and removed CQ+1 labels Oct 24, 2019
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All minor nits. Looks good overall.


# Takes a binary and generates its debug symbols following
# the Fuchsia packaging convention.
template("debug_symbols") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fuchsia_debug_symbols for clarity. Also, please document the invoker arguments necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

]

outputs = [
"${_dest_base}/.${target_name}_success",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the convention is .stamp. Also, why is the file hidden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was making these hidden to avoid the noise when you try to inspect the directories. .stamp seems to have a special meaning as far as gn is concerned - there is a tool (" "stamp": Tool for creating stamp files") that gn uses to generate these, so I tried to avoid that. If that is the convention, i'm happy to change it to .stamp.

}

action(target_name) {
testonly = defined(invoker.testonly) && invoker.testonly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and elsewhere, prefer forward_variables_from

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

def main():
parser = argparse.ArgumentParser()

parser.add_argument(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add help= arguments to these please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.



def GetBuildIdParts(exec_path):
file_out = subprocess.check_output(['file', exec_path])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, is there no other way to get the build ID for an ELF binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work on cirrus for some reason. I'm wondering if file is sandboxed away from us. I will look for alternatives.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Fuchsia toolchain includes a version of llvm-readelf.

Try extracting the build ID with:
llvm-readelf --hex-dump=.note.gnu.build-id [executable]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, I switched to using this,

assert os.path.exists(args.dest)

parts = GetBuildIdParts(args.exec_path)
dbg_prefix_base = '%s/%s' % (args.dest, parts['prefix_dir'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer os.path.join. Here and elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


parser.add_argument('--stripped', dest='stripped', action='store_true')
parser.add_argument('--unstripped', dest='stripped', action='store_false')
parser.set_defaults(stripped=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can specify the default in the add_argument line itself.


args = parser.parse_args()
assert os.path.exists(args.exec_path)
assert os.path.exists(args.dest)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant with required=True.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required=True says that the argument exists, not the path.

# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Gather the build_id, prefix_dir, and exec_name given the path to executable
also copies to the specified destination.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a line about how the build ID directory is structure. That section from the presentation will work great :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

bin_path = invoker.binary_path

_args = []
if (defined(invoker.unstripped) && invoker.unstripped) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd generally about optional invoker arguments. Especially in this case where the template is private.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

@iskakaushik iskakaushik merged commit 2250c74 into flutter:master Oct 25, 2019
@iskakaushik iskakaushik deleted the debug-symbols-for-fuchsia branch October 25, 2019 19:08
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 25, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 26, 2019
[email protected]:flutter/engine.git/compare/7a9c86b8d5e9...89731ae

git log 7a9c86b..89731ae --no-merges --oneline
2019-10-25 [email protected] Intercept SystemSound.play platform message before it's sent. (flutter/engine#13342)
2019-10-25 [email protected] [fuchsia] [packaging] Layout debug symbols for Fuchsia (flutter/engine#13338)
2019-10-25 [email protected] Roll fuchsia/sdk/core/linux-amd64 from Dr9GE... to fHxWy... (flutter/engine#13358)
2019-10-25 [email protected] Roll fuchsia/sdk/core/mac-amd64 from KC8wX... to Tbg2V... (flutter/engine#13357)
2019-10-25 [email protected] Bump dart/language_model to 9fJQZ0TrnAGQKrEtuL3-AXbUfPzYxqpN_OBHr9P4hE4C (flutter/engine#13337)
2019-10-25 [email protected] Roll src/third_party/skia a7f3157ac012..d0a404e84d47 (6 commits) (flutter/engine#13356)
2019-10-25 [email protected] Roll src/third_party/dart d576ce69e1..5ba6fb73ec (3 commits)
2019-10-25 [email protected] Create a separate directory for the intermediate outputs of each Fuchsia archive build action (flutter/engine#13341)
2019-10-25 [email protected] Fix the output filename of the Fuchsia archive build template (flutter/engine#13339)
2019-10-25 [email protected] Roll src/third_party/dart b42c2af535..d576ce69e1 (10 commits)
2019-10-25 [email protected] Roll src/third_party/skia 24a409611f24..a7f3157ac012 (1 commits) (flutter/engine#13353)
2019-10-25 [email protected] Roll src/third_party/skia 28a8f28b3eaf..24a409611f24 (2 commits) (flutter/engine#13352)
2019-10-25 [email protected] Roll fuchsia/sdk/core/linux-amd64 from 9m5ec... to Dr9GE... (flutter/engine#13351)
2019-10-25 [email protected] Roll fuchsia/sdk/core/mac-amd64 from yuA3r... to KC8wX... (flutter/engine#13350)
2019-10-25 [email protected] Roll src/third_party/skia 6f1c20f01fa9..28a8f28b3eaf (2 commits) (flutter/engine#13348)
2019-10-25 [email protected] Expose platform view ID on embedder semantics node (flutter/engine#13345)
2019-10-25 [email protected] Remove TODO on embedder a11y unit tests (flutter/engine#13346)
2019-10-25 [email protected] Roll src/third_party/dart 1bc9fba660..b42c2af535 (12 commits)
2019-10-25 [email protected] Android embedding API updates for plugin ecosystem - plugin facade, split Lifecycle, save state callbacks to plugins (#43241, #43242, #43295) (flutter/engine#13280)
2019-10-24 [email protected] Roll src/third_party/skia 740f85949db2..6f1c20f01fa9 (16 commits) (flutter/engine#13343)
2019-10-24 [email protected] Roll src/third_party/dart 1bd6e20d76..1bc9fba660 (14 commits)
2019-10-24 [email protected] Roll src/third_party/skia 4ab4e641f151..740f85949db2 (12 commits) (flutter/engine#13336)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
[email protected]:flutter/engine.git/compare/7a9c86b8d5e9...89731ae

git log 7a9c86b..89731ae --no-merges --oneline
2019-10-25 [email protected] Intercept SystemSound.play platform message before it's sent. (flutter/engine#13342)
2019-10-25 [email protected] [fuchsia] [packaging] Layout debug symbols for Fuchsia (flutter/engine#13338)
2019-10-25 [email protected] Roll fuchsia/sdk/core/linux-amd64 from Dr9GE... to fHxWy... (flutter/engine#13358)
2019-10-25 [email protected] Roll fuchsia/sdk/core/mac-amd64 from KC8wX... to Tbg2V... (flutter/engine#13357)
2019-10-25 [email protected] Bump dart/language_model to 9fJQZ0TrnAGQKrEtuL3-AXbUfPzYxqpN_OBHr9P4hE4C (flutter/engine#13337)
2019-10-25 [email protected] Roll src/third_party/skia a7f3157ac012..d0a404e84d47 (6 commits) (flutter/engine#13356)
2019-10-25 [email protected] Roll src/third_party/dart d576ce69e1..5ba6fb73ec (3 commits)
2019-10-25 [email protected] Create a separate directory for the intermediate outputs of each Fuchsia archive build action (flutter/engine#13341)
2019-10-25 [email protected] Fix the output filename of the Fuchsia archive build template (flutter/engine#13339)
2019-10-25 [email protected] Roll src/third_party/dart b42c2af535..d576ce69e1 (10 commits)
2019-10-25 [email protected] Roll src/third_party/skia 24a409611f24..a7f3157ac012 (1 commits) (flutter/engine#13353)
2019-10-25 [email protected] Roll src/third_party/skia 28a8f28b3eaf..24a409611f24 (2 commits) (flutter/engine#13352)
2019-10-25 [email protected] Roll fuchsia/sdk/core/linux-amd64 from 9m5ec... to Dr9GE... (flutter/engine#13351)
2019-10-25 [email protected] Roll fuchsia/sdk/core/mac-amd64 from yuA3r... to KC8wX... (flutter/engine#13350)
2019-10-25 [email protected] Roll src/third_party/skia 6f1c20f01fa9..28a8f28b3eaf (2 commits) (flutter/engine#13348)
2019-10-25 [email protected] Expose platform view ID on embedder semantics node (flutter/engine#13345)
2019-10-25 [email protected] Remove TODO on embedder a11y unit tests (flutter/engine#13346)
2019-10-25 [email protected] Roll src/third_party/dart 1bc9fba660..b42c2af535 (12 commits)
2019-10-25 [email protected] Android embedding API updates for plugin ecosystem - plugin facade, split Lifecycle, save state callbacks to plugins (flutter#43241, flutter#43242, flutter#43295) (flutter/engine#13280)
2019-10-24 [email protected] Roll src/third_party/skia 740f85949db2..6f1c20f01fa9 (16 commits) (flutter/engine#13343)
2019-10-24 [email protected] Roll src/third_party/dart 1bd6e20d76..1bc9fba660 (14 commits)
2019-10-24 [email protected] Roll src/third_party/skia 4ab4e641f151..740f85949db2 (12 commits) (flutter/engine#13336)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants