How to increase the chance of matching Linux kernel kernel characters?

I have a very complicated cross-platform application. Recently, my team and I conducted stress tests and encountered several accidents (as well as the main dumps accompanying them). Some of these core dumps are very accurate and show me the exact place where the crash occurred when using about 10 or more stack frames. Others sometimes have only one frame stack with ?? being the only character!

What I would like to know:

  • Is there a way to increase the chance of dropping cells in the right direction?
  • Why is the number of stack frames not matched?
  • Any recommendation for managing core dumps.

Here I am compiling binaries (in release mode):

  • Compiler and platform: g ++ with glibc-2.3.2-95.50 on CentOS 3.6 x86_64 - This helps me maintain compatibility with older versions of Linux.
  • All files compiled with the -g flag.
  • Debugging characters are removed from the final binary file and stored in a separate file.
  • When I have a kernel dump, I use GDB with the executable that the kernel created and the character file. GDB never complains that there is a mismatch between primary / binary / characters.

But sometimes I get basic dumps with no characters at all! It’s clear that I’m communicating with the non-debugging version of libstdC ++ and libgcc, but it would be nice if at least the stack trace shows me where in my code the command was called incorrectly (although this may end in the end?) ..

+5
3

"??" !

:

  • ()
  • EBP/RBP ( x86/x64) - , . , -fomit-frame-pointer asm,

, , , glibc. (- , glibc-debug {info, source] openSUSE).

gdb , glibc, glibc backtrace, , , gdb .

: -)

+7

, glibc backtrace ( backtrace_symbols backtrace_symbols_fd) , , . , .

+3
  • , ? , (Ubuntu) libc6-dbg, libstdc++6-4.5-dbg, libgcc1-dbg ..
  • If you are building with optimization turned on (for example -O2), the compiler can blur the border between the frames of the stack, for example, by pasting. I'm not sure that this will cause backtraces with only one stack frame, but in general the rule should expect great debugging complexity, since the code that you look at the kernel kernel has been changed and therefore does not necessarily correspond to your source.
+2
source

All Articles