Download GNAT User's Guide
Transcript
Appendix G: LynxOS Topics (gdb) file my_program (gdb) target remote myboard:2345 To run the cross debugger from the command line without the visual interface use the command powerpc-elf-lynxos-gdb. You will see something like: GNU gdb 4.17.gnat.3.14a1 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=sparc-sun-solaris2.5.1 --target=powerpc-elf-lynxos". (gdb) where (gdb) is the debugger’s prompt. The first thing to do at the prompt from within gdb is to load the symbol table from the executable: (gdb) file demo1 Reading symbols from demo1...done. (gdb) You then have to attach to the server running on the board. Issue the command: (gdb) target remote myboard:2345 After the server has been started and attached from the host, the program is running on the target but has halted execution at the very beginning. The following commands set a breakpoint and continue execution: (gdb) break demo1.adb:37 Breakpoint 1 at 0x100064d0: file demo1.adb, line 37. (gdb) cont Continuing. Breakpoint 1, demo1 () at demo1.adb:37 37 Set_Name (Fuel, "Fuel"); (gdb) Here the execution has stopped at the breakpoint set above. Now you can use the standard gdb commands to examine the stack and program variables. Note that once execution has completed, the server on the board must be restarted before a new debugging session may begin. G.4 An Example Cross Debugging Session for LynxOS Carrying on a little further with the debugging session, the following example illustrates some of the usual debugging commands for moving around and seeing where you are: (gdb) next 38 Set_Name (Water, "Water"); (gdb) bt 107