0

I am trying to fetch the register info for each of the General purpose registers in ARM.

For example, When we have a seg. fault, we create a core dump and from that we can examine, register info, for example: info register r0 and the assembly code using diassemble.

I did try the following link This is the following error I get: file format not recognized; treating as linker script

Could it be that the way I am linking is wrong?

gcc -g -std=c99 -O2 -mthumb -S -march=armv7 -mthumb-interwork -static -ffunction-sections -O0 foo.c -c -o foo.o
gcc -g -std=c99 -mthumb -march=armv7 -mthumb-interwork -static -ffunction-sections -O0 foo.o -o foo 

I saw one answer by Nils Pipenbrinck, but I did not understand how he fetched the register info.

Could you please tell me how do I get the register info?

Community
  • 1
  • 1
pistal
  • 2,310
  • 13
  • 41
  • 65
  • Can you elaborate on what are you trying to achieve? – auselen Jun 26 '13 at 09:04
  • For example, in this link: `http://stackoverflow.com/questions/5429137/how-to-print-register-values-in-gdb` , We saw how to get register info. but how do I get if I have no core dump. This is what I get using the above technique: `gdb) info registers The program has no registers now.` – pistal Jun 26 '13 at 09:06
  • If you don't have a core dump or some kind of tombstone I think you're going to have a hard time finding out the registers' values at the time of the crash. – Michael Jun 26 '13 at 09:10
  • The program won't crash, but is there a way for me to get the register info? – pistal Jun 26 '13 at 09:11
  • 1
    The ultimate issue is not related to the question. `gdb` was not invoked correctly. – artless noise Sep 12 '13 at 17:47

1 Answers1

0

Hiding my face in embarrassment: gdb foo <pid>

pistal
  • 2,310
  • 13
  • 41
  • 65