rtos/hwthread: add hardware-thread pseudo rtos
This patch adds "hwthread", a pseudo rtos that represents cpu cores in an SMP system as threads to gdb. This allows to debug SMP system kernels in a more sensible manner and removes the current atrocities of switching gdb manually between CPU cores to update the context. Change-Id: Ib781c6c34097689d21d9e02011e4d74a4a742379 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/3999 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Graham Sanderson <graham.sanderson@gmail.com>
This commit is contained in:
committed by
Matthias Welwarsky
parent
56568b7996
commit
85ba2dc4c6
+67
-51
@@ -10199,55 +10199,6 @@ and GDB would require stopping the target to get the prompt back.
|
||||
Do not use this mode under an IDE like Eclipse as it caches values of
|
||||
previously shown varibles.
|
||||
|
||||
@anchor{usingopenocdsmpwithgdb}
|
||||
@section Using OpenOCD SMP with GDB
|
||||
@cindex SMP
|
||||
For SMP support following GDB serial protocol packet have been defined :
|
||||
@itemize @bullet
|
||||
@item j - smp status request
|
||||
@item J - smp set request
|
||||
@end itemize
|
||||
|
||||
OpenOCD implements :
|
||||
@itemize @bullet
|
||||
@item @option{jc} packet for reading core id displayed by
|
||||
GDB connection. Reply is @option{XXXXXXXX} (8 hex digits giving core id) or
|
||||
@option{E01} for target not smp.
|
||||
@item @option{JcXXXXXXXX} (8 hex digits) packet for setting core id displayed at next GDB continue
|
||||
(core id -1 is reserved for returning to normal resume mode). Reply @option{E01}
|
||||
for target not smp or @option{OK} on success.
|
||||
@end itemize
|
||||
|
||||
Handling of this packet within GDB can be done :
|
||||
@itemize @bullet
|
||||
@item by the creation of an internal variable (i.e @option{_core}) by mean
|
||||
of function allocate_computed_value allowing following GDB command.
|
||||
@example
|
||||
set $_core 1
|
||||
#Jc01 packet is sent
|
||||
print $_core
|
||||
#jc packet is sent and result is affected in $
|
||||
@end example
|
||||
|
||||
@item by the usage of GDB maintenance command as described in following example (2 cpus in SMP with
|
||||
core id 0 and 1 @pxref{definecputargetsworkinginsmp,,Define CPU targets working in SMP}).
|
||||
|
||||
@example
|
||||
# toggle0 : force display of coreid 0
|
||||
define toggle0
|
||||
maint packet Jc0
|
||||
continue
|
||||
main packet Jc-1
|
||||
end
|
||||
# toggle1 : force display of coreid 1
|
||||
define toggle1
|
||||
maint packet Jc1
|
||||
continue
|
||||
main packet Jc-1
|
||||
end
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section RTOS Support
|
||||
@cindex RTOS Support
|
||||
@anchor{gdbrtossupport}
|
||||
@@ -10278,12 +10229,11 @@ Currently supported rtos's include:
|
||||
@item @option{mqx}
|
||||
@item @option{uCOS-III}
|
||||
@item @option{nuttx}
|
||||
@item @option{hwthread} (This is not an actual RTOS. @xref{usingopenocdsmpwithgdb,,Using OpenOCD SMP with GDB}.)
|
||||
@end itemize
|
||||
|
||||
@quotation Note
|
||||
Before an RTOS can be detected, it must export certain symbols; otherwise, it cannot
|
||||
be used by OpenOCD. Below is a list of the required symbols for each supported RTOS.
|
||||
@end quotation
|
||||
|
||||
@table @code
|
||||
@item eCos symbols
|
||||
@@ -10330,6 +10280,72 @@ contrib/rtos-helpers/FreeRTOS-openocd.c
|
||||
contrib/rtos-helpers/uCOS-III-openocd.c
|
||||
@end table
|
||||
|
||||
@anchor{usingopenocdsmpwithgdb}
|
||||
@section Using OpenOCD SMP with GDB
|
||||
@cindex SMP
|
||||
@cindex RTOS
|
||||
@cindex hwthread
|
||||
OpenOCD includes a pseudo RTOS called @emph{hwthread} that presents CPU cores
|
||||
("hardware threads") in an SMP system as threads to GDB. With this extension,
|
||||
GDB can be used to inspect the state of an SMP system in a natural way.
|
||||
After halting the system, using the GDB command @command{info threads} will
|
||||
list the context of each active CPU core in the system. GDB's @command{thread}
|
||||
command can be used to switch the view to a different CPU core.
|
||||
The @command{step} and @command{stepi} commands can be used to step a specific core
|
||||
while other cores are free-running or remain halted, depending on the
|
||||
scheduler-locking mode configured in GDB.
|
||||
|
||||
@section Legacy SMP core switching support
|
||||
@quotation Note
|
||||
This method is deprecated in favor of the @emph{hwthread} pseudo RTOS.
|
||||
@end quotation
|
||||
|
||||
For SMP support following GDB serial protocol packet have been defined :
|
||||
@itemize @bullet
|
||||
@item j - smp status request
|
||||
@item J - smp set request
|
||||
@end itemize
|
||||
|
||||
OpenOCD implements :
|
||||
@itemize @bullet
|
||||
@item @option{jc} packet for reading core id displayed by
|
||||
GDB connection. Reply is @option{XXXXXXXX} (8 hex digits giving core id) or
|
||||
@option{E01} for target not smp.
|
||||
@item @option{JcXXXXXXXX} (8 hex digits) packet for setting core id displayed at next GDB continue
|
||||
(core id -1 is reserved for returning to normal resume mode). Reply @option{E01}
|
||||
for target not smp or @option{OK} on success.
|
||||
@end itemize
|
||||
|
||||
Handling of this packet within GDB can be done :
|
||||
@itemize @bullet
|
||||
@item by the creation of an internal variable (i.e @option{_core}) by mean
|
||||
of function allocate_computed_value allowing following GDB command.
|
||||
@example
|
||||
set $_core 1
|
||||
#Jc01 packet is sent
|
||||
print $_core
|
||||
#jc packet is sent and result is affected in $
|
||||
@end example
|
||||
|
||||
@item by the usage of GDB maintenance command as described in following example (2 cpus in SMP with
|
||||
core id 0 and 1 @pxref{definecputargetsworkinginsmp,,Define CPU targets working in SMP}).
|
||||
|
||||
@example
|
||||
# toggle0 : force display of coreid 0
|
||||
define toggle0
|
||||
maint packet Jc0
|
||||
continue
|
||||
main packet Jc-1
|
||||
end
|
||||
# toggle1 : force display of coreid 1
|
||||
define toggle1
|
||||
maint packet Jc1
|
||||
continue
|
||||
main packet Jc-1
|
||||
end
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@node Tcl Scripting API
|
||||
@chapter Tcl Scripting API
|
||||
@cindex Tcl Scripting API
|
||||
|
||||
Reference in New Issue
Block a user