Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-08-01 23:12:49 +0400
committerChristopher Faylor <me@cgf.cx>2008-08-01 23:12:49 +0400
commitb23b171641332bb24736274825e558175b1acf13 (patch)
tree06819fed79a28367844dd8d83ebc6f2ff6608a5c /winsup/cygwin
parent3462d736b64e2601971fb185cbf83cb8828208c3 (diff)
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/dcrt0.cc4
-rw-r--r--winsup/cygwin/exceptions.cc9
3 files changed, 18 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d1c1ae7c3..e90724529 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-01 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * 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.
+
2008-07-31 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_info::check): Handle (and explain) a special case
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 6b2d283fd..e37cbec9b 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -933,6 +933,10 @@ dll_crt0_1 (void *)
ld_preload ();
if (user_data->main)
cygwin_exit (user_data->main (__argc, __argv, *user_data->envptr));
+ __asm__ (" \n\
+ .global __cygwin_exit_return \n\
+__cygwin_exit_return: \n\
+");
}
extern "C" void __stdcall
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 9b7c98049..e744e7c5d 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -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;