Stripping all but specified debug information from executable

I'm developing a shared library for Linux that spawns some threads I want to label in the debugger.

I've read this can be done by writing to /proc/[PID]/tasks/[TID]/comm, but this isn't working (I'm targeting an older libc). I also want to be able to assign names longer than the comm limit.

My plan was to auto-load a Python script to do this by placing it in the .debug_gdb_scripts section.

However I want to strip debug information besides the script and what it needs. I've tried using the --keep-symbol option but all of the debug sections (include .debug_gdb_scripts) are still removed.

Is there some way to keep these?


One idea that comes to mind is to strip your program first, and then add the .debug_gdb_scripts afterwards, using objcopy.

Another way might be to put .debug_gdb_scripts inside the mini debug section. I think this should work ok, though it is a bit weird -- I think the first approach is more sound.

Yet another option is to just do the standard thing and strip all the debuginfo to a separate debuginfo file, which you would then use when debugging. However from your question I assume there is some reason you don't want to do this.

Need Your Help

Export to Excel exports the whole webpage and not just the gridview(Sorting enabled)

c# gridview export-to-excel gridview-sorting

In my C# application, I am generating a Gridview from user's input and then I have to give user an option to export the Gridview to the excel sheet.

OpenGL ES 1.1 depth buffer not working using MonoTouch on iOS 5

c# ios opengl-es xamarin.ios depth-buffer

I can't get the depth buffer to work using MonoTouch on iOS 5. I'm using the standard MonoTouch "OpenGL Application" template and added this code to test the depth buffer (OpenGL ES 1.1):