27aeecf5d1
This patch adds a 'gdb' command to 'cli_monitor', which makes it possible to debug an application with GDB. The command works similarly to the 'start' command, but instead of starting the subsystem binary directly, an 'init' subsystem gets started, which then starts 'terminal_crosslink', 'noux', GDB and 'gdb_monitor' (which starts the application binary as its target). So, for the 'gdb' command to work, these additional components need to be available, too. 'terminal_crosslink', 'noux', 'gdb_monitor' and the file 'gdb_command_config' are expected to be ROM modules. The Noux GDB client needs to get mounted at '/bin' in Noux and the target binaries need to be available as ROM modules (loaded by 'gdb_monitor') and also mounted at '/gdb' in Noux (loaded by the GDB client). Additionally, the source code of the target application can be provided at '/gdb/src/ in Noux. How the Noux mountings get established can be configured in the 'gdb_command_config' file. The default configuration in 'os/src/server/cli_monitor/gdb_command_config' mounts GDB from a tar archive named 'gdb.tar', the GDB target binaries from a tar archive named 'gdb_target.tar' and the target source code from a tar archive named 'gdb_target-src.tar'. The patch includes an 'expect' include file (ports/run/noux_gdb.inc) which provides functions that help to create those tar files: - 'create_gdb_tar' creates a tar archive for the 'gdb' client - 'create_binary_tar' creates a tar archive for the target application - 'create_source_tar' creates a tar archive for the source code of the target application - 'create_binary_and_source_tars' is a convenience wrapper for the previous two functions The patch also includes an example run script (ports/run/noux_gdb_dynamic.run). The 'gdb' command supports the following command line options: - --ram: the initial RAM quota provided to the whole subsystem (including the GDB-related components) - --ram-limit: limit for expanding RAM quota - --gdb-ram-preserve: the RAM quota that 'gdb_monitor' ahould preserve for itself Fixes #928.
71 lines
1.7 KiB
Plaintext
71 lines
1.7 KiB
Plaintext
<!-- configuration template for the 'gdb' command -->
|
|
|
|
<config>
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="RAM"/>
|
|
<service name="CAP"/>
|
|
<service name="PD"/>
|
|
<service name="RM"/>
|
|
<service name="CPU"/>
|
|
<service name="LOG"/>
|
|
<service name="SIGNAL"/>
|
|
<service name="Timer"/>
|
|
<service name="Terminal"/>
|
|
</parent-provides>
|
|
|
|
<!-- additional start nodes can be inserted here -->
|
|
|
|
<start name="terminal_gdb">
|
|
<binary name="terminal_crosslink"/>
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides> <service name="Terminal"/> </provides>
|
|
<route>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</route>
|
|
</start>
|
|
<start name="noux">
|
|
<resource name="RAM" quantum="24M"/>
|
|
<route>
|
|
<service name="Terminal">
|
|
<if-arg key="label" value=""/><parent/>
|
|
</service>
|
|
<service name="Terminal">
|
|
<if-arg key="label" value="noux(terminal_fs)"/><child name="terminal_gdb"/>
|
|
</service>
|
|
<any-service> <any-child/> <parent/> </any-service>
|
|
</route>
|
|
<config>
|
|
|
|
<!-- the GDB <start> node gets generated above this comment -->
|
|
|
|
<fstab>
|
|
<dir name="dev"><terminal name="gdb"/></dir>
|
|
|
|
<!-- the GDB binary is expected in /bin -->
|
|
<tar name="gdb.tar" at="/"/>
|
|
|
|
<!-- the GDB target binaries are expected in /gdb -->
|
|
<!-- the GDB target source is expected in /gdb/src -->
|
|
<dir name="gdb">
|
|
<tar name="gdb_target.tar"/>
|
|
<dir name="src"><tar name="gdb_target-src.tar"/></dir>
|
|
</dir>
|
|
|
|
</fstab>
|
|
</config>
|
|
</start>
|
|
<start name="gdb_monitor">
|
|
|
|
<!-- the <config> node gets generated above this comment -->
|
|
|
|
<resource name="RAM" quantum="1G"/>
|
|
<route>
|
|
<service name="Terminal"><child name="terminal_gdb"/></service>
|
|
<any-service> <any-child/> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
</config>
|
|
|
|
|