Skip to content

Commit

Permalink
[antlir2][debuginfo] add more debugging output for other objcopy calls
Browse files Browse the repository at this point in the history
Summary:
I thought just the buildid one failed, but the others have some transient
errors too, so add the same output logic to those too

Test Plan:
```
❯ buck2 test fbcode//mode/opt fbcode//antlir/antlir2/features/install/...
Buck UI: https://www.internalfb.com/buck2/36e4a78e-416d-4262-8690-49fb6c9c24c7
Test UI: https://www.internalfb.com/intern/testinfra/testrun/3377699957658696
Network: Up: 80KiB  Down: 569MiB  (reSessionID-6c8996eb-a873-45b3-bbdb-6e06cb20e344)
Jobs completed: 264679. Time elapsed: 1:29.3s.
Cache hits: 97%. Commands: 2777 (cached: 2699, remote: 0, local: 78). Fallback: 3/78
Tests finished: Pass 37. Fail 0. Fatal 0. Skip 0. Build failure 0
```

Reviewed By: naveedgol

Differential Revision: D59113714

fbshipit-source-id: 94b2745c47a500300aafbcd1e4eaeb89be8e838b
  • Loading branch information
vmagro authored and facebook-github-bot committed Jun 27, 2024
1 parent f0cbffa commit 49a29c6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions antlir/antlir2/bzl/debuginfo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,24 @@ if not is_elf:
sys.exit(0)
# Save debug symbols to a separate debuginfo file
subprocess.run(
proc = subprocess.run(
[
args.objcopy,
"--only-keep-debug",
args.binary,
args.debuginfo,
],
check=True,
capture_output=True,
)
if proc.returncode != 0:
raise RuntimeError("Failed to extract debug symbols for {}:\\n{}\\n{}".format(
args.binary,
proc.stdout.decode("utf-8", errors = "surrogateescape"),
proc.stderr.decode("utf-8", errors = "surrogateescape"),
))
# Remove the debug symbols from the stripped binary
subprocess.run(
proc = subprocess.run(
[
args.objcopy,
"--strip-debug",
Expand All @@ -97,8 +103,14 @@ subprocess.run(
args.binary,
args.stripped,
],
check=True,
capture_output=True,
)
if proc.returncode != 0:
raise RuntimeError("Failed to extract debug symbols for {}:\\n{}\\n{}".format(
args.binary,
proc.stdout.decode("utf-8", errors = "surrogateescape"),
proc.stderr.decode("utf-8", errors = "surrogateescape"),
))
# Find the BuildID of the binary. This determines where it should go for gdb to
# look it up under /usr/lib/debug
Expand Down

0 comments on commit 49a29c6

Please sign in to comment.