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

[Feat]: build an additional Netdata nightly image with debug symbols in CI #13341

Closed
ilyam8 opened this issue Jul 8, 2022 · 5 comments · Fixed by #13359
Closed

[Feat]: build an additional Netdata nightly image with debug symbols in CI #13341

ilyam8 opened this issue Jul 8, 2022 · 5 comments · Fixed by #13359
Assignees
Labels
area/packaging Packaging and operating systems support feature request New features

Comments

@ilyam8
Copy link
Member

ilyam8 commented Jul 8, 2022

Problem

We have to build a custom Netdata image manually every time we need to debug a segfault when Netdata is running inside a Docker container.

It would be very nice to build a Netdata image with CFLAGS="-O1 -ggdb" in our CI.

Description

A nightly Netdata image build with CFLAGS="-O1 -ggdb".

Importance

really want

Value proposition

We need it to debug segfaults when Netdata is running inside a Docker container.

Proposed implementation

No response

@ilyam8 ilyam8 added area/packaging Packaging and operating systems support feature request New features labels Jul 8, 2022
@Ferroin
Copy link
Member

Ferroin commented Jul 8, 2022

Could I get some better clarification about exactly what is desired here that is not working (IOW exactly what debugging functionality is missing that is needed)? -ggdb is an exceedingly heavy option, both at build time and at runtime, and while it is possible to eliminate the runtime overhead it is somewhat complicated to get it right.

If all we care about is working symbolic backtraces and those are not working, then something is broken in the build (binaries are getting stripped when they should not be) and we do not need -ggdb.

If we actually need line number resolution or similar functionality, then we probably do need a -g option, but may not need -ggdb specifically. Regardless of the exact option, we will need to set up detached debugging symbols so that we don’t add a ridiculous additional runtime memory overhead to the binaries, which is not exactly a trivial change to the build process.

Irrespective of that, if we are running into problems with debugging that require us to build with -O1 to resolve, then I would seriously question the quality of our code in the first place. Unless we’re doing stuff resulting in super aggressive inlining of code, we should not be seeing a significant difference

@ilyam8 ilyam8 changed the title [Feat]: build Netdata nightly image with debug symbols in CI [Feat]: build an additional Netdata nightly image with debug symbols in CI Jul 9, 2022
@ilyam8
Copy link
Member Author

ilyam8 commented Jul 9, 2022

@Ferroin I didn't mean building Netdata nightly with CFLAGS="-O1 -ggdb", but an additional nightly image (e.g. netdata/debug:latest)

@Ferroin
Copy link
Member

Ferroin commented Jul 11, 2022

I reiterate though, what specifically is needed here? AIUI, -ggdb is only needed to get things like line number references in function names, hence my question of what debugging functionality is not working here.

On a side note, you probably want -Og, not -O1 for this type of thing.

@Ferroin
Copy link
Member

Ferroin commented Jul 11, 2022

OK, based on discussion in the agent sync meeting I understand better what’s actually needed here.

Current plan is:

  • Add a new build argument (DEBUG_BUILD) to the Dockerfile to switch the default CFLAGS from -O2 -pipe to -Og -ggdb -pipe. This way we have a cleanly reproducible to easily test builds locally.
  • Add a new docker image named netdata/netdata-dbg, which will mirror netdata/netdata, but use the above-mentioned build argument during the build process. This will give us usable nightlies and stable builds with debug symbols.
  • Investigate long-term how we can improve things for native packages and static installs (I think our Debian packages are already set up to generate split debugging symbols properly, so we should just need to add -ggdb there, but our RPM packages and the static builds will be trickier).

@ilyam8
Copy link
Member Author

ilyam8 commented Jul 11, 2022

Thanks, one little thing from me - netdata-debug looks better than netdata-dbg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging Packaging and operating systems support feature request New features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants