Re: Pb when calling a nested function in the inferior

Joel Brobecker
2001-07-30T14:24:00Z

> > I've personally never used (or even seen) this
> > nested function syntax, so I don't know anything
> > useful about it. -- Michael

Yes, I hesitated a bit before posting this example, knowing that it was
a gcc extension. However, I thought it would make an easier to undertand
example rather than posting Ada95 code.

> It's a gcc extension. Apparently, on i386, a pointer to the static
> chain is passed in ecx. If Joel wants to fix this problem, it'd be a
> good idea to see if the relevant ABI addresses this issue and then
> make the appropriate changes. (The trick, I think, is to figure out
> the correct value to load into ecx.)

OK, I'll have a look and see what can be done. But before doing
anything, is there a way for gdb to detect that the function it is about
to call is nested? I think that, as a first step, having gdb diagnose
such cases and report a warning or an error would be an improvement.
Right now, it gives either an incorrect value or even crashes the
inferior.

Thanks for your help.
--
Joel