| | 2 | |
| | 3 | === Debugging === |
| | 4 | ==== GDB ==== |
| | 5 | |
| | 6 | GDB is an open source debugger that is included in the !CodeSourcery development package. |
| | 7 | |
| | 8 | Using a terminal program such as Hyperterm to communicate with the 825 console at the “#” prompt type: |
| | 9 | |
| | 10 | gdbserver :''port'' ''progname'' [''args''] & (where port is the TCP/IP port to be used, and programe is the name of the program to be debugged) |
| | 11 | |
| | 12 | For example: |
| | 13 | |
| | 14 | gdbserver :10000 cardbas 788IDS.77X & |
| | 15 | |
| | 16 | This will start the gdbserver process: |
| | 17 | |
| | 18 | 184 |
| | 19 | |
| | 20 | Process cardbas created; pid = 185 |
| | 21 | |
| | 22 | Listening on port 10000 |
| | 23 | |
| | 24 | From the PC you may then start debugging by selecting the “Debug” perspective and then clicking the “Bug” icon in Eclipse. |
| | 25 | |
| | 26 | For example, the terminal will show: |
| | 27 | |
| | 28 | Remote debugging from host 90.1.1.216 |
| | 29 | |
| | 30 | Breakpoints may be set by double-clicking the border just to the left of a program line in the editor. |
| | 31 | |
| | 32 | F5 – Step Into (If stopped at a function call, this will step into the function) |
| | 33 | |
| | 34 | F6 – Step Over (If stopped at a function call, this will step over to the next statement) |
| | 35 | |
| | 36 | F8 – Resume (If stopped this will resume running) |
| | 37 | |
| | 38 | The “Variables” window will automatically show the local variables that are in use. |
| | 39 | |
| | 40 | Right-click in the “Variables” window and select “Add global Variables…” to select global variables to monitor. These will not appear until the next break. |
| | 41 | |
| | 42 | To stop the debugging session from !CodeSourcery click the red square icon. The application being debugged and the gdbserver will automatically exit. |
| | 43 | |
| | 44 | The terminal window will show: |
| | 45 | |
| | 46 | Killing inferior |
| | 47 | |
| | 48 | It is also possible to set gdbserver to attach to an already executing process. |
| | 49 | |
| | 50 | Determine the existing process ID first by using the PS command. |
| | 51 | |
| | 52 | gdbserver :''port'' – attach ''pid'' & (where ''port ''is the TCP/IP port number and ''pid ''is the process ID) |
| | 53 | |
| | 54 | For example: |
| | 55 | |
| | 56 | gdbserver :10000 –attach 187 & |
| | 57 | |
| | 58 | When using the attach method stopping the debugging session from Eclipse may not stop gdbserver or the application. |