* exceptions.h (cygwin_exception::open_stackdumpfile): Move old function into

class.
(cygwin_exception::h): New member.
(cygwin_exception::cygwin_exception): Initialize h to NULL.
* exceptions.cc (cygwin_exception::open_stackdumpfile): Move into
cygwin_exception class.  Use 'h' class member.
(cygwin_exception::dumpstack): Close stack dump file handle if opened.
This commit is contained in:
Christopher Faylor 2014-01-08 16:51:20 +00:00
parent 847980a43b
commit 8aca67421d
3 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,13 @@
2014-01-08 Christopher Faylor <me.cygwin2013@cgf.cx>
* exceptions.h (cygwin_exception::open_stackdumpfile): Move old
function into class.
(cygwin_exception::h): New member.
(cygwin_exception::cygwin_exception): Initialize h to NULL.
* exceptions.cc (cygwin_exception::open_stackdumpfile): Move into
cygwin_exception class. Use 'h' class member.
(cygwin_exception::dumpstack): Close stack dump file handle if opened.
2014-01-04 Christopher Faylor <me.cygwin2013@cgf.cx>
* fhandler.h (cltype): New enum.

View File

@ -1,6 +1,6 @@
/* exception.h
Copyright 1996, 1997, 1998, 2000, 2001, 2005, 2010, 2011, 1012, 2013
Copyright 1996, 1997, 1998, 2000, 2001, 2005, 2010, 2011, 1012, 2013, 2014
Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
@ -147,10 +147,12 @@ class cygwin_exception
PUINT_PTR framep;
PCONTEXT ctx;
EXCEPTION_RECORD *e;
HANDLE h;
void dump_exception ();
void open_stackdumpfile ();
public:
cygwin_exception (PUINT_PTR in_framep, PCONTEXT in_ctx = NULL, EXCEPTION_RECORD *in_e = NULL):
framep (in_framep), ctx (in_ctx), e (in_e) {}
framep (in_framep), ctx (in_ctx), e (in_e), h (NULL) {}
void dumpstack ();
PCONTEXT context () const {return ctx;}
};

View File

@ -1,7 +1,7 @@
/* exceptions.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@ -122,8 +122,8 @@ error_start_init (const char *buf)
__small_sprintf (debugger_command, "%s \"%s\"", buf, pgm);
}
static void
open_stackdumpfile ()
void
cygwin_exception::open_stackdumpfile ()
{
/* If we have no executable name, or if the CWD handle is NULL,
which means, the CWD is a virtual path, don't even try to open
@ -149,7 +149,6 @@ open_stackdumpfile ()
in Cygwin's cwd. Stick to caseinsensitivity. */
InitializeObjectAttributes (&attr, &ucore, OBJ_CASE_INSENSITIVE,
cygheap->cwd.get_handle (), NULL);
HANDLE h;
IO_STATUS_BLOCK io;
NTSTATUS status;
/* Try to open it to dump the stack in it. */
@ -372,6 +371,8 @@ cygwin_exception::dumpstack ()
}
small_printf ("End of stack trace%s\n",
i == 16 ? " (more stack frames may be present)" : "");
if (h)
NtClose (h);
}
bool