[Fwd: Unwinding through `no return'?]
Andrew Cagney
ac131313@redhat.com
Wed Aug 13 18:45:00 GMT 2003
> Three comments, kinda superficial:
>
> Sometimes the caller will be in code with no debug info,
> such as library code. RA-1 would be good there.
>
> Look at the case where the operating system delivers a signal and sets
> up a sigreturn frame. In that case, a return address on a stack
> really does point to the first instruction of a function (__restore
> on my red hat linux 8 box). RA-1 would be bad there.
FYI, I've already sent a follow up expanding on this.
> Someone, maybe rth?, mentioned that on some architectures,
> the ABI requires a nop instruction after a noreturn call.
> If we ask gcc to do something like that in all cases it might
> make our job easier.
That matches one of the responses:
> Andrew:
>
> We also encountered this problem, where the call's return address actually
> pointed to the first instruction of a subsequent routine, because the call
> was known never to return. We were leery of changing the unwinder always to
> back up because of the issue you raised, where a normal function call might
> need different CFI before and after the call. I don't know of a real world
> situation where that happens, but that doesn't mean there isn't one, and I'd
> hate to break it. Our tail-wagging-dog solution was to emit an extra
> instruction after the call that never returns. On Pentium, for instance,
> ud2. Then that extra instruction's address was the return address and it had
> CFI appropriate for the calling routine.
>
> -- Todd Allen Concurrent Computer Corporation
But it won't fly when the compiler is trying to optimize for space.
Andrew
More information about the Gdb
mailing list