* gdb internal functionality [not found] <33036.210.143.35.19.1225860010.squirrel@www.iap-online.com> @ 2008-11-07 7:49 ` raja.saleru 2008-11-07 12:21 ` EBo 2008-11-07 18:22 ` Michael Snyder 2008-11-14 8:07 ` gdb load command flow raja.saleru [not found] ` <59596.210.143.35.18.1226650013.squirrel@www.iap-online.com> 2 siblings, 2 replies; 13+ messages in thread From: raja.saleru @ 2008-11-07 7:49 UTC (permalink / raw) To: raja.saleru; +Cc: gdb Hi, I would like to know more of GDB internals especially the control flow and functionality for the following gdb commands. For ex. the development environment include gdb on cygwin environment, which is connected to OpenOCD, which inturn connects to ARM target. Any information on this would be very helpful. 1. target remote host:port 2. stepi 3. contrinue 4. break linenum 5. delete bpnum 6. watch expression 7. set/read register value 8. read/write memory 9. quit 10. monitor reset Thanks in Advance Raja Saleru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb internal functionality 2008-11-07 7:49 ` gdb internal functionality raja.saleru @ 2008-11-07 12:21 ` EBo 2008-11-10 10:53 ` Jeremy Bennett 2008-11-07 18:22 ` Michael Snyder 1 sibling, 1 reply; 13+ messages in thread From: EBo @ 2008-11-07 12:21 UTC (permalink / raw) To: raja.saleru; +Cc: gdb I do not know if the following is helpful, but on of my colleagues just helped set me up with debugging a custom avr board with JTAG and gdb. Here are some of the relevant commands and info: to program and set up the connection: avarice --erase --program --file irrigation.elf --mkI \ --jtag /dev/ttyUSB0 --jtag-bitrate 250KHz :4242 to start gdb: avr-gdb --batch --quiet -x test.2.exec test_prog.elf The test.2.exec file looks like: target remote localhost:4242 break 17 comm 1 set adc_data=850 #printf "adc_data=%d,", adc_data continue end break 28 comm 2 printf "adc_data=%d\n", adc_data printf " PASSED!\n" quit end break 85 comm 3 printf "adc_data=%d\n", adc_data printf " FAILED!\n" quit end continue This sets a temp break point to set one of the variables, and the other two break points are set up to trap the correct and failed tests in a simple regression test. Hope that helps, but your millage may vary... EBo -- raja.saleru@iap-online.com said: > Hi, > > I would like to know more of GDB internals especially the control flow and > functionality for the following gdb commands. For ex. the development > environment include gdb on cygwin environment, which is connected to > OpenOCD, which inturn connects to ARM target. Any information on this > would be very helpful. > > 1. target remote host:port > 2. stepi > 3. contrinue > 4. break linenum > 5. delete bpnum > 6. watch expression > 7. set/read register value > 8. read/write memory > 9. quit > 10. monitor reset > > Thanks in Advance > Raja Saleru > -- ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb internal functionality 2008-11-07 12:21 ` EBo @ 2008-11-10 10:53 ` Jeremy Bennett 0 siblings, 0 replies; 13+ messages in thread From: Jeremy Bennett @ 2008-11-10 10:53 UTC (permalink / raw) To: gdb; +Cc: raja.saleru, ebo On Fri, 2008-11-07 at 05:21 -0700, EBo wrote: > > Hi, > > > > I would like to know more of GDB internals especially the control flow and > > functionality for the following gdb commands. For ex. the development > > environment include gdb on cygwin environment, which is connected to > > OpenOCD, which inturn connects to ARM target. Any information on this > > would be very helpful. > > > > 1. target remote host:port > > 2. stepi > > 3. contrinue > > 4. break linenum > > 5. delete bpnum > > 6. watch expression > > 7. set/read register value > > 8. read/write memory > > 9. quit > > 10. monitor reset > > > > Thanks in Advance > > Raja Saleru > > Hi Raja, I assume you've looked at the GDB Internals document (in the distribution or on the website). You'll also find the GDB IRC (#gdb on irc.freenode.net) very helpful for specific questions. Michael Snyder has given you some suggestions for the commands you list. You may also like to look at the guide to porting GDB I wrote earlier this year. http://www.embecosm.com/download/ean3.html Chapter 2 includes some example procedural flows, which include some of the commands you list above. Hope this helps, Jeremy -- Tel: +44 (1202) 416955 Cell: +44 (7970) 676050 SkypeID: jeremybennett Email: jeremy.bennett@embecosm.com Web: www.embecosm.com ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb internal functionality 2008-11-07 7:49 ` gdb internal functionality raja.saleru 2008-11-07 12:21 ` EBo @ 2008-11-07 18:22 ` Michael Snyder 1 sibling, 0 replies; 13+ messages in thread From: Michael Snyder @ 2008-11-07 18:22 UTC (permalink / raw) To: raja.saleru; +Cc: gdb raja.saleru@iap-online.com wrote: > Hi, > > I would like to know more of GDB internals especially the control flow and > functionality for the following gdb commands. For ex. the development > environment include gdb on cygwin environment, which is connected to > OpenOCD, which inturn connects to ARM target. Any information on this > would be very helpful. > > 1. target remote host:port Set a breakpoint at remote_open_1, then look at your call stack. > 2. stepi break at stepi_command. > 3. contrinue break at continue_command. > 4. break linenum This is complex. You'll need to look around within breakpoint.c and, if you want to get down and dirty, in linespec.c. > 5. delete bpnum break at delete_command. > 6. watch expression watch_command > 7. set/read register value There is no "set register" command. You can just use the regular "set" command to assign a value to a register, eg. "set $pc = 0xfeedface". The internal code for manipulating and storing register values is quite complex -- start by looking at regcache.c. > 8. read/write memory Also quite complex. There is a function pointer called "to_xfer_partial" (I know, probably seems non-intuitive). It lives in a struct called a "target_ops", which is defined in target.c. Since you're using "target remote", this pointer will point to "remote_xfer_partial". You can start looking there. > 9. quit break at quit_command. > 10. monitor reset "monitor" is a prefix command that means "send the following to my target, without interpreting it". So "reset" is a command that will be passed to your target. You can find "monitor_command" in target.c, and for the remote target, it will be implemented by function "remote_rcmd" in remote.c ^ permalink raw reply [flat|nested] 13+ messages in thread
* gdb load command flow [not found] <33036.210.143.35.19.1225860010.squirrel@www.iap-online.com> 2008-11-07 7:49 ` gdb internal functionality raja.saleru @ 2008-11-14 8:07 ` raja.saleru 2008-11-14 8:13 ` Ramana Radhakrishnan 2008-11-14 9:07 ` Jeremy Bennett [not found] ` <59596.210.143.35.18.1226650013.squirrel@www.iap-online.com> 2 siblings, 2 replies; 13+ messages in thread From: raja.saleru @ 2008-11-14 8:07 UTC (permalink / raw) To: gdb Hi I would like to know the flow between the gdb and OpenOPCD communication when the below command is executed. (gdb) load I understand till the flow command_line_handler -> load_command() -> target_load() -> generic_load()-> from generic load, how it will communicate with gdbserver of OpenOCD ? Is it through socket write() or through RSP (remtoe serial protocol) ? for sending the executable segments into the target for loading ? At the OpenOCD, which function is called for loading ? Thanks in Advance Raja Saleru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb load command flow 2008-11-14 8:07 ` gdb load command flow raja.saleru @ 2008-11-14 8:13 ` Ramana Radhakrishnan 2008-11-14 9:07 ` Jeremy Bennett 1 sibling, 0 replies; 13+ messages in thread From: Ramana Radhakrishnan @ 2008-11-14 8:13 UTC (permalink / raw) To: raja.saleru; +Cc: gdb On Fri, Nov 14, 2008 at 8:06 AM, <raja.saleru@iap-online.com> wrote: > > Hi > > I would like to know the flow between the gdb and OpenOPCD communication > when the below command is executed. > > (gdb) load > > I understand till the flow > > command_line_handler -> load_command() -> target_load() -> generic_load()-> > > from generic load, how it will communicate with gdbserver of OpenOCD ? Is > it through socket write() or through RSP (remtoe serial protocol) ? for > sending the executable segments into the target for loading ? set debug remote on help set debug will help you. cheers Ramana > > > At the OpenOCD, which function is called for loading ? > > Thanks in Advance > Raja Saleru > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb load command flow 2008-11-14 8:07 ` gdb load command flow raja.saleru 2008-11-14 8:13 ` Ramana Radhakrishnan @ 2008-11-14 9:07 ` Jeremy Bennett 1 sibling, 0 replies; 13+ messages in thread From: Jeremy Bennett @ 2008-11-14 9:07 UTC (permalink / raw) To: gdb; +Cc: raja.saleru On Fri, 2008-11-14 at 03:06 -0500, raja.saleru@iap-online.com wrote: > I would like to know the flow between the gdb and OpenOPCD communication > when the below command is executed. > > (gdb) load > > I understand till the flow > > command_line_handler -> load_command() -> target_load() -> generic_load()-> > > from generic load, how it will communicate with gdbserver of OpenOCD ? Is > it through socket write() or through RSP (remtoe serial protocol) ? for > sending the executable segments into the target for loading ? Hi Raja, target_load() should eventually call target_xfer_partial(), to transfer the bytes to the target. For diagrams of the flow for this and other GDB commands take a look at: http://www.embecosm.com/download/ean3.html The connection to gdbserver will be through RSP. Presumably on the client GDB session you've connected using something like: target remote hostname:port target_xfer_partial() will attempt to use RSP X packets to write the data as binary if the communication channel is 8-bit clean. If not it will use M packets. For a sequence diagram and explanation for this and other GDB commands using RSP take a look at: http://www.embecosm.com/download/ean4.html I'm not hugely familiar with OpenOCD, but I understand that they have their own implementation of gdbserver. In which case I would expect that to be receiving the RSP packets and mapping them into OpenOCD JTAG and using any responses to generate RSP reply packets as required. Any feedback on the above two documents much appreciated. Hope this helps, Jeremy -- Tel: +44 (1202) 416955 Cell: +44 (7970) 676050 SkypeID: jeremybennett Email: jeremy.bennett@embecosm.com Web: www.embecosm.com ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <59596.210.143.35.18.1226650013.squirrel@www.iap-online.com>]
* gdb remote serial packet has wrong address [not found] ` <59596.210.143.35.18.1226650013.squirrel@www.iap-online.com> @ 2008-11-26 1:28 ` raja.saleru 2008-11-26 18:46 ` Michael Snyder [not found] ` <28893.210.143.35.18.1227662837.squirrel@www.iap-online.com> 1 sibling, 1 reply; 13+ messages in thread From: raja.saleru @ 2008-11-26 1:28 UTC (permalink / raw) To: gdb Hi, I am trying to debug the application running on arm based target, gdb,OpenOCD. I am using watch points to debug the application. In debug mode, the below RSP communication shows that the address for the packets m, Z2 and Z0 shows wrong. Is it so ? If yes, what can be the wrong ? Any hint to debug either at gdb side or OpenOCD side ? Is there any possibility of addresses can become single degit like this ? Breakpoint 1, main () at test.c:13 13 int x = 10, y = 2; (gdb) watch x Sending packet: $p8#a8...Ack Packet received: fdffffff Sending packet: $m1,4#fe...Ack Packet received: 00000000 Sending packet: $m560,48#a0...Ack Packet received: 80264402603e0680185c0a00603e0200185c0200603e0400683e0400005e010 0603e0200093c0000493cdc2e185c0b00083a683e0220683e04000844881c0400001fa002001eda0 2 Sending packet: $m9,4#06...Ack Packet received: 05000000 Sending packet: $m9,4#06...Ack Packet received: 05000000 Hardware watchpoint 2: x (gdb) c Continuing. Sending packet: $Hc0#db...Ack Packet received: Sending packet: $s#73...Ack Packet received: T05 Sending packet: $p1e#06...Ack Packet received: 6c050000 Sending packet: $Z0,568,2#b7...Ack Packet received: OK Sending packet: $p8#a8...Ack Packet received: fdffffff Sending packet: $m560,48#a0...Ack Packet received: 80264402603e0680185c0a00603e0200185c0200603e0400683e0400005e010 0603e0200093c0000493cdc2e185c0b00083a683e0220683e04000844881c0400001fa002001eda0 2 Sending packet: $m1,4#fe...Ack Packet received: 00000000 Sending packet: $Z2,1,4#49...Ack Packet received: E10 Packet Z2 (write-watchpoint) is supported Sending packet: $Z2,0,4#48...Ack Packet received: E10 Sending packet: $z2,1,4#69...Ack Packet received: OK Sending packet: $z2,0,4#68...Ack Packet received: OK Sending packet: $Z0,5,2#49...Ack Packet received: OK Warning: Could not insert hardware watchpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. (gdb) Thanks in Advance Raja Saleru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gdb remote serial packet has wrong address 2008-11-26 1:28 ` gdb remote serial packet has wrong address raja.saleru @ 2008-11-26 18:46 ` Michael Snyder 0 siblings, 0 replies; 13+ messages in thread From: Michael Snyder @ 2008-11-26 18:46 UTC (permalink / raw) To: raja.saleru; +Cc: gdb raja.saleru@iap-online.com wrote: > Hi, > > I am trying to debug the application running on arm based target, > gdb,OpenOCD. > > I am using watch points to debug the application. > > In debug mode, the below RSP communication shows that the address for the > packets m, Z2 and Z0 shows wrong. Is it so ? > If yes, what can be the wrong ? Any hint to debug either at gdb side or > OpenOCD side ? > > Is there any possibility of addresses can become single degit like this ? Could be truncation? From 64 bit to 32 bit, eg.? What target architecture does gdb report? > Breakpoint 1, main () at test.c:13 > 13 int x = 10, y = 2; > (gdb) watch x > Sending packet: $p8#a8...Ack > Packet received: fdffffff > Sending packet: $m1,4#fe...Ack > Packet received: 00000000 > Sending packet: $m560,48#a0...Ack > Packet received: > 80264402603e0680185c0a00603e0200185c0200603e0400683e0400005e010 > 0603e0200093c0000493cdc2e185c0b00083a683e0220683e04000844881c0400001fa002001eda0 > 2 > Sending packet: $m9,4#06...Ack > Packet received: 05000000 > Sending packet: $m9,4#06...Ack > Packet received: 05000000 > Hardware watchpoint 2: x > (gdb) c > Continuing. > Sending packet: $Hc0#db...Ack > Packet received: > Sending packet: $s#73...Ack > Packet received: T05 > Sending packet: $p1e#06...Ack > Packet received: 6c050000 > Sending packet: $Z0,568,2#b7...Ack > Packet received: OK > Sending packet: $p8#a8...Ack > Packet received: fdffffff > Sending packet: $m560,48#a0...Ack > Packet received: > 80264402603e0680185c0a00603e0200185c0200603e0400683e0400005e010 > 0603e0200093c0000493cdc2e185c0b00083a683e0220683e04000844881c0400001fa002001eda0 > 2 > Sending packet: $m1,4#fe...Ack > Packet received: 00000000 > Sending packet: $Z2,1,4#49...Ack > Packet received: E10 > Packet Z2 (write-watchpoint) is supported > Sending packet: $Z2,0,4#48...Ack > Packet received: E10 > Sending packet: $z2,1,4#69...Ack > Packet received: OK > Sending packet: $z2,0,4#68...Ack > Packet received: OK > Sending packet: $Z0,5,2#49...Ack > Packet received: OK > Warning: > Could not insert hardware watchpoint 2. > Could not insert hardware breakpoints: > You may have requested too many hardware breakpoints/watchpoints. > > (gdb) > > Thanks in Advance > Raja Saleru > ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <28893.210.143.35.18.1227662837.squirrel@www.iap-online.com>]
* adding new commandline interface to gdb ? [not found] ` <28893.210.143.35.18.1227662837.squirrel@www.iap-online.com> @ 2009-01-06 10:35 ` raja.saleru 2009-01-07 9:09 ` teawater [not found] ` <17669.210.143.35.18.1231238130.squirrel@www.iap-online.com> 1 sibling, 1 reply; 13+ messages in thread From: raja.saleru @ 2009-01-06 10:35 UTC (permalink / raw) To: gdb Hi, We are connecting gdb running on cygwin host into gdbserver running on target using the command "target remote host:port". The gdbserver contains the name of the target, for example TargetName = "xxx". We would like to read the name of the target from gdb, using command-line interface. Lets say we would like to add the new command (gdb) target info target-name This should display the target name "xxx". Initially before thinking on RSP protocol, we need to register this command. Please give us some guidelines on how to register or how to proceed to add new commandline interface to get the target name. Thanks in advance Raja Saleru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: adding new commandline interface to gdb ? 2009-01-06 10:35 ` adding new commandline interface to gdb ? raja.saleru @ 2009-01-07 9:09 ` teawater 0 siblings, 0 replies; 13+ messages in thread From: teawater @ 2009-01-07 9:09 UTC (permalink / raw) To: raja.saleru; +Cc: gdb Read source in src/gdb/remote.c void _initialize_remote (void) On Tue, Jan 6, 2009 at 18:35, <raja.saleru@iap-online.com> wrote: > > Hi, > > We are connecting gdb running on cygwin host into gdbserver running on > target using the command "target remote host:port". The gdbserver contains > the name of the target, for example > > TargetName = "xxx". > > We would like to read the name of the target from gdb, using command-line > interface. > Lets say we would like to add the new command > > (gdb) target info target-name > > This should display the target name "xxx". > > Initially before thinking on RSP protocol, we need to register this command. > > Please give us some guidelines on how to register or how to proceed to add > new commandline interface to get the target name. > > Thanks in advance > Raja Saleru > ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <17669.210.143.35.18.1231238130.squirrel@www.iap-online.com>]
* info watch command [not found] ` <17669.210.143.35.18.1231238130.squirrel@www.iap-online.com> @ 2009-01-20 8:36 ` raja.saleru 2009-01-20 13:46 ` Daniel Jacobowitz 0 siblings, 1 reply; 13+ messages in thread From: raja.saleru @ 2009-01-20 8:36 UTC (permalink / raw) To: gdb Hi, I am having query on "info watch command". consider the below sample (gdb) watch x Hardware watchpoint 2: x (gdb) rwatch y Hardware read watchpoint 3: y (gdb) awatch c Hardware access (read/write) watchpoint 4: c (gdb) info watch Num Type Disp Enb Address What 1 breakpoint keep y 0x00000542 in main at test.c:10 breakpoint already hit 1 time 2 hw watchpoint keep y x 3 read watchpoint keep y y 4 acc watchpoint keep y c by default, it will be hardware watchpoint. for the "info watch" command, only for watch it is showing as "hw watchpoint". however why it is not differentiated for rwatch as "read watchpoint" "hw read watchpoint" ? similarly for awatch. For write watchpoint, there is differentiation. Thanks in advance Raja Saleru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: info watch command 2009-01-20 8:36 ` info watch command raja.saleru @ 2009-01-20 13:46 ` Daniel Jacobowitz 0 siblings, 0 replies; 13+ messages in thread From: Daniel Jacobowitz @ 2009-01-20 13:46 UTC (permalink / raw) To: raja.saleru; +Cc: gdb On Tue, Jan 20, 2009 at 03:36:22AM -0500, raja.saleru@iap-online.com wrote: > by default, it will be hardware watchpoint. for the "info watch" command, > only for watch it is showing as "hw watchpoint". however why it is not > differentiated for rwatch as "read watchpoint" "hw read watchpoint" ? Because all read and access watchpoints are hardware; it is not practical to do either in software. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-01-20 13:46 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <33036.210.143.35.19.1225860010.squirrel@www.iap-online.com>
2008-11-07 7:49 ` gdb internal functionality raja.saleru
2008-11-07 12:21 ` EBo
2008-11-10 10:53 ` Jeremy Bennett
2008-11-07 18:22 ` Michael Snyder
2008-11-14 8:07 ` gdb load command flow raja.saleru
2008-11-14 8:13 ` Ramana Radhakrishnan
2008-11-14 9:07 ` Jeremy Bennett
[not found] ` <59596.210.143.35.18.1226650013.squirrel@www.iap-online.com>
2008-11-26 1:28 ` gdb remote serial packet has wrong address raja.saleru
2008-11-26 18:46 ` Michael Snyder
[not found] ` <28893.210.143.35.18.1227662837.squirrel@www.iap-online.com>
2009-01-06 10:35 ` adding new commandline interface to gdb ? raja.saleru
2009-01-07 9:09 ` teawater
[not found] ` <17669.210.143.35.18.1231238130.squirrel@www.iap-online.com>
2009-01-20 8:36 ` info watch command raja.saleru
2009-01-20 13:46 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox