Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to determine the order of the registers got, their width and count?

4 views
Skip to first unread message

Vardhana, Ananda

unread,
Jun 6, 2014, 8:12:10 PM6/6/14
to Sergio Durigan Junior, bug...@gnu.org
I am newbie in GDB. I had couple of questions
 
1.      When I send out ‘g’ I get a full dump of the registers. Is there ‘q’ query packet I can send and ask the GDB server in what order(eax, ebx, ecx ...) will it dump the registers?
 
2.      Before we do a ‘g’ can we tell the server that we are interested in 32 bit (EAX, ECX etc …) only?
 
3.      Can I send out a ‘q’ packet and ask the server whether it will give me back 32 or 64 bit registers?
 
4.      Nowadays it is mostly 64 bit systems and they support both 32 and 64 bit. So my idea was to ask whatever I want.
 
Please check out these transactions:
 
Sending packet: $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5...Ack
Packet received: ReverseStep+;ReverseContinue+;qXfer:features:read+
Packet qSupported (supported-packets) is supported
Sending packet: $Hg0#df...Ack
Packet received: OK
Sending packet: $qXfer:features:read:target.xml:0,283#e8...Ack
Packet received: m<target version="1.0">\n  <architecture>i386:x86-64</architecture>\n</target>\n
Sending packet: $qXfer:features:read:target.xml:4c,283#4f...Ack
Packet received: l
 
1. Question is how did it come up with the number 0,283
2. What range does 0,283 imply? Is it the number of lines in the target.xml file?
3. How can I get the total count?
4. Please see that the next time it does it from 4c,283. Where did it get these numbers?
>> Packet received: m<target version="1.0">\n  <architecture>i386:x86-64</architecture>\n</target>\n
5.  I guess <architecture>i386:x86-64</architecture> means the system is an Intel system(i386), it supports both 32 bit(x86) and 64 bit (64). Is that right?
 
 
Sorry for the long list of questions, just wanted to spill out … . Many thanks in advance
 
Cheers
Ananda
 
 

Sergio Durigan Junior

unread,
Jun 9, 2014, 12:55:09 AM6/9/14
to Vardhana, Ananda, bug...@gnu.org
On Friday, June 06 2014, Ananda Vardhana wrote:

> I am newbie in GDB. I had couple of questions

Hello Ananda,

I don't really have time to answer all of your questions now; I'd
strongly recommend that you send them to <g...@sourceware.org>, which is
the official mailing list for GDB (this one is just a placeholder).

> 1. When I send out 'g' I get a full dump of the registers. Is there 'q' query packet I can send and ask the GDB server in what order(eax, ebx, ecx ...) will it dump the registers?

AFAIK, no, there isn't. From the GDB manual:

Each byte of register data is described by two hex digits. The bytes
with the register are transmitted in target byte order. The size of
each register and their position within the ‘g’ packet are determined
by the GDB internal gdbarch functions DEPRECATED_REGISTER_RAW_SIZE and
gdbarch_register_name.

So you'd have to check gdbarch_register_name in order to obtain this
information.

> 2. Before we do a 'g' can we tell the server that we are interested in 32 bit (EAX, ECX etc ...) only?

I don't think you can. You can read the registers separately, though.

> 3. Can I send out a 'q' packet and ask the server whether it will give me back 32 or 64 bit registers?

I don't understand this question. If you're interested in reading some
specific register, you can do that. Otherwise, using the 'g' packet,
you will obtain all of them.

I'll see if I can answer your other questions when I have more time.

--
Sergio
GPG key ID: 65FC5E36
Please send encrypted e-mail if possible
http://blog.sergiodj.net/

0 new messages