* dcrt0.cc (dll_crt0_1): Add a symbol denoting return from call to main().

* exceptions.cc (stack_info::walk): Stop walking the stack when we hit
_cygwin_exit_return rather than just blindly stopping when PC becomes zero.
This commit is contained in:
Christopher Faylor
2008-08-01 19:12:49 +00:00
parent 3462d736b6
commit b23b171641
3 changed files with 18 additions and 3 deletions

View File

@ -243,21 +243,24 @@ stack_info::init (DWORD ebp, bool wantargs, bool goodframe)
# undef debp
}
extern "C" void _cygwin_exit_return ();
/* Walk the stack by looking at successive stored 'bp' frames.
This is not foolproof. */
int
stack_info::walk ()
{
char **ebp;
if ((void (*) ()) sf.AddrPC.Offset == _cygwin_exit_return)
return 0; /* stack frames are exhausted */
if (((ebp = (char **) next_offset ()) == NULL) || (ebp >= (char **) cygwin_hmodule))
return 0;
sf.AddrFrame.Offset = (DWORD) ebp;
sf.AddrPC.Offset = sf.AddrReturn.Offset;
if (!sf.AddrPC.Offset)
return 0; /* stack frames are exhausted */
/* The return address always follows the stack pointer */
sf.AddrReturn.Offset = (DWORD) *++ebp;