This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/13158] bad unwind info as a result of sibcall


------- Additional Comments From davidm at hpl dot hp dot com  2004-05-13 04:25 -------
(In reply to comment #3)
> This patch just 
> emits a .prologue directive for the second alloc which is a start, but 
> may not be enough.

It seems like a very good start, actually.

> Using .endp/.proc seems like a misuse of those directives.

Yes.  Thinking some more about it, perhaps the best way to handle it is to
ensure that there is a ".restore sp" directive and then issue a .prologue
right before the sibcall "alloc".  Assuming (a) unwind info at the point of a
sibcall is never nested (I believe that's true) and (b) that a sibcall cannot
occur within the normal prologue of the procedure (this better be true), then
this solution should be safe.  I attached a patch which consists simply of your
original patch plus the extra bit of code to generate ".restore sp" if we're
dealing with a procedure that doesn't have a memory-stack frame.

I tested the patch with the above "bug.c" routine when run under libunwind's
"test-ptrace" program (which single-steps through the program, unwinding the
stack at each point).  This test-case now succeeds, so the basics look good.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13158


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]