]> sourceware.org Git - newlib-cygwin.git/commitdiff
* exception.h (stackdump): Declare.
authorChristopher Faylor <me@cgf.cx>
Sun, 12 Feb 2012 22:43:33 +0000 (22:43 +0000)
committerChristopher Faylor <me@cgf.cx>
Sun, 12 Feb 2012 22:43:33 +0000 (22:43 +0000)
* exceptions.cc (stackdump): Rework to perform all operations needed for a
stackdump and to avoid recursion.
(exception::handle): Use simplified stackdump interface.
* sigproc.cc (signal::exit): Ditto.  Delete now, uneeded declaration.

winsup/cygwin/ChangeLog
winsup/cygwin/exception.h
winsup/cygwin/exceptions.cc
winsup/cygwin/sigproc.cc

index fcbc8fad0a309ac9c55adf39d32c6400e3f71b30..f82ad8cc7d3dc7a37e397599389daee0452934e2 100644 (file)
@@ -1,3 +1,11 @@
+2012-02-12  Christopher Faylor  <me.cygwin2012@cgf.cx>
+
+       * exception.h (stackdump): Declare.
+       * exceptions.cc (stackdump): Rework to perform all operations needed
+       for a stackdump and to avoid recursion.
+       (exception::handle): Use simplified stackdump interface.
+       * sigproc.cc (signal::exit): Ditto.  Delete now, uneeded declaration.
+
 2012-02-11  Corinna Vinschen  <corinna@vinschen.de>
 
        * miscfuncs.cc (DEFAULT_STACKSIZE): Remove.
index 9f4a6c45c6e4f0a6ee65580373011757116625df..b0a66b4eeab68a2c981b7db5826cc97115b12285 100644 (file)
@@ -1,13 +1,12 @@
 /* exception.h
 
-   Copyright 2010, 2011 Red Hat, Inc.
+   Copyright 2010, 2011, 2012 Red Hat, Inc.
 
 This software is a copyrighted work licensed under the terms of the
 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
 details. */
 
-#ifndef _EXCEPTION_H
-#define _EXCEPTION_H
+#pragma once
 
 #include <exceptions.h>
 
@@ -29,5 +28,10 @@ public:
   ~exception () __attribute__ ((always_inline)) { _except_list = save; }
 };
 
-#endif /*_EXCEPTION_H*/
+void stackdump (DWORD, CONTEXT * = NULL, EXCEPTION_RECORD * = NULL);
+extern void inline
+stackdump (DWORD n, bool)
+{
+  stackdump (n, (CONTEXT *) 1);
+}
 
index 6d03da8e729567db391f35fa1a8cb5b6f7d026e6..c6497f3b1c97c88e44d3233a18160da967abdab1 100644 (file)
@@ -280,21 +280,21 @@ stack_info::walk ()
 }
 
 void
-stackdump (DWORD ebp, int open_file, bool isexception)
+stackdump (DWORD ebp, PCONTEXT in, EXCEPTION_RECORD *e)
 {
   static bool already_dumped;
 
-  if (cygheap->rlim_core == 0UL || (open_file && already_dumped))
+  if (already_dumped || cygheap->rlim_core == 0Ul)
     return;
-
-  if (open_file)
-    open_stackdumpfile ();
-
   already_dumped = true;
+  open_stackdumpfile ();
+
+  if (e)
+    dump_exception (e, in);
 
   int i;
 
-  thestack.init (ebp, 1, !isexception);        /* Initialize from the input CONTEXT */
+  thestack.init (ebp, 1, !in); /* Initialize from the input CONTEXT */
   small_printf ("Stack trace:\r\nFrame     Function  Args\r\n");
   for (i = 0; i < 16 && thestack++; i++)
     {
@@ -356,7 +356,7 @@ cygwin_stackdump ()
   CONTEXT c;
   c.ContextFlags = CONTEXT_FULL;
   GetThreadContext (GetCurrentThread (), &c);
-  stackdump (c.Ebp, 0, 0);
+  stackdump (c.Ebp);
 }
 
 #define TIME_TO_WAIT_FOR_DEBUGGER 10000
@@ -660,11 +660,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void
 
          rtl_unwind (frame, e);
          if (cygheap->rlim_core > 0UL)
-           {
-             open_stackdumpfile ();
-             dump_exception (e, in);
-             stackdump ((DWORD) ebp, 0, 1);
-           }
+           stackdump ((DWORD) ebp, in, e);
        }
 
       if (e->ExceptionCode == STATUS_ACCESS_VIOLATION)
index 7850ab1b6a1f903ab08971160eae8b8ff9fff092..73b934b3d9a3f677266bf4f0412e28d748796ee3 100644 (file)
@@ -23,6 +23,7 @@ details. */
 #include "shared_info.h"
 #include "cygtls.h"
 #include "ntdll.h"
+#include "exception.h"
 
 /*
  * Convenience defines
@@ -373,8 +374,6 @@ close_my_readsig ()
 void
 _cygtls::signal_exit (int rc)
 {
-  extern void stackdump (DWORD, int, bool);
-
   HANDLE myss = my_sendsig;
   my_sendsig = NULL;            /* Make no_signals_allowed return true */
 
@@ -414,7 +413,7 @@ _cygtls::signal_exit (int rc)
     }
 
   if ((rc & 0x80) && !try_to_debug ())
-    stackdump (thread_context.ebp, 1, 1);
+    stackdump (thread_context.ebp, true);
 
   lock_process until_exit (true);
   if (have_execed || exit_state > ES_PROCESS_LOCKED)
This page took 0.038943 seconds and 5 git commands to generate.