From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14809 invoked by alias); 4 Jul 2009 18:14:21 -0000 Received: (qmail 14800 invoked by uid 22791); 4 Jul 2009 18:14:20 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Jul 2009 18:14:11 +0000 Received: (qmail 15745 invoked from network); 4 Jul 2009 18:14:07 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 4 Jul 2009 18:14:07 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Patch : gdbserver get_image_name on CE Date: Sat, 04 Jul 2009 18:14:00 -0000 User-Agent: KMail/1.9.10 Cc: danny.backx@scarlet.be References: <1244903385.20290.9.camel@pavilion> <1246473648.15871.201.camel@pavilion> <200907012113.06018.pedro@codesourcery.com> In-Reply-To: <200907012113.06018.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200907041915.32158.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00105.txt.bz2 On Wednesday 01 July 2009 21:13:05, Pedro Alves wrote: > I'll see about cleaning up the bits of your patch that are OK and > apply them (you still aren't following the code conventions). =A0Then > we can focus on just this bit. I've checked in the patch below, after giving it a testsuite run against a local Cygwin gdbserver without regressions. --=20 Pedro Alves 2009-07-04 Danny Backx Pedro Alves * win32-i386-low.c (i386_get_thread_context): Handle systems that don't support CONTEXT_EXTENDED_REGISTERS. (i386_win32_breakpoint, i386_win32_breakpoint_len): New. (the_low_target): Install them. * win32-low.c (get_child_debug_event): Handle WaitForDebugEvent failing with ERROR_PIPE_NOT_CONNECTED. --- gdb/gdbserver/win32-i386-low.c | 34 ++++++++++++++++++++++++++-------- gdb/gdbserver/win32-low.c | 17 ++++++++++++++++- 2 files changed, 42 insertions(+), 9 deletions(-) Index: src/gdb/gdbserver/win32-i386-low.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src.orig/gdb/gdbserver/win32-i386-low.c 2009-07-04 17:39:07.046875000 += 0100 +++ src/gdb/gdbserver/win32-i386-low.c 2009-07-04 19:11:08.375000000 +0100 @@ -129,13 +129,28 @@ static void i386_get_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event) { - th->context.ContextFlags =3D \ - CONTEXT_FULL | \ - CONTEXT_FLOATING_POINT | \ - CONTEXT_EXTENDED_REGISTERS | \ - CONTEXT_DEBUG_REGISTERS; + /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if + the system doesn't support extended registers. */ + static DWORD extended_registers =3D CONTEXT_EXTENDED_REGISTERS; + + again: + th->context.ContextFlags =3D (CONTEXT_FULL + | CONTEXT_FLOATING_POINT + | CONTEXT_DEBUG_REGISTERS + | extended_registers); =20 - GetThreadContext (th->h, &th->context); + if (!GetThreadContext (th->h, &th->context)) + { + DWORD e =3D GetLastError (); + + if (extended_registers && e =3D=3D ERROR_INVALID_PARAMETER) + { + extended_registers =3D 0; + goto again; + } + + error ("GetThreadContext failure %ld\n", (long) e); + } =20 debug_registers_changed =3D 0; =20 @@ -283,6 +298,9 @@ collect_register (r, context_offset); } =20 +static const unsigned char i386_win32_breakpoint =3D 0xcc; +#define i386_win32_breakpoint_len 1 + struct win32_target_ops the_low_target =3D { init_registers_i386, sizeof (mappings) / sizeof (mappings[0]), @@ -293,8 +311,8 @@ i386_fetch_inferior_register, i386_store_inferior_register, i386_single_step, - NULL, /* breakpoint */ - 0, /* breakpoint_len */ + &i386_win32_breakpoint, + i386_win32_breakpoint_len, i386_insert_point, i386_remove_point, i386_stopped_by_watchpoint, Index: src/gdb/gdbserver/win32-low.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src.orig/gdb/gdbserver/win32-low.c 2009-07-04 17:39:07.092875000 +0100 +++ src/gdb/gdbserver/win32-low.c 2009-07-04 19:00:07.750000000 +0100 @@ -1407,7 +1407,22 @@ interruption, but high enough so gdbserver doesn't become a bottleneck. */ if (!WaitForDebugEvent (¤t_event, 250)) - return 0; + { + DWORD e =3D GetLastError(); + + if (e =3D=3D ERROR_PIPE_NOT_CONNECTED) + { + /* This will happen if the loader fails to succesfully + load the application, e.g., if the main executable + tries to pull in a non-existing export from a + DLL. */ + ourstatus->kind =3D TARGET_WAITKIND_EXITED; + ourstatus->value.integer =3D 1; + return 1; + } + + return 0; + } } =20 gotevent: