diff mbox series

[v2,03/38] gdbserver: update gdb_parser_precompile.c, rename detach command

Message ID 20220329154931.493851-4-npiggin@gmail.com
State New
Headers show
Series gdbserver multi-threaded debugging and POWER9/10 support | expand

Commit Message

Nicholas Piggin March 29, 2022, 3:48 p.m. UTC
gdb_parser_precompile.c had not been updated since adding support for
the detach command, resulting in client error messages like this:

  Detaching from program: /home/npiggin/images/vmlinux, process 42000
  Remote doesn't know how to detach

The command handler should not be named disconnect, because that is a
different concept in gdb (disconnect leaves the target in the same
state, detach ends the debugging session).

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 src/gdb_parser.rl           | 4 ++--
 src/gdb_parser_precompile.c | 2 +-
 src/pdbgproxy.c             | 6 +++---
 src/pdbgproxy.h             | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/gdb_parser.rl b/src/gdb_parser.rl
index 868e31c..629a091 100644
--- a/src/gdb_parser.rl
+++ b/src/gdb_parser.rl
@@ -76,7 +76,7 @@ 
 
 	set_thread = ('H' any* @{cmd = SET_THREAD;});
 
-	disconnect = ('D' @{cmd = DISCONNECT;}
+	detach = ('D' @{cmd = DETACH;}
 		     xdigit+ $hex_digit %push);
 
 	# TODO: We don't actually listen to what's supported
@@ -94,7 +94,7 @@ 
 
 	commands = (get_mem | get_gprs | get_spr | stop_reason | set_thread |
 		    q_attached | q_C | q_supported | qf_threadinfo | q_C |
-		    v_contq | v_contc | v_conts | put_mem | disconnect );
+		    v_contq | v_contc | v_conts | put_mem | detach );
 
 	cmd = ((commands & ^'#'*) | ^'#'*) $crc
 	      ('#' xdigit{2} $hex_digit @end);
diff --git a/src/gdb_parser_precompile.c b/src/gdb_parser_precompile.c
index 505e102..f787a29 100644
--- a/src/gdb_parser_precompile.c
+++ b/src/gdb_parser_precompile.c
@@ -346,7 +346,7 @@  _match:
 	break;
 	case 11:
 #line 79 "src/gdb_parser.rl"
-	{cmd = DISCONNECT;}
+	{cmd = DETACH;}
 	break;
 	case 12:
 #line 83 "src/gdb_parser.rl"
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index bb7c7b3..3e27ba0 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -95,9 +95,9 @@  static void stop_reason(uint64_t *stack, void *priv)
 	send_response(fd, TRAP);
 }
 
-static void disconnect(uint64_t *stack, void *priv)
+static void detach(uint64_t *stack, void *priv)
 {
-	PR_INFO("Terminating connection with client. pid %16" PRIi64 "\n", stack[0]);
+	PR_INFO("Detach debug session with client. pid %16" PRIi64 "\n", stack[0]);
 	send_response(fd, OK);
 }
 
@@ -416,7 +416,7 @@  command_cb callbacks[LAST_CMD + 1] = {
 	v_conts,
 	put_mem,
 	interrupt,
-	disconnect,
+	detach,
 	NULL};
 
 int gdbserver_start(struct pdbg_target *thread, struct pdbg_target *adu, uint16_t port)
diff --git a/src/pdbgproxy.h b/src/pdbgproxy.h
index 1fe67f2..1910fdb 100644
--- a/src/pdbgproxy.h
+++ b/src/pdbgproxy.h
@@ -3,7 +3,7 @@ 
 
 enum gdb_command {NONE, GET_GPRS, GET_SPR, GET_MEM,
                  STOP_REASON, SET_THREAD, V_CONTC, V_CONTS,
-                 PUT_MEM, INTERRUPT, DISCONNECT, LAST_CMD};
+                 PUT_MEM, INTERRUPT, DETACH, LAST_CMD};
 typedef void (*command_cb)(uint64_t *stack, void *priv);
 
 void parser_init(command_cb *callbacks);