* Question regarding i386v4-nat.c:supply_gregset and fill_gregset
@ 2002-08-06 18:04 Joel Brobecker
2002-08-07 6:16 ` Daniel Jacobowitz
2002-08-13 15:06 ` Mark Kettenis
0 siblings, 2 replies; 4+ messages in thread
From: Joel Brobecker @ 2002-08-06 18:04 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
Hello Mark,
Following your suggestion to use i386v4-nat.c for the interix port,
I was indeed impressed to see that, after simplifying supply_gregset()
and fill_gregset() as you indicated, they become (almost identical) to
their counterpart in i386v4-nat.
But there is one difference that causes some grief on interix, and I
had to modify these 2 functions like this to make them to work for
interix:
- greg_t *regp = (greg_t *) gregsetp;
+ greg_t *regp = (greg_t *) & gregsetp->gregs;
Indeed, on Interix, the gregs buffer is not located at the begining
of the gregset_t structure. So the function were reading/writting at
the wrong location.
The trouble is I don't have any machine handy to verify this change
on the other platforms. I have the feeling, though, that type gregset_t
is not always a structure, and hence makes my change only valid for
interix. If this is the case, then I am afraid we won't be able to reuse
i386v4-nat.c that easily. Maybe we should implement 2 new functions
similar to i387_supply_fsave and i387_fill_fsave (in i386-nat.[hc]?):
i386_supply_gregset (greg_t *gregp);
i386_fill_gregset (greg_t *gregp, int regno);
both i386v4-nat.c and i386-interix-nat.c would use them to implement
supply/fill_gregset.
What do you think?
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Question regarding i386v4-nat.c:supply_gregset and fill_gregset
2002-08-06 18:04 Question regarding i386v4-nat.c:supply_gregset and fill_gregset Joel Brobecker
@ 2002-08-07 6:16 ` Daniel Jacobowitz
2002-08-13 15:06 ` Mark Kettenis
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-08-07 6:16 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Mark Kettenis, gdb-patches
On Tue, Aug 06, 2002 at 06:04:26PM -0700, Joel Brobecker wrote:
> Hello Mark,
>
> Following your suggestion to use i386v4-nat.c for the interix port,
> I was indeed impressed to see that, after simplifying supply_gregset()
> and fill_gregset() as you indicated, they become (almost identical) to
> their counterpart in i386v4-nat.
>
> But there is one difference that causes some grief on interix, and I
> had to modify these 2 functions like this to make them to work for
> interix:
>
> - greg_t *regp = (greg_t *) gregsetp;
> + greg_t *regp = (greg_t *) & gregsetp->gregs;
>
> Indeed, on Interix, the gregs buffer is not located at the begining
> of the gregset_t structure. So the function were reading/writting at
> the wrong location.
>
> The trouble is I don't have any machine handy to verify this change
> on the other platforms. I have the feeling, though, that type gregset_t
> is not always a structure, and hence makes my change only valid for
> interix. If this is the case, then I am afraid we won't be able to reuse
> i386v4-nat.c that easily. Maybe we should implement 2 new functions
> similar to i387_supply_fsave and i387_fill_fsave (in i386-nat.[hc]?):
>
> i386_supply_gregset (greg_t *gregp);
> i386_fill_gregset (greg_t *gregp, int regno);
>
> both i386v4-nat.c and i386-interix-nat.c would use them to implement
> supply/fill_gregset.
>
> What do you think?
I'm inclined to agree with you. gregset_t is supposed to be an array;
it traditionally has been, in various Unices, and there's some comments
in the Linux headers to the affect that we needed to leave it that way
to prevent confusing certain software (GDB not least among it). If
Interix does it differently you will need to have some separate code
path.
Of course, if someone were to multi-arch supply_gregset, we could use
this convenient OSABI mechanism...
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question regarding i386v4-nat.c:supply_gregset and fill_gregset
2002-08-06 18:04 Question regarding i386v4-nat.c:supply_gregset and fill_gregset Joel Brobecker
2002-08-07 6:16 ` Daniel Jacobowitz
@ 2002-08-13 15:06 ` Mark Kettenis
2002-08-13 15:53 ` Joel Brobecker
1 sibling, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2002-08-13 15:06 UTC (permalink / raw)
To: brobecker; +Cc: gdb-patches
Date: Tue, 6 Aug 2002 18:04:26 -0700
From: Joel Brobecker <brobecker@gnat.com>
Hello Mark,
Sorry for the slow response. I was having a vacation :-).
But there is one difference that causes some grief on interix, and I
had to modify these 2 functions like this to make them to work for
interix:
- greg_t *regp = (greg_t *) gregsetp;
+ greg_t *regp = (greg_t *) & gregsetp->gregs;
Indeed, on Interix, the gregs buffer is not located at the begining
of the gregset_t structure. So the function were reading/writting at
the wrong location.
Hmm...
The trouble is I don't have any machine handy to verify this change
on the other platforms. I have the feeling, though, that type gregset_t
is not always a structure, and hence makes my change only valid for
interix.
Yup, it is as Daniel already explained.
If this is the case, then I am afraid we won't be able to reuse
i386v4-nat.c that easily. Maybe we should implement 2 new functions
similar to i387_supply_fsave and i387_fill_fsave (in i386-nat.[hc]?):
i386_supply_gregset (greg_t *gregp);
i386_fill_gregset (greg_t *gregp, int regno);
both i386v4-nat.c and i386-interix-nat.c would use them to implement
supply/fill_gregset.
What do you think?
That would be a valid approach (although I would name the functions
i386_supply_gregs and i386_fill_gregs). On the other hand, I wouldn't
object to duplicating the small bits of code for Interix and deal with
it later. I'll have to rethink these functions sooner or later if I
want to support cross-debugging of core files.
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Question regarding i386v4-nat.c:supply_gregset and fill_gregset
2002-08-13 15:06 ` Mark Kettenis
@ 2002-08-13 15:53 ` Joel Brobecker
0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2002-08-13 15:53 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Sorry for the slow response. I was having a vacation :-).
Actually, me too :-).
> That would be a valid approach (although I would name the functions
> i386_supply_gregs and i386_fill_gregs). On the other hand, I wouldn't
> object to duplicating the small bits of code for Interix and deal with
> it later. I'll have to rethink these functions sooner or later if I
> want to support cross-debugging of core files.
This is the route I took: duplicating this small bit of code, leaving
the cleanup for later.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-13 22:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-06 18:04 Question regarding i386v4-nat.c:supply_gregset and fill_gregset Joel Brobecker
2002-08-07 6:16 ` Daniel Jacobowitz
2002-08-13 15:06 ` Mark Kettenis
2002-08-13 15:53 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox