[Pdbg] [PATCH v2 10/38] gdbserver: reduce PR_INFO noise

Nicholas Piggin npiggin at gmail.com
Wed Mar 30 02:49:03 AEDT 2022


Printing the first byte of the received packet in hex on its own line is
not very useful and clutters debug output. We print the full received
packet anyway which is generally quite readable.

Remove the first byte info line, and replace it with a debug line that
contains the entire hex string as hex bytes.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 src/pdbgproxy.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 4c6327f..9e5e7d8 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -396,9 +396,15 @@ static int read_from_client(int fd)
 		PR_INFO("0 bytes\n");
 		return -1;
 	} else {
+		int i;
+
 		buffer[nbytes] = '\0';
-		PR_INFO("%x\n", buffer[0]);
 		PR_INFO("Recv: %s\n", buffer);
+		pdbg_log(PDBG_DEBUG, " hex: ");
+		for (i = 0; i < nbytes; i++)
+			pdbg_log(PDBG_DEBUG, "%02x ", buffer[i]);
+		pdbg_log(PDBG_DEBUG, "\n");
+
 		parse_buffer(buffer, nbytes, &fd);
 	}
 
-- 
2.23.0



More information about the Pdbg mailing list