* Question regarding storing/restoring data during inferior function call
@ 2005-10-18 18:46 Joel Brobecker
2005-10-18 19:12 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2005-10-18 18:46 UTC (permalink / raw)
To: gdb-patches
Hello,
I'm working on inferior function calls on ia64-hpux (which I'd like to
eventually contribute), and I've hit a glitch: HPUX does not allow us
to modify the BSP register. So this prevents us from creating a new
RSE frame for the function being called.
One way around this problem that I thought about was to keep the BSP
as is. This meant adjusting a bit the addresses where the arguments
were saved. But more importantly, this meant that we overwrote the
output section of the register frame.
It's pretty easy to add some code in GDB to save this data, either
on the inferior stack frame or perhaps directly in debugger memory.
However, I don't see a clear way for us to do the restoration. Is
there any?
Right now, the inferior function call is made AT_ENTRY_POINT. One
way to solve my problem that might work is to make the call ON_STACK.
Not sure if that's allowed on this chip. But this way, I can
dynamically create a small piece of code that does the branch to the
target function, which would implicitly cause the BSP update that
we're currently doing ourselves. This does open a whole can of worms,
though, as I think I'll need to revisit the entire dummy frame unwinder,
won't I?
Any suggestion? The simplest for me would probably to add an extra
mechanism to do associate a restore procedure to the popping of the
dummy frame (or something like that), where I believe the registers
are restored.
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regarding storing/restoring data during inferior function call
2005-10-18 18:46 Question regarding storing/restoring data during inferior function call Joel Brobecker
@ 2005-10-18 19:12 ` Daniel Jacobowitz
2005-10-18 20:00 ` Mark Kettenis
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-10-18 19:12 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Tue, Oct 18, 2005 at 11:46:07AM -0700, Joel Brobecker wrote:
> Hello,
>
> I'm working on inferior function calls on ia64-hpux (which I'd like to
> eventually contribute), and I've hit a glitch: HPUX does not allow us
> to modify the BSP register. So this prevents us from creating a new
> RSE frame for the function being called.
This is a disgusting limitation. Didn't they do the same thing on PA?
Ah, yes: hppa_hpux_push_dummy_code. Similar problem with the space
registers.
Do you have the same problem with popping frames?
> One way around this problem that I thought about was to keep the BSP
> as is. This meant adjusting a bit the addresses where the arguments
> were saved. But more importantly, this meant that we overwrote the
> output section of the register frame.
>
> It's pretty easy to add some code in GDB to save this data, either
> on the inferior stack frame or perhaps directly in debugger memory.
> However, I don't see a clear way for us to do the restoration. Is
> there any?
I don't know enough about IA64 to say whether this would work, but it
sounds like a reasonable approach. Keep in mind that dummy frames are
sometimes left normally, sometimes explicitly popped, and sometimes
left abnormally (after which we need to garbage collect them, sort of);
will this hold up if you longjmp out of the called function?
> Right now, the inferior function call is made AT_ENTRY_POINT. One
> way to solve my problem that might work is to make the call ON_STACK.
> Not sure if that's allowed on this chip. But this way, I can
> dynamically create a small piece of code that does the branch to the
> target function, which would implicitly cause the BSP update that
> we're currently doing ourselves. This does open a whole can of worms,
> though, as I think I'll need to revisit the entire dummy frame unwinder,
> won't I?
Maybe, maybe not. Might be the easiest answer. I'd suspect ia64
dislikes executable stacks, though. Can you (ew) poke the necessary
code into the entry point, assuming it is small enough? If it's just a
jump to register...
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regarding storing/restoring data during inferior function call
2005-10-18 19:12 ` Daniel Jacobowitz
@ 2005-10-18 20:00 ` Mark Kettenis
0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2005-10-18 20:00 UTC (permalink / raw)
To: drow; +Cc: brobecker, gdb-patches
> Date: Tue, 18 Oct 2005 15:12:08 -0400
> From: Daniel Jacobowitz <drow@false.org>
> > Right now, the inferior function call is made AT_ENTRY_POINT. One
> > way to solve my problem that might work is to make the call ON_STACK.
> > Not sure if that's allowed on this chip. But this way, I can
> > dynamically create a small piece of code that does the branch to the
> > target function, which would implicitly cause the BSP update that
> > we're currently doing ourselves. This does open a whole can of worms,
> > though, as I think I'll need to revisit the entire dummy frame unwinder,
> > won't I?
>
> Maybe, maybe not. Might be the easiest answer. I'd suspect ia64
> dislikes executable stacks, though. Can you (ew) poke the necessary
> code into the entry point, assuming it is small enough? If it's just a
> jump to register...
On PA-RISC the C startup code provided some help here by providing
some of the code to do the branch with setting up the registers
correctly. I think libgcc also had some code to deal with it.
Perhaps there is some magic help on ia64 too?
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-10-18 20:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-18 18:46 Question regarding storing/restoring data during inferior function call Joel Brobecker
2005-10-18 19:12 ` Daniel Jacobowitz
2005-10-18 20:00 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox