* [Qemu-devel] [PATCH] Parsing problem of gdb 'M' packet
@ 2005-01-15 16:12 Thomas Petazzoni
2005-01-16 22:29 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Petazzoni @ 2005-01-15 16:12 UTC (permalink / raw)
To: qemu-devel; +Cc: David Decotigny
[-- Attachment #1.1: Type: text/plain, Size: 1241 bytes --]
Hello,
I've found a problem in the code parsing the gdb 'M' packet. During gdb
remote sessions, I saw strange things when writing to memory :
============================================================
(gdb) print addr
$1 = 0
(gdb) set addr=12
(gdb) print addr
$2 = 49152
============================================================
So, I went into Qemu code, and found a problem in gdbstub.c. The format
of a 'M' packet is Maddr,length:XX... as stated on [1]. So the addr is
separated from the length using a comma, and the length from the data
using a colon.
However, the Qemu code assumed that all fields were seperated with a
comma, leading to wrong analysis of the data field.
The included one-line patch fixes the problem :
=============================================================
(gdb) print addr
$1 = 0
(gdb) set addr=12
(gdb) print addr
$2 = 12
=============================================================
Thomas
[1] http://sources.redhat.com/gdb/current/onlinedocs/gdb_33.html#SEC664
--
PETAZZONI Thomas - thomas.petazzoni@enix.org
http://thomas.enix.org - Jabber: thomas.petazzoni@jabber.dk
KOS: http://kos.enix.org/ - SOS: http://sos.enix.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7
[-- Attachment #1.2: gdb-M-packet-parsing-problem.patch --]
[-- Type: text/plain, Size: 540 bytes --]
Index: gdbstub.c
===================================================================
RCS file: /cvsroot/qemu/qemu/gdbstub.c,v
retrieving revision 1.22
diff -u -u -r1.22 gdbstub.c
--- gdbstub.c 3 Jan 2005 23:34:06 -0000 1.22
+++ gdbstub.c 15 Jan 2005 16:06:09 -0000
@@ -420,7 +420,7 @@
if (*p == ',')
p++;
len = strtoul(p, (char **)&p, 16);
- if (*p == ',')
+ if (*p == ':')
p++;
hextomem(mem_buf, p, len);
if (cpu_memory_rw_debug(env, addr, mem_buf, len, 1) != 0)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Parsing problem of gdb 'M' packet
2005-01-15 16:12 [Qemu-devel] [PATCH] Parsing problem of gdb 'M' packet Thomas Petazzoni
@ 2005-01-16 22:29 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2005-01-16 22:29 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 384 bytes --]
Hello,
Thomas Petazzoni wrote:
> The included one-line patch fixes the problem :
Don't hesitate to tell me if something is wrong with this patch.
Thomas
--
PETAZZONI Thomas - thomas.petazzoni@enix.org
http://thomas.enix.org - Jabber: thomas.petazzoni@jabber.dk
KOS: http://kos.enix.org/ - SOS: http://sos.enix.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-16 23:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15 16:12 [Qemu-devel] [PATCH] Parsing problem of gdb 'M' packet Thomas Petazzoni
2005-01-16 22:29 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).