Call stack for code compiled without the -g option (gcc compiler)

How to analyze a kernel dump (using gdb) that is not compiled with the -g GCC option?

+3
source share
3 answers

Create a map file. The map file will tell you the address at which each function begins (as an offset from the beginning of the exe, so you will also need to know the loaded base address). So, then you look at the instruction pointer and see where it gets into the map file. This gives you an idea of ​​the location in this function.

- , , . , , , , , . . , , , , . , , , , :)

+6

ELF . objcopy:

  • ( -g). , foo, ...
  • objcopy --only-keep-debug foo foo.dbg, , .
  • objcopy --strip-debug foo, .
  • objcopy --add-gnu-debuglink = foo.dbg foo, .
+2

, -g gdb , - .

BTW gcc

gcc -Wl, -Map = system.map file.c

The above line should generate a system.map map file. After creating the map file, you can map the address as described above, but I'm not sure how you are going to map the partition library, it is very difficult.

+1
source

Source: https://habr.com/ru/post/1774691/


All Articles