[Pdbg] [PATCH v2 03/39] gdbserver: rename detach command handler

Nicholas Piggin npiggin at gmail.com
Wed Apr 20 16:49:37 AEST 2022


The detach 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 at 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 --git a/src/gdb_parser.rl b/src/gdb_parser.rl
index 6259b965..93213e4f 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 6012a271..e0df0051 100644
--- a/src/gdb_parser_precompile.c
+++ b/src/gdb_parser_precompile.c
@@ -351,7 +351,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 bb7c7b35..3e27ba02 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 1fe67f2c..1910fdba 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);
-- 
2.35.1



More information about the Pdbg mailing list