From: Clifford Wolf <clifford@clifford.at>
To: gdb@sourceware.org
Subject: Commands for a minimal GDB stub?
Date: Tue, 24 Nov 2015 13:38:00 -0000 [thread overview]
Message-ID: <20151124133817.GA10033@clifford.at> (raw)
Hi,
I'm trying to write a minimal GDB stub. The documentation states that it is
sufficient to implement the g, G, m, M, c, and s commands and that $#00
should be returned for any command not supported by the stub:
https://sourceware.org/gdb/onlinedocs/gdb/Overview.html
I've now started by implementing a minimal stub that just returns $#00 to
everything. This is the conversation my stub is having with gdb (not
showing the '+' acknowledgments, '->' for packets from gdb and '<-' for
packets from my stub):
-> $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5
<- $#00
-> $Hg0#df
<- $#00
-> $qTStatus#49
<- $#00
-> $?#3f
<- $#00
-> $Hc-1#09
<- $#00
-> $qC#b4
<- $#00
-> $qAttached#8f
<- $#00
On the GDB console I see the following (it just hangs after the "Invalid
remote reply:"):
(gdb) target remote :1234
Remote debugging using :1234
warning: Invalid remote reply:
Note that none of the commands gdb sent is g, G, m, M, c, or s. So sending
those empty replies should be fine, according to the documentation!
And here is the same conversation between gdb and my stub, as recorded by wireshark:
00000000 2b +
00000001 24 71 53 75 70 70 6f 72 74 65 64 3a 6d 75 6c 74 $qSupported:mult
00000011 69 70 72 6f 63 65 73 73 2b 3b 78 6d 6c 52 65 67 iprocess+;xmlReg
00000021 69 73 74 65 72 73 3d 69 33 38 36 3b 71 52 65 6c isters=i386;qRel
00000031 6f 63 49 6e 73 6e 2b 23 62 35 ocInsn+#b5
00000000 2b +
00000001 24 $
00000002 23 #
00000003 30 0
00000004 30 0
0000003B 2b +
0000003C 24 48 67 30 23 64 66 $Hg0#df
00000005 2b +
00000006 24 23 30 30 $#00
00000043 2b +
00000044 24 71 54 53 74 61 74 75 73 23 34 39 $qTStatus#49
0000000A 2b +
0000000B 24 23 30 30 $#00
00000050 2b +
00000051 24 3f 23 33 66 $?#3f
0000000F 2b +
00000010 24 23 30 30 $#00
00000056 2b +
00000057 24 48 63 2d 31 23 30 39 $Hc-1#09
00000014 2b +
00000015 24 23 30 30 $#00
0000005F 2b +
00000060 24 71 43 23 62 34 $qC#b4
00000019 2b +
0000001A 24 23 30 30 $#00
00000066 2b +
00000067 24 71 41 74 74 61 63 68 65 64 23 38 66 $qAttached#8f
0000001E 2b +
0000001F 24 23 30 30 $#00
00000074 2b +
I did compare that to what I record when gdb is talking to gdbserver, and
the general syntax seems to be the same, meaning I don't think I have
screwed up implementing the low-level protocol..
Is the documentation correct and I only need to implement g, G, m, M, c,
and s? If so: What did I do wrong?
Your help is very appreciated!
thanks,
- clifford
next reply other threads:[~2015-11-24 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 13:38 Clifford Wolf [this message]
2015-11-24 13:51 ` Tristan Gingold
2015-11-24 14:38 ` Clifford Wolf
2015-11-24 16:41 ` Tristan Gingold
2015-11-30 20:58 ` Juha Aaltonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151124133817.GA10033@clifford.at \
--to=clifford@clifford.at \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).