
GRMON3-UM
June 2019, Version 3.1.0
25
www.cobham.com/gaisler
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/bcc-2.0.7-rc.1-gcc/src/examples/stanford/stanford...done.
(gdb) target extended-remote :2222
Remote debugging using :2222
__bcc_entry_point () at /opt/bcc-2.0.7-rc.1-gcc/src/libbcc/shared/trap/trap_table_mvt.S:81
81 RESET_TRAP(__bcc_trap_reset_mvt); ! 00 reset
(gdb)
3.7.2. Executing GRMON commands from GDB
While GDB is attached to GRMON, most GRMON commands can be executed using the GDB monitor command.
Output from the GRMON commands is then displayed in the GDB console like below. Some DSU commands are
naturally not available since they would conflict with GDB. All commands executed from GDB are executed in a
separate Tcl interpreter, thus variables created from GDB will not be available from the GRMON terminal.
(gdb) monitor hist
TIME ADDRESS INSTRUCTIONS/AHB SIGNALS RESULT/DATA
30046975 40003e20 AHB read mst=0 size=2 [9de3bf90]
30046976 40005030 or %l2, 0x1e0, %o3 [40023de0]
30046980 40003e24 AHB read mst=0 size=2 [91d02001]
30046981 40005034 call 0x40003e20 [40005034]
30046985 40003e28 AHB read mst=0 size=2 [b136201f]
30046990 40003e2c AHB read mst=0 size=2 [f83fbff0]
30046995 40003e30 AHB read mst=0 size=2 [82040018]
30047000 40003e34 AHB read mst=0 size=2 [d11fbff0]
30047005 40003e38 AHB read mst=0 size=2 [9a100019]
30047010 40003e3c AHB read mst=0 size=2 [9610001a]
(gdb)
3.7.3. Running applications from GDB
To load and start an application, use the GDB load and run command.
$ sparc-rtems-gdb v8/stanford.exe
(gdb) target extended-remote :2222
Remote debugging using :2222
main () at stanford.c:1033
1033 {
(gdb) load
Loading section .text, size 0xdb30 lma 0x40000000
Loading section .data, size 0xb78 lma 0x4000db30
Start address 0x40000000, load size 59048
Transfer rate: 18 KB/sec, 757 bytes/write.
(gdb) b main
Breakpoint 1 at 0x40004074: file stanford.c, line 1033.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/daniel/examples/v8/stanford.exe
Breakpoint 1, main () at stanford.c:1033
1033 {
(gdb) list
1028 /* Printcomplex( 6, 99, z, 1, 256, 17 ); */
1029 };
1030 } /* oscar */ ;
1031
1032 main ()
1033 {
1034 int i;
1035 fixed = 0.0;
1036 floated = 0.0;
1037 printf ("Starting \n");
(gdb)
To interrupt execution, Ctrl-C can be typed in GDB terminal (similar to GRMON). The program can be restarted
using the GDB run command but the program image needs to be reloaded first using the load command. Software
trap 1 (TA 0x1) is used by GDB to insert breakpoints and should not be used by the application.
GRMON translates SPARC traps into (UNIX) signals which are properly communicated to GDB. If the application
encounters a fatal trap, execution will be stopped exactly before the failing instruction. The target memory and
register values can then be examined in GDB to determine the error cause.
GRMON implements the GDB breakpoint and watchpoint interface and makes sure that memory and cache are
synchronized.