Is there a way to force gcc
to generate only subset of full debug info that will be sufficient for addr2line
utility? Or any way to strip unneeded? I've tried
$ objcopy --only-keep-debug --remove-section=.debug_loc --remove-section=.debug_aranges --remove-section=.debug_frame my-elf-file
Is there anything that may be stripped in addition?
You want
-g1
. This produces minimal debug info for backtraces. From the manual:You can also strip some of the debug info after the fact. One way to do this is described in the gdb "MiniDebugInfo" documentation.