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

Deliver Cilium debug symbols as separate files #550

Merged
merged 34 commits into from
Mar 27, 2024

Conversation

EricMountain
Copy link
Member

@EricMountain EricMountain commented Mar 6, 2024

Provides debug symbols and ensures release and debug binaries are from the same build - so symbol files always match.

  • If the build is invoked with NOSTRIP=0, then the release image has stripped binaries and the debug image has stripped binaries + debug symbol files in /usr/lib/debug.
  • If the build is invoked with NOSTRIP=1, then the release image has non-stripped binaries and the debug image has non-stripped binaries + debug symbol files in /usr/lib/debug.

The latter is somewhat redundant in the debug image since the debug symbols are present both in the binaires and in /usr/lib/debug. I'm hoping this will be acceptable upstream.

Part of the idea is that we should no longer need to touch NOSTRIP. In our current builds, the problem is that both our release and debug builds are lacking symbols by default. To get builds with symbols, we need to go and hack .gitlab-ci.yml and flip NOSTRIP, branch, tag and push. We can’t use our default debug images because they have no symbols, so delve doesn’t understand anything about the binary it’s running.

With this change, all tagged builds deliver a release image that is either stripped or not according to NOSTRIP (so stripped with our default .gitlab-ci.yml), and a debug image that includes the symbol files.
So the debug image works: delve understands the binary, you can do remote debugging from your IDE with port-forward etc.

Also, by systematically delivering the debug symbol files in the debug image in /usr/lib/debug, it makes it easy to split them out for post-processing. If, for instance, I didn’t include the debug files in the non-stripped version of the debug image, then it would be harder to identify the files that should be post-processed.

So I think this strikes a good balance in terms of making it easy to know where to find debug symbols and something I hope upstream should be OK with (it improves usability of the debug image, since currently if NOSTRIP=0, then the debug image has no symbols and it’s useless with Delve and Co).

I'd like to merge this in our fork for now so that we can continue experimenting with this whilst I try to upstream equivalent changes to main.

@EricMountain EricMountain marked this pull request as ready for review March 20, 2024 08:51
@EricMountain EricMountain requested a review from a team March 20, 2024 09:34
Copy link
Member

@jaredledvina jaredledvina left a comment

Choose a reason for hiding this comment

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

Seems alright to me

@EricMountain EricMountain merged commit 667c8e2 into v1.13-dd Mar 27, 2024
25 of 37 checks passed
@EricMountain EricMountain deleted the eric.mountain/symbols branch March 27, 2024 15:24
jaredledvina added a commit that referenced this pull request Apr 2, 2024
Provides debug symbols and ensures `release` and `debug` binaries are from the same build - so symbol files always match.

- If the build is invoked with `NOSTRIP=0`, then the `release` image has stripped binaries and the `debug` image has stripped binaries + debug symbol files in `/usr/lib/debug`.
- If the build is invoked with `NOSTRIP=1`, then the `release` image has non-stripped binaries and the `debug` image has non-stripped binaries + debug symbol files in `/usr/lib/debug`.

The latter is somewhat redundant in the `debug` image since the debug symbols are present both in the binaires and in `/usr/lib/debug`. I'm hoping this will be acceptable upstream.

Part of the idea is that we should no longer need to touch `NOSTRIP`. In our current builds, the problem is that both our `release` and `debug` builds are lacking symbols by default. To get builds with symbols, we need to go and hack `.gitlab-ci.yml` and flip `NOSTRIP`, branch, tag and push. We can’t use our default `debug` images because they have no symbols, so delve doesn’t understand anything about the binary it’s running.

With this change, all tagged builds deliver a `release` image that is either stripped or not according to `NOSTRIP` (so stripped with our default `.gitlab-ci.yml`), and a `debug` image that includes the symbol files.
So the `debug` image works: delve understands the binary, you can do remote debugging from your IDE with port-forward etc.

Also, by systematically delivering the debug symbol files in the `debug` image in `/usr/lib/debug`, it makes it easy to split them out for post-processing. If, for instance, I didn’t include the debug files in the non-stripped version of the `debug` image, then it would be harder to identify the files that should be post-processed.

So I think this strikes a good balance in terms of making it easy to know where to find debug symbols and something I hope upstream should be OK with (it improves usability of the `debug` image, since currently if `NOSTRIP=0`, then the `debug` image has no symbols and it’s useless with Delve and Co).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants