* Specifying target endianness via Remote Serial Protocol
@ 2020-04-12 12:02 Omer
2020-04-13 13:04 ` Luis Machado
0 siblings, 1 reply; 4+ messages in thread
From: Omer @ 2020-04-12 12:02 UTC (permalink / raw)
To: gdb
Hi,
While writing my own gdb stub, I noticed that there is no way to specify
what endianness the target is using (I guess the logical place for that
would be in the target.xml file).
One can use "set endian" manually to fix that, but when debugging an ARM
BE8 target, there is no way to specify that the code is little endian
(currently byte_order_for_code is initialized to little only when loading a
BE8 elf).
Shouldn't there be an additional field for target XML tag to specify that?
Omer.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Specifying target endianness via Remote Serial Protocol
2020-04-12 12:02 Specifying target endianness via Remote Serial Protocol Omer
@ 2020-04-13 13:04 ` Luis Machado
2020-04-14 10:45 ` Omer
0 siblings, 1 reply; 4+ messages in thread
From: Luis Machado @ 2020-04-13 13:04 UTC (permalink / raw)
To: Omer, gdb
Hi,
On 4/12/20 9:02 AM, Omer via Gdb wrote:
> Hi,
>
> While writing my own gdb stub, I noticed that there is no way to specify
> what endianness the target is using (I guess the logical place for that
> would be in the target.xml file).
> One can use "set endian" manually to fix that, but when debugging an ARM
> BE8 target, there is no way to specify that the code is little endian
> (currently byte_order_for_code is initialized to little only when loading a
> BE8 elf).
> Shouldn't there be an additional field for target XML tag to specify that?
We could probably extend the XML descriptions to incorporate this, but
we may also have backwards compatibility issues with older GDB's by
returning new fields the target doesn't know how to parse properly.
The way to fix this, right now, would be to teach GDB about other arch
variations using little endian, so GDB initializes the proper set of
architecture hooks and types.
What arch variation are you working with? Doesn't the tools generate a
EF_ARM_BE8 flag to let GDB know it needs to assume little endian?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Specifying target endianness via Remote Serial Protocol
2020-04-13 13:04 ` Luis Machado
@ 2020-04-14 10:45 ` Omer
2020-04-14 12:36 ` Luis Machado
0 siblings, 1 reply; 4+ messages in thread
From: Omer @ 2020-04-14 10:45 UTC (permalink / raw)
To: Luis Machado; +Cc: gdb
Will older gdb's really break if we send them fields they don't know? The
logical thing to do seems to me to just to discard them.
I want to use remote gdb without giving it an elf to work with locally (for
example if I want to debug some weird embedded system).
I can somewhat circumvent the problem by giving gdb an empty elf with my
wanted endianness, but I don't think it's the optimal solution.
On Mon, 13 Apr 2020 at 16:04, Luis Machado <luis.machado@linaro.org> wrote:
> Hi,
>
> On 4/12/20 9:02 AM, Omer via Gdb wrote:
> > Hi,
> >
> > While writing my own gdb stub, I noticed that there is no way to specify
> > what endianness the target is using (I guess the logical place for that
> > would be in the target.xml file).
> > One can use "set endian" manually to fix that, but when debugging an ARM
> > BE8 target, there is no way to specify that the code is little endian
> > (currently byte_order_for_code is initialized to little only when
> loading a
> > BE8 elf).
> > Shouldn't there be an additional field for target XML tag to specify
> that?
>
> We could probably extend the XML descriptions to incorporate this, but
> we may also have backwards compatibility issues with older GDB's by
> returning new fields the target doesn't know how to parse properly.
>
> The way to fix this, right now, would be to teach GDB about other arch
> variations using little endian, so GDB initializes the proper set of
> architecture hooks and types.
>
> What arch variation are you working with? Doesn't the tools generate a
> EF_ARM_BE8 flag to let GDB know it needs to assume little endian?
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Specifying target endianness via Remote Serial Protocol
2020-04-14 10:45 ` Omer
@ 2020-04-14 12:36 ` Luis Machado
0 siblings, 0 replies; 4+ messages in thread
From: Luis Machado @ 2020-04-14 12:36 UTC (permalink / raw)
To: Omer; +Cc: gdb
Hi,
On 4/14/20 7:45 AM, Omer wrote:
> Will older gdb's really break if we send them fields they don't know?
> The logical thing to do seems to me to just to discard them.
> I want to use remote gdb without giving it an elf to work with locally
> (for example if I want to debug some weird embedded system).
> I can somewhat circumvent the problem by giving gdb an empty elf with my
> wanted endianness, but I don't think it's the optimal solution.
Indeed it seems we properly discard unknown fields. I may have
misremembered some buggy behavior at some point.
There is some indication in the dtd in gdb/features:
<!-- The osabi and compatible elements were added post GDB 6.8. The
version wasn't bumped, since older GDBs silently ignore unknown
elements. -->
I also gave it a try by forcing an endian entry in the XML description.
So it seems we only need to tweak the XML machinery to accept such a
field and pass it on to the architecture initialization code.
>
> On Mon, 13 Apr 2020 at 16:04, Luis Machado <luis.machado@linaro.org
> <mailto:luis.machado@linaro.org>> wrote:
>
> Hi,
>
> On 4/12/20 9:02 AM, Omer via Gdb wrote:
> > Hi,
> >
> > While writing my own gdb stub, I noticed that there is no way to
> specify
> > what endianness the target is using (I guess the logical place
> for that
> > would be in the target.xml file).
> > One can use "set endian" manually to fix that, but when debugging
> an ARM
> > BE8 target, there is no way to specify that the code is little endian
> > (currently byte_order_for_code is initialized to little only when
> loading a
> > BE8 elf).
> > Shouldn't there be an additional field for target XML tag to
> specify that?
>
> We could probably extend the XML descriptions to incorporate this, but
> we may also have backwards compatibility issues with older GDB's by
> returning new fields the target doesn't know how to parse properly.
>
> The way to fix this, right now, would be to teach GDB about other arch
> variations using little endian, so GDB initializes the proper set of
> architecture hooks and types.
>
> What arch variation are you working with? Doesn't the tools generate a
> EF_ARM_BE8 flag to let GDB know it needs to assume little endian?
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-14 12:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 12:02 Specifying target endianness via Remote Serial Protocol Omer
2020-04-13 13:04 ` Luis Machado
2020-04-14 10:45 ` Omer
2020-04-14 12:36 ` Luis Machado
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).