
GRMON3-UM
June 2019, Version 3.1.0
28
www.cobham.com/gaisler
reached or between single-stepping stops. GRMON have to access the memory rather many times to retrieve the
information, GRMON. See Section 3.8, “Thread support” for more information.
Start GRMON with the
-nothreads
switch to disable threads in GRMON and thus in GDB too.
Note that GRMON must have access to the symbol table of the operating system so that the thread structures of
the target OS can be found. The symbol table can be loaded from GDB by one must bear in mind that the path is
relative to where GRMON has been started. If GDB is connected to GRMON over the network one must make
the symbol file available on the remote computer running GRMON.
(gdb) mon puts [pwd]
/home/daniel
(gdb) pwd
Working directory /home/daniel.
(gdb) mon sym load /opt/rtems-4.10/src/samples/rtems-hello
(gdb) mon sym
0x00016910 GLOBAL FUNC imfs_dir_lseek
0x00021f00 GLOBAL OBJECT Device_drivers
0x0001c6b4 GLOBAL FUNC _mprec_log10
...
When a program running in GDB stops GRMON reports which thread it is in. The command info threads can be
used in GDB to list all known threads, thread N to switch to thread N and bt to list the backtrace of the selected
thread.
Program received signal SIGINT, Interrupt.
[Switching to Thread 167837703]
0x40001b5c in console_outbyte_polled (port=0, ch=113 `q`) at rtems/.../leon3/console/debugputs.c:38
38 while ((LEON3_Console_Uart[LEON3_Cpport]->status & LEON_REG_UART_STATUS_THE) == 0);
(gdb) info threads
8 Thread 167837702 (FTPD Wevnt) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
7 Thread 167837701 (FTPa Wevnt) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
6 Thread 167837700 (DCtx Wevnt) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
5 Thread 167837699 (DCrx Wevnt) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
4 Thread 167837698 (ntwk ready) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
3 Thread 167837697 (UI1 ready) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
2 Thread 151060481 (Int. ready) 0x4002f760 in _Thread_Dispatch () at rtems/.../threaddispatch.c:109
* 1 Thread 167837703 (HTPD ready ) 0x40001b5c in console_outbyte_polled (port=0, ch=113 `q`)
at ../../../rtems/c/src/lib/libbsp/sparc/leon3/console/debugputs.c:38
(gdb) thread 8
[Switching to thread 8 (Thread 167837702)]#0 0x4002f760 in _Thread_Dispatch ()
at rtems/.../threaddispatch.c:109
109 _Context_Switch( &executing->Registers, &heir->Registers );
(gdb) bt
#0 0x4002f760 in _Thread_Dispatch () at rtems/cpukit/score/src/threaddispatch.c:109
#1 0x40013ee0 in rtems_event_receive(event_in=33554432, option_set=0, ticks=0, event_out=0x43fecc14)
at ../../../../leon3/lib/include/rtems/score/thread.inl:205
#2 0x4002782c in rtems_bsdnet_event_receive (event_in=33554432, option_set=2, ticks=0,
event_out=0x43fecc14) at rtems/cpukit/libnetworking/rtems/rtems_glue.c:641
#3 0x40027548 in soconnsleep (so=0x43f0cd70) at rtems/cpukit/libnetworking/rtems/rtems_glue.c:465
#4 0x40029118 in accept (s=3, name=0x43feccf0, namelen=0x43feccec) at rtems/.../rtems_syscall.c:215
#5 0x40004028 in daemon () at rtems/c/src/libnetworking/rtems_servers/ftpd.c:1925
#6 0x40053388 in _Thread_Handler () at rtems/cpukit/score/src/threadhandler.c:123
#7 0x40053270 in __res_mkquery (op=0, dname=0x0, class=0, type=0, data=0x0, datalen=0, newrr_in=0x0,
buf=0x0, buflen=0)
at ../rtems/cpukit/libnetworking/libc/res_mkquery.c:199
#8 0x00000008 in ?? ()
#9 0x00000008 in ?? ()
Previous frame identical to this frame (corrupt stack?)
In comparison to GRMON the frame command in GDB can be used to select a individual stack frame. One can
also step between frames by issuing the up or down commands. The CPU registers can be listed using the info
registers command. Note that the info registers command only can see the following registers for an inactive
task: g0-g7, l0-l7, i0-i7, o0-o7, PC and PSR. The other registers will be displayed as 0:
gdb) frame 5
#5 0x40004028 in daemon () at rtems/.../rtems_servers/ftpd.c:1925
1925 ss = accept(s, (struct sockaddr *)&addr, &addrLen);
(gdb) info reg