public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Mahesh Bodapati <maheshbodapati212@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: GDB - hardware server
Date: Mon, 3 May 2021 10:35:52 -0400	[thread overview]
Message-ID: <872a3a10-1cf3-4ec8-560a-e5a20f6addc4@polymtl.ca> (raw)
In-Reply-To: <CACSfpVaj=zkvjE-WORfDLtrd0vqVZ=mQZKufep9G9vy5TL=48A@mail.gmail.com>

On 2021-05-03 2:19 a.m., Mahesh Bodapati wrote:
> Thank You.
> It looks like I didn't frame my problem correctly.
> server is sending the target descriptions but I have the problem when there is a mismatch between the "expected number of bytes" and "got number of bytes"
> for instance,
> gdb has been built for 32 bit abi by default then 
> case 1:
> if server send 32 bit target description then we didn't see any error
> 
> case 2 :
> if server send 64 bit target descriptions then it results an error saying mismatch between  "expected number of bytes" and "got number of bytes"

Does this "wrong number of bytes" happens when parsing a g packet (read
registers packet)?  This is typically what I've seen.

When you return a target description, that describes all the registers
that are going to be included in the g packets.  So if GDB is saying
this, I would first verify that the registers you return in the g packet
really match what you are describing in the target description.

After connecting to your target, you could use some GDB commands to
determine what GDB expects the expected layout of the g register to be.
From memory, I think this is "maintenance print registers".  You can
also use "maintenance print xml-tdesc" to make GDB print in XML what it
thinks the target description for the current inferior is.

> and my question is "how can we support 2nd case ? "
> can we switch the ABI when we receive 64 bit target description from server ? if yes, how can we do that?
> or do we need to build a different gdb for 64 bit ABI?

No, in theory it's all supposed to work, as long as you've included the
support for all the architectures you're going to use in the GDB builds.
I didn't work a lot on target descriptions, so there may be some other
important details I'm not aware of.

Simon


      reply	other threads:[~2021-05-03 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  5:59 Mahesh Bodapati
2021-04-30 18:06 ` Simon Marchi
2021-05-03  6:19   ` Mahesh Bodapati
2021-05-03 14:35     ` Simon Marchi [this message]

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=872a3a10-1cf3-4ec8-560a-e5a20f6addc4@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb@sourceware.org \
    --cc=maheshbodapati212@gmail.com \
    /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).