diff mbox series

gdbserver: Implement basic target description

Message ID 20220517075731.318420-1-joel@jms.id.au
State New
Headers show
Series gdbserver: Implement basic target description | expand

Commit Message

Joel Stanley May 17, 2022, 7:57 a.m. UTC
Implement the target description packet so the user doesn't need to
specify it.

This allows a multiarch gdb to connect without specifying the target
architecture:

 $ gdb-multiarch  -ex "target remote rain101bmc.aus.stglabs.ibm.com:1234" -q
 Remote debugging using rain101bmc.aus.stglabs.ibm.com:1234
 warning: No executable has been specified and target does not support
 determining executable automatically.  Try using the "file" command.
 0xc000000000040f18 in ?? ()
 (gdb)

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 README.md         | 1 -
 src/gdb_parser.rl | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/README.md b/README.md
index 778269a63533..f97b6824cc2b 100644
--- a/README.md
+++ b/README.md
@@ -555,7 +555,6 @@  of threads, especially over slow remote links.
 
 On your local machine:
 $ gdb
-(gdb) set architecture powerpc:common64
 (gdb) target remote palm5-bmc:44
 
 Debugging info:
diff --git a/src/gdb_parser.rl b/src/gdb_parser.rl
index 44048332ccec..13d9d9791177 100644
--- a/src/gdb_parser.rl
+++ b/src/gdb_parser.rl
@@ -111,8 +111,9 @@ 
 
 	# TODO: We don't actually listen to what's supported
 	q_attached = ('qAttached:' xdigit* @{rsp = "1";});
-	q_supported = ('qSupported:' any* >{rsp = "multiprocess+;swbreak+;hwbreak-;qRelocInsn-;vContSupported+;QThreadEvents-;no-resumed-;QStartNoAckMode+"; ack_mode = true;});
+	q_supported = ('qSupported:' any* >{rsp = "multiprocess+;swbreak+;hwbreak-;qRelocInsn-;vContSupported+;QThreadEvents-;no-resumed-;QStartNoAckMode+;qXfer:features:read+"; ack_mode = true;});
 	q_start_noack = ('QStartNoAckMode' @{rsp = "OK"; send_ack(priv); ack_mode = false;});
+	q_target  = ('qXfer:features:read:target.xml' any* >{rsp = "l<target><architecture>powerpc:common64</architecture></target>";});
 
 	# thread info
 	is_alive = ('T' ('p' xdigit+ '.')+ xdigit+ @{rsp = "OK";});
@@ -134,7 +135,7 @@ 
 	interrupt = (3 @{ if (command_callbacks) command_callbacks[INTERRUPT](stack, priv); PR_INFO("RAGEL:interrupt\n");});
 
 	commands = (get_gprs | get_spr |
-		    q_attached | q_supported | q_start_noack |
+		    q_attached | q_supported | q_start_noack | q_target |
 		    stop_reason | is_alive | get_thread | set_thread |
 		    v_contq | v_contc | v_conts |
 		    qf_threadinfo | qs_threadinfo |