From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4043 invoked by alias); 27 Mar 2005 05:21:09 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3514 invoked from network); 27 Mar 2005 05:20:52 -0000 Received: from unknown (HELO coe.casa.cgf.cx) (66.30.17.189) by sourceware.org with SMTP; 27 Mar 2005 05:20:52 -0000 Received: by coe.casa.cgf.cx (Postfix, from userid 201) id 40D94421265; Sun, 27 Mar 2005 00:20:52 -0500 (EST) Date: Sun, 27 Mar 2005 05:21:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org Subject: [commit] Ignore SEGVs from win32 IsBad* functions Message-ID: <20050327052052.GA23610@coe.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2005-03/txt/msg00359.txt.bz2 There have been a number of complaints in the cygwin lists about gdb's behavior with the win32 IsBad*Ptr calls. This patch causes gdb to ignore notification of SEGV from within those calls. cgf 2005-03-27 Christopher Faylor * win32-nat.c (handle_exception): Treat win32 routines which check for valid addresses as "special" and don't stop when a SEGV is detected. (get_child_debug_event): Properly flag exception as unhandled. Index: win32-nat.c =================================================================== RCS file: /cvs/uberbaum/gdb/win32-nat.c,v retrieving revision 1.109 diff -u -p -r1.109 win32-nat.c --- win32-nat.c 21 Mar 2005 19:54:15 -0000 1.109 +++ win32-nat.c 27 Mar 2005 05:17:45 -0000 @@ -1077,6 +1077,14 @@ handle_exception (struct target_waitstat case EXCEPTION_ACCESS_VIOLATION: DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION"); ourstatus->value.sig = TARGET_SIGNAL_SEGV; + { + char *fn; + if (find_pc_partial_function ((CORE_ADDR) current_event.u.Exception + .ExceptionRecord.ExceptionAddress, + &fn, NULL, NULL) + && strncmp (fn, "KERNEL32!IsBad", strlen ("KERNEL32!IsBad")) == 0) + return 0; + } break; case STATUS_STACK_OVERFLOW: DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW"); @@ -1360,6 +1368,8 @@ get_child_debug_event (int pid, struct t break; if (handle_exception (ourstatus)) retval = current_event.dwThreadId; + else + continue_status = DBG_EXCEPTION_NOT_HANDLED; break; case OUTPUT_DEBUG_STRING_EVENT: /* message from the kernel */