I'm developing on an ARM9E processor running Linux. Sometimes my application crashes with the following message :
[ 142.410000] Alignment trap: rtspserverd (996) PC=0x4034f61c Instr=0xe591300c Address=0x0000000d FSR 0x001
How can I translate the PC address to actual source code? In other words, how can I make sense out of this message?
With objdump. Dump your executable, then search for 4034f61c:
.
The -x
, --disassemble
, and -l
options are particularly useful.
You can turn on listings in the compiler and tell the linker to produce a map file. The map file will give you the meaning of the absolute addresses up to the function where the problem occurs, while the listing will help you pinpoint the exact location of the exception within the function.
For example in gcc
you can do
gcc -Wa,-a,-ad -c foo.c > foo.lst
to produce a listing in the file foo.lst
.
-Wa,
sends the following options to the assembler (gas
).
-a
tells gas
to produce a listing on standard output.
-ad
tells gas
to omit debug directives, which would otherwise add a lot of clutter.
The option for the GNU linker to produce a map file is -M
or --print-map
. If you link with gcc
you need to pass the option to the linker with an option starting with -Wl,
, for example -Wl,-M
.
Alternatively you could also run your application in the debugger (e.g. gdb
) and look at the stack dump after the crash with the bt
command.
User contributions licensed under CC BY-SA 3.0