This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Adding backtrace to an arm-based on-target debugger


>Hello All,
>
>I am trying to get the back trace working for an arm-based target
>debugger. The remote gdb protocol does not specify about the
>handshakes that go on between the gdb and the remote  target.
>
>I am using GNU gdb 6.0 configured as  "--host=i686-pc-cygwin
--target=arm-elf".
>
>Can someone tell me which registers does the gdb use when it is trying
>to do a backtrace?
>On what basis does it send out the "$m" command?
>What is the protocol involved? 
Hope you have gone through the GDB Remote Serial Protocol.
[http://www.cs.odu.edu/~public/gdbdocs/gdb_32.html]

Relevant section: D.3 Stop Reply Packets
http://www.cs.odu.edu/~public/gdbdocs/gdb_32.html#SEC629

So, when GDB is waiting in response to 's' or 'c' commands,
target (when it stops as a result of exception, fault, etc)
would typically send the signal encountered, along with PC,
Stack Pointer, etc.
PC helps locate the source line, and stack pointer helps locate
the stack frames and hence function along with it's arguments.
This the case with MIPS, and believe the behaviour should be
similar for other archs. GDB has complete knowledge about how
the stack frame for particular arch looks.

>What happens if the enviornment in which the application being
>debugged is compiled by "armcc", but the debuggable application is
>compiled in "arm-elf-gcc"?

These lines seem a bit confusing:
>the enviornment in which the application being
>debugged is compiled by ...
Can you elaborate a bit on this.  What exactly you mean
when you say "environment is compiled by ..."?


>The application being debugged(by arm-elf-gcc) jumps in and out of the
>armcc compiled code.

>
>The following is the set of register values shown on the gdb prompt. I
>have also shown what happens after I do a "bt" at the command prompt.
>
>Any help would be greatly appreciated. Thanks in advance.
>Nagender
>

cheers,
Atul T
---------------------------------------------------------- 
Be not afraid of life. Believe that life is worth living,
and your belief will help create the fact."
                                            - Henry James
---------------------------------------------------------- 

>
> (gdb) i r
>r0             0xd380c0 13861056
>r1             0xb0c478 11584632
>r2             0xd11a68 13703784
>r3             0x0      0
>r4             0xd38124 13861156
>r5             0xd50aec 13961964
>r6             0xb0c494 11584660
>r7             0xb0c978 11585912
>r8             0x0      0
>r9             0xd3da98 13884056
>r10            0x69817c 6914428
>r11            0xb00fb0 11538352
>r12            0xb00fb4 11538356
>sp             0xb00d44 11537732
>lr             0x602c   24620
>pc             0x2058   8280
>fps            0x0      0
>cpsr           0x0      0
>
>(gdb) bt
>Sending packet: $mb00f98,4#66...Ack
>Packet received: c080d300
>#0  ET_SaveReport (pApp=0xd380c0) at et_dbfunctions.c:732
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fa4,4#8a...Ack
>Packet received: cc0fb000
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fcc,4#bb...Ack
>Packet received: fc0ad500
>Sending packet: $md50af4,4#91...Ack
>Packet received: 04b04ce2
>Sending packet: $md50af8,4#95...Ack
>Packet received: 08d04de2
>Sending packet: $md50afc,4#c0...Ack
>Packet received: 14000be5
>Sending packet: $md50b00,4#58...Ack
>Packet received: 14301be5
>Sending packet: $md50b04,4#5c...Ack
>Packet received: 18300be5
>Sending packet: $md50b08,4#60...Ack
>Packet received: 18001be5
>Sending packet: $md50b0c,4#8b...Ack
>Packet received: 01f0ffeb
>Sending packet: $md50b10,4#59...Ack
>Packet received: 18001be5
>Sending packet: $md50b14,4#5d...Ack
>Packet received: e7eeffeb
>Sending packet: $md50b18,4#61...Ack
>Packet received: 18301be5
>Sending packet: $md50b1c,4#8c...Ack
>Packet received: 0c3093e5
>Sending packet: $md50b20,4#5a...Ack
>Packet received: 003093e5
>Sending packet: $md50b24,4#5e...Ack
>Packet received: 18201be5
>Sending packet: $md50b28,4#62...Ack
>Packet received: 2c4093e5
>Sending packet: $md50b2c,4#8d...Ack
>Packet received: 0c0092e5
>Sending packet: $md50b30,4#5b...Ack
>Packet received: bb1fa0e3
>Sending packet: $mb00fa4,4#8a...Ack
>Packet received: cc0fb000
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>#1  0x00d50b10 in ?? ()
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fa4,4#8a...Ack
>Packet received: cc0fb000
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>Sending packet: $mb00fcc,4#bb...Ack
>Packet received: fc0ad500
>Sending packet: $md50af4,4#91...Ack
>Packet received: 04b04ce2
>Sending packet: $md50af8,4#95...Ack
>Packet received: 08d04de2
>Sending packet: $md50afc,4#c0...Ack
>Packet received: 14000be5
>Sending packet: $md50b00,4#58...Ack
>Packet received: 14301be5
>Sending packet: $md50b04,4#5c...Ack
>Packet received: 18300be5
>Sending packet: $md50b08,4#60...Ack
>Packet received: 18001be5
>Sending packet: $md50b0c,4#8b...Ack
>Packet received: 01f0ffeb
>Sending packet: $md50b10,4#59...Ack
>Packet received: 18001be5
>Sending packet: $md50b14,4#5d...Ack
>Packet received: e7eeffeb
>Sending packet: $md50b18,4#61...Ack
>Packet received: 18301be5
>Sending packet: $md50b1c,4#8c...Ack
>Packet received: 0c3093e5
>Sending packet: $md50b20,4#5a...Ack
>Packet received: 003093e5
>Sending packet: $md50b24,4#5e...Ack
>Packet received: 18201be5
>Sending packet: $md50b28,4#62...Ack
>Packet received: 2c4093e5
>Sending packet: $md50b2c,4#8d...Ack
>Packet received: 0c0092e5
>Sending packet: $md50b30,4#5b...Ack
>Packet received: bb1fa0e3
>Sending packet: $mb00fac,4#b9...Ack
>Packet received: 100bd500
>(gdb)
>
>
>
>On Mon, 05 Jul 2004 10:04:44 +0530, Ramana Radhakrishnan
><ramana.radhakrishnan@codito.com> wrote:
>> 
>> >I am working on developing an on-target debugger for applications on
>> >an arm-based target. I need to add a backtrace feature to it.
>> >
>> >Can someone tell me where to look for the gdb serial protocol?
>> >
>> >
>> 1. info gdbint.
>> 2. gdb/remote.c
>> 
>> >When I do a "bt" on the gdb prompt I get only the current frame. It
>> >does not go beyond the current frame. It is as shown below.
>> >
>> >#0  Test_Func(nValue=525, psValueBuf=0xb00f0c,
>> >Sending packet: $mb00ee0,4#89...Ack
>> >Packet received: 14000000
>> >   nValueBufSize=20) at et_amountctl.c:390
>> >#1  0x00d4b9e4 in ?? ()
>> >
>> >Can you tell me what do I need to do in the target-side stub?
>> >
>> >
>> >
>> Please submit your problem with a script of your debug session
showing
>> exactly all that you did before this and a small testcase mentioning
the
>> version of gdb , gcc and binutils that you are currently using for
this.
>> 
>> You could take a look at the script command in bash or you could use
>> emacs to capture the debug session using M-x gdb .
>> 
>> cheers
>> Ramana
>>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]