Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: From: "Schaible, Joerg" To: "'cygwin-list'" Cc: "'JRSON AT NetZero DOT Net'" Subject: RE: JIT debugging with gdb Date: Thu, 10 Jun 1999 09:38:04 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" JIT for Win95/98: The entry is not in the registry, but has to be in the WIN.INI: [AeDebug] Auto=0 Debugger= ... To get the app name from the PID, you have to use the PSAPI in WinNT 4.0 and TOOLHELP for Win95/98/2000. Have some source at home ... but not currently here in the office. > -----Original Message----- > From: JRSON AT NetZero DOT Net [SMTP:JRSON AT NetZero DOT Net] > Sent: Wednesday, June 09, 1999 10:07 PM > To: cygwin AT sourceware DOT cygnus DOT com > Cc: cygwin-developers AT sourceware DOT cygnus DOT com > Subject: JIT debugging with gdb > > Following is a patch to add basic support to the cvs gdb > for JIT debugging on win95 and NT 4. > > Currently only works for vc++ and mingw32 .exe's cause > cygwin doesn't let the system handle exceptions. > (easy fix is just to return 1 in > .../winsup/exceptions.cc->handel_exceptions() > instead of printing out those oh so useful *.core files :) > > TODO (for someone else ;) get executable name from pid and load it. > WORKAROUND use > add-symbol-file filename.exe 0x401000 > at the (gdb) prompt. > > Could someone please check if this works for > 98 and 2000? > > REGEDIT4 > > [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\aedebug] > "Auto"="0" > "Debugger"="d:/usr/H-i586~1/bin/gdb -c %#x -Event-HANDLE %ld" > > > > --- ./win32-nat.c 1999/05/30 10:17:24 1.2 > +++ ./win32-nat.c 1999/06/04 11:22:14 > @@ -119,6 +119,8 @@ > static int debug_memory = 0; /* show target memory accesses */ > static int debug_exceptions = 0; /* show target exceptions */ > > +HANDLE notify_attach = 0; /* JIT event handle from command line to notify > kernel we are attached */ > + > /* This vector maps GDB's idea of a register's number into an address > in the win32 exception context vector. > > @@ -639,6 +641,8 @@ > case EXCEPTION_BREAKPOINT: > DEBUG_EXCEPT (("gdb: Target exception BREAKPOINT at 0x%08x\n", > > current_event.u.Exception.ExceptionRecord.ExceptionAddress)); > + if (current_event.u.Exception.dwFirstChance && notify_attach){ > th->context.Eip = > (DWORD)current_event.u.Exception.ExceptionRecord.ExceptionAddress + 1; > SetThreadContext(th->h, &th->context); } > + if (notify_attach && (exception_count == 1) && !(GetVersion() < > 0x80000000) && !SetEvent(notify_attach)) DEBUG_EXCEPT (("gdb: could not > notify windows of attach\n")); > ourstatus->value.sig = TARGET_SIGNAL_TRAP; > break; > case DBG_CONTROL_C: > @@ -712,6 +716,7 @@ > char *p; > thread_info *th; > int sig; > + int except_result; > > if (debug_event) > { > @@ -738,6 +743,8 @@ > current_event.dwProcessId, > current_event.dwThreadId, > "EXIT_THREAD_DEBUG_EVENT")); > child_delete_thread (current_event.dwThreadId); > + if (notify_attach && (GetVersion() < 0x80000000) && > SetEvent(notify_attach)) notify_attach = 0; > + else if (notify_attach && (GetVersion() < 0x80000000)) > {DEBUG_EVENTS (("gdb: could not notify NT of attach event. HANDLE=%\n", > notify_attach)); notify_attach = 0;} > break; > > case CREATE_PROCESS_DEBUG_EVENT: > @@ -780,8 +787,11 @@ > DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d > code=%s)\n", > current_event.dwProcessId, > current_event.dwThreadId, > "EXCEPTION_DEBUG_EVENT")); > - if (handle_exception (ourstatus)) > - return current_event.dwThreadId; > + if ((except_result = handle_exception (ourstatus)) && > ((ourstatus->value.sig != TARGET_SIGNAL_TRAP) || !notify_attach)) > + return current_event.dwThreadId; /* not a trap or we are > not JIT attaching */ > +#define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001L) > + else if (except_result && (GetVersion() < 0x80000000)) { > continue_status = DBG_EXCEPTION_HANDLED; break; /* attaching NT */ } > + else if (except_result && (exception_count == > 2)){notify_attach = 0;break; /* 9x fall through for the 1st one */} > continue_status = DBG_EXCEPTION_NOT_HANDLED; > break; > > --- ./config/i386/xm-cygwin.h 1999/05/31 14:41:24 1.1 > +++ ./config/i386/xm-cygwin.h 1999/06/04 11:09:58 > @@ -33,3 +33,7 @@ > > #define HAVE_SIGSETMASK 0 > > +extern void *notify_attach; /* kernel supplied event handle to notify it > of JIT attach */ > +#define ADDITIONAL_OPTIONS {"Event-HANDLE", > required_argument, 0, 1004}, > +#define ADDITIONAL_OPTION_CASES case 1004: notify_attach = > (HANDLE)atoi(optarg); break; > +#define ADDITIONAL_OPTION_HELP " -Event-HANDLE HANDLE handle to > signal the kernel we have attached for JIT.\n" > ________________________________________________________ > NetZero - We believe in a FREE Internet. Shouldn't you? > Get your FREE Internet Access and Email at > http://www.netzero.net/download/index.html > > -- > Want to unsubscribe from this list? > Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com