Quote:
Originally Posted by kubaPL
I have an application that is crashing on an custom platform running linux. When it crashes, the kernel nicely prints out *both* the mem map and the stack information for that process.
1) Does anyone know if this can be turned on in other kernels or is this a custom feature in our kernel?
|
I would assume that you could somehow enable this feature, especially if you're using a vanilla Linux kernel. But I don't know how ... Sorry. (If you're using a Linux kernel shipped with your distro, this might not necessarily be available in the vanilla kernel!)
Quote:
Originally Posted by kubaPL
2) Is it possible to retrieve this information from a core file. I see that it's in an ELF format but the standard binutils tools don't give me the info I need (although i might be using them incorrectly). I'm not particularly keen on creating my own tools seeing as i've found no information on the core file format itself.
|
Yes, you could examine a core file with GDB (GNU Debugger).
Quote:
Originally Posted by kubaPL
3) Is it also possible to retrieve the contents of the registers from said core dump as well? particularly the stack pointer.
|
Yes, that's also possible with GDB. To display the contents of all registers, use
<gdb> info registers
or to display the contents of the stack pointer
<gdb> p $esp
<gdb> p $rsp
(The first command is for 32-bit stack pointers, while the second one is for 64-bit stack pointers)
Quote:
Originally Posted by kubaPL
4) Is it possible to get the prototype from a symbol for a c method. I know you can use c++filt to demangle a c++ method but does c have an equivalent? All I'm interested in is what parameters a particular method symbol has (i.e. method foo has parameters int, int and char). I would guess that nm does not support that but does the binary itself contain this information? Maybe some tool that analyses the machine code to see how many values are pushed on the stack before the program jumps to the method?
|
Basically, C does not use name mangling and you can't retrieve the function type from the function name like in C++.
Yes, you can!
As a prerequsite, you would require to compile your program with debug information (-g), but then you could issue this gdb command to see the function parameters:
<gdb> ptype <func_name>
type = int (int, int, char)
I hope that answers most of your questions ...
- Andi -