* exceptions.cc (try_to_debug): Prevent recursive spawning of JIT debugger.
Treat special event from debugger as command to continue.
This commit is contained in:
parent
0106a9b755
commit
1d613351e5
|
@ -1,8 +1,13 @@
|
|||
2000-07-04 Vadim Egorov <egorovv@mailandnews.com>
|
||||
|
||||
* exceptions.cc (try_to_debug): Prevent recursive spawning of JIT
|
||||
debugger. Treat special event from debugger as command to continue.
|
||||
|
||||
Mon Jul 4 19:29:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* poll.cc (poll): Zero out `open_fds' as well.
|
||||
|
||||
Mon Jul 4 19:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
Mon Jul 4 1:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* include/cygwin/version.h: Bump API minor version to 24.
|
||||
|
||||
|
|
|
@ -201,14 +201,14 @@ class stack_info
|
|||
public:
|
||||
STACKFRAME sf; /* For storing the stack information */
|
||||
void init (DWORD); /* Called the first time that stack info is needed */
|
||||
stack_info (): first_time(1) {}
|
||||
stack_info (): first_time (1) {}
|
||||
|
||||
/* Postfix ++ iterates over the stack, returning zero when nothing is left. */
|
||||
int operator ++(int) { return this->walk (); }
|
||||
};
|
||||
|
||||
/* The number of parameters used in STACKFRAME */
|
||||
#define NPARAMS (sizeof(thestack.sf.Params) / sizeof(thestack.sf.Params[0]))
|
||||
#define NPARAMS (sizeof (thestack.sf.Params) / sizeof (thestack.sf.Params[0]))
|
||||
|
||||
/* This is the main stack frame info for this process. */
|
||||
static NO_COPY stack_info thestack;
|
||||
|
@ -219,7 +219,7 @@ void
|
|||
stack_info::init (DWORD ebp)
|
||||
{
|
||||
first_time = 1;
|
||||
memset (&sf, 0, sizeof(sf));
|
||||
memset (&sf, 0, sizeof (sf));
|
||||
sf.AddrFrame.Offset = ebp;
|
||||
sf.AddrPC.Offset = ((DWORD *) ebp)[1];
|
||||
sf.AddrFrame.Mode = AddrModeFlat;
|
||||
|
@ -277,7 +277,7 @@ stack (CONTEXT *cx)
|
|||
|
||||
/* Temporary (?) function for external callers to get a stack dump */
|
||||
extern "C" void
|
||||
cygwin_stackdump()
|
||||
cygwin_stackdump ()
|
||||
{
|
||||
CONTEXT c;
|
||||
c.ContextFlags = CONTEXT_FULL;
|
||||
|
@ -287,6 +287,8 @@ cygwin_stackdump()
|
|||
|
||||
static int NO_COPY keep_looping = 0;
|
||||
|
||||
#define TIME_TO_WAIT_FOR_DEBUGGER 10000
|
||||
|
||||
extern "C" int
|
||||
try_to_debug ()
|
||||
{
|
||||
|
@ -316,6 +318,21 @@ try_to_debug ()
|
|||
ReleaseMutex (pinfo_mutex);
|
||||
ReleaseMutex (title_mutex);
|
||||
|
||||
/* prevent recursive exception handling */
|
||||
char* rawenv = GetEnvironmentStrings () ;
|
||||
for (char* p = rawenv; *p != '\0'; p = strchr (p, '\0') + 1)
|
||||
{
|
||||
if (strncmp (p, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
|
||||
{
|
||||
system_printf ("%s", p);
|
||||
char* q = strstr (p, "error_start") ;
|
||||
/* replace 'error_start=...' with '_rror_start=...' */
|
||||
if (q) *q = '_' ;
|
||||
SetEnvironmentVariable ("CYGWIN", p + sizeof ("CYGWIN=")) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
dbg = CreateProcess (NULL,
|
||||
debugger_command,
|
||||
NULL,
|
||||
|
@ -335,9 +352,22 @@ try_to_debug ()
|
|||
}
|
||||
else
|
||||
{
|
||||
char event_name [ sizeof ("cygwin_error_start_event") + 9 ];
|
||||
DWORD win32_pid = GetCurrentProcessId ();
|
||||
__small_sprintf (event_name, "cygwin_error_start_event%x", win32_pid);
|
||||
HANDLE sync_with_dbg = CreateEvent (NULL, TRUE, FALSE, event_name);
|
||||
keep_looping = 1;
|
||||
while (keep_looping)
|
||||
Sleep (10000);
|
||||
{
|
||||
if (sync_with_dbg == NULL)
|
||||
Sleep (TIME_TO_WAIT_FOR_DEBUGGER);
|
||||
else
|
||||
{
|
||||
if (WaitForSingleObject (sync_with_dbg,
|
||||
TIME_TO_WAIT_FOR_DEBUGGER) == WAIT_OBJECT_0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -354,7 +384,7 @@ stackdump (EXCEPTION_RECORD *e, CONTEXT *in)
|
|||
p++;
|
||||
else
|
||||
p = myself->progname;
|
||||
char corefile[strlen(p) + sizeof(".stackdump")];
|
||||
char corefile[strlen (p) + sizeof (".stackdump")];
|
||||
__small_sprintf (corefile, "%s.stackdump", p);
|
||||
HANDLE h = CreateFile (corefile, GENERIC_WRITE, 0, &sec_none_nih,
|
||||
CREATE_ALWAYS, 0, 0);
|
||||
|
@ -439,11 +469,11 @@ handle_exceptions (EXCEPTION_RECORD *e, void *, CONTEXT *in, void *)
|
|||
debug_printf ("In cygwin_except_handler exc %p at %p sp %p", e->ExceptionCode, in->Eip, in->Esp);
|
||||
debug_printf ("In cygwin_except_handler sig = %d at %p", sig, in->Eip);
|
||||
|
||||
if (myself->getsig(sig).sa_mask & SIGTOMASK (sig))
|
||||
syscall_printf ("signal %d, masked %p", sig, myself->getsig(sig).sa_mask);
|
||||
if (myself->getsig (sig).sa_mask & SIGTOMASK (sig))
|
||||
syscall_printf ("signal %d, masked %p", sig, myself->getsig (sig).sa_mask);
|
||||
|
||||
debug_printf ("In cygwin_except_handler calling %p",
|
||||
myself->getsig(sig).sa_handler);
|
||||
myself->getsig (sig).sa_handler);
|
||||
|
||||
DWORD *ebp = (DWORD *)in->Esp;
|
||||
for (DWORD *bpend = (DWORD *) __builtin_frame_address (0); ebp > bpend; ebp--)
|
||||
|
@ -454,9 +484,9 @@ handle_exceptions (EXCEPTION_RECORD *e, void *, CONTEXT *in, void *)
|
|||
}
|
||||
|
||||
if (!myself->progname[0]
|
||||
|| (void *) myself->getsig(sig).sa_handler == (void *) SIG_DFL
|
||||
|| (void *) myself->getsig(sig).sa_handler == (void *) SIG_IGN
|
||||
|| (void *) myself->getsig(sig).sa_handler == (void *) SIG_ERR)
|
||||
|| (void *) myself->getsig (sig).sa_handler == (void *) SIG_DFL
|
||||
|| (void *) myself->getsig (sig).sa_handler == (void *) SIG_IGN
|
||||
|| (void *) myself->getsig (sig).sa_handler == (void *) SIG_ERR)
|
||||
{
|
||||
static NO_COPY int traced = 0;
|
||||
|
||||
|
@ -601,7 +631,7 @@ interrupt_now (CONTEXT *ctx, int sig, struct sigaction& siga, void *handler)
|
|||
{
|
||||
interrupt_setup (sig, siga, handler, ctx->Eip, 0);
|
||||
ctx->Eip = (DWORD) sigdelayed;
|
||||
SetThreadContext (myself->getthread2signal(), ctx); /* Restart the thread */
|
||||
SetThreadContext (myself->getthread2signal (), ctx); /* Restart the thread */
|
||||
}
|
||||
|
||||
void __cdecl
|
||||
|
@ -755,7 +785,7 @@ next:
|
|||
res = SetEvent (signal_arrived); // For an EINTR case
|
||||
sigproc_printf ("armed signal_arrived %p, res %d", signal_arrived, res);
|
||||
/* Clear any waiting threads prior to dispatching to handler function */
|
||||
proc_subproc(PROC_CLEARWAIT, 1);
|
||||
proc_subproc (PROC_CLEARWAIT, 1);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -798,7 +828,7 @@ ctrl_c_handler (DWORD type)
|
|||
sig_send (NULL, SIGHUP);
|
||||
return FALSE;
|
||||
}
|
||||
tty_min *t = cygwin_shared->tty.get_tty(myself->ctty);
|
||||
tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);
|
||||
/* Ignore this if we're not the process group lead since it should be handled
|
||||
*by* the process group leader. */
|
||||
if (t->getpgid () != myself->pid ||
|
||||
|
@ -858,7 +888,7 @@ sig_handle_tty_stop (int sig)
|
|||
*/
|
||||
if (my_parent_is_alive ())
|
||||
{
|
||||
pinfo *parent = procinfo(myself->ppid);
|
||||
pinfo *parent = procinfo (myself->ppid);
|
||||
sig_send (parent, __SIGCHILDSTOPPED);
|
||||
}
|
||||
sigproc_printf ("process %d stopped by signal %d, parent_alive %p",
|
||||
|
@ -876,7 +906,7 @@ sig_handle (int sig)
|
|||
|
||||
sigproc_printf ("signal %d", sig);
|
||||
|
||||
struct sigaction thissig = myself->getsig(sig);
|
||||
struct sigaction thissig = myself->getsig (sig);
|
||||
void *handler = (void *) thissig.sa_handler;
|
||||
|
||||
myself->rusage_self.ru_nsignals++;
|
||||
|
@ -969,8 +999,8 @@ exit_sig:
|
|||
TerminateThread (hMainThread, 0);
|
||||
/* FIXME: This just works around the problem so that we don't attempt to
|
||||
use a resource lock when exiting. */
|
||||
user_data->resourcelocks->Delete();
|
||||
user_data->resourcelocks->Init();
|
||||
user_data->resourcelocks->Delete ();
|
||||
user_data->resourcelocks->Init ();
|
||||
do_exit (EXIT_SIGNAL | (sig << 8));
|
||||
/* Never returns */
|
||||
}
|
||||
|
@ -1053,7 +1083,7 @@ reset_signal_arrived ()
|
|||
sigproc_printf ("reset signal_arrived");
|
||||
}
|
||||
|
||||
void unused_sig_wrapper()
|
||||
void unused_sig_wrapper ()
|
||||
{
|
||||
/* Signal cleanup stuff. Cleans up stack (too bad that we didn't
|
||||
prototype signal handlers as __stdcall), calls _set_process_mask
|
||||
|
@ -1120,6 +1150,6 @@ ___siglast:
|
|||
" : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno),
|
||||
"g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig),
|
||||
"g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno)
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue