Reputation: 33
Is it possible to DISABLE source code view in backtrace, to display only line numbers and file names?
I mean do NOT include these informations to application, because you can also read from the application file.
I don't want anyone to see my source code.
If it's impossible in GDB, is there any other debugger with such feature?
Upvotes: 1
Views: 1244
Reputation: 25599
GDB can only show your source code if it can find your original source files. If people can see your source in the backtrace, then presumably they can also see your entire source base.
Therefore, I suspect you mean that you do not want the compiler to include any of your sources in the application binaries?
In fact, the application binaries only contain the source filenames, line numbers, symbol names (such as function and variable names), and some type information. If you use -g3
then they might also include preprocessor macros, but most people just use -g
.
The easiest way to exclude the 'source' information is to not ship binaries with debug information. You can either build it without using -g
in the first place, or you can use strip
to remove it after the fact.
Not building with debug info will remove all symbol names that are not absolutely necessary (including static
functions, and all local variable names), but it will not remove the symbol names for externally visible functions: the linker needs to see those. strip
can remove some of those also, I think, although I've never tried. Beware that libraries must have symbol names for externally visible function.
Removing debug info will also remove line-number information, and source file names, so this still isn't quite what you want.
I'd suggest a) refactoring your source code so that isn't embarrassing and/or give away any clues, and b) don't ship with debug info.
Upvotes: 2