From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: danny.backx@scarlet.be
Subject: Re: Patch : gdbserver get_image_name on CE
Date: Sat, 04 Jul 2009 18:14:00 -0000 [thread overview]
Message-ID: <200907041915.32158.pedro@codesourcery.com> (raw)
In-Reply-To: <200907012113.06018.pedro@codesourcery.com>
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). Then
> 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.
--
Pedro Alves
2009-07-04 Danny Backx <dannybackx@users.sourceforge.net>
Pedro Alves <pedro@codesourcery.com>
* 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
===================================================================
--- 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 = \
- 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 = CONTEXT_EXTENDED_REGISTERS;
+
+ again:
+ th->context.ContextFlags = (CONTEXT_FULL
+ | CONTEXT_FLOATING_POINT
+ | CONTEXT_DEBUG_REGISTERS
+ | extended_registers);
- GetThreadContext (th->h, &th->context);
+ if (!GetThreadContext (th->h, &th->context))
+ {
+ DWORD e = GetLastError ();
+
+ if (extended_registers && e == ERROR_INVALID_PARAMETER)
+ {
+ extended_registers = 0;
+ goto again;
+ }
+
+ error ("GetThreadContext failure %ld\n", (long) e);
+ }
debug_registers_changed = 0;
@@ -283,6 +298,9 @@
collect_register (r, context_offset);
}
+static const unsigned char i386_win32_breakpoint = 0xcc;
+#define i386_win32_breakpoint_len 1
+
struct win32_target_ops the_low_target = {
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
===================================================================
--- 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 = GetLastError();
+
+ if (e == 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 = TARGET_WAITKIND_EXITED;
+ ourstatus->value.integer = 1;
+ return 1;
+ }
+
+ return 0;
+ }
}
gotevent:
next prev parent reply other threads:[~2009-07-04 18:14 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-13 14:29 Danny Backx
2009-06-13 18:05 ` Pedro Alves
2009-06-13 18:08 ` Pedro Alves
2009-06-14 8:35 ` Danny Backx
2009-06-14 13:56 ` Pedro Alves
2009-06-14 8:47 ` Danny Backx
2009-06-14 9:48 ` Danny Backx
2009-06-14 14:23 ` Pedro Alves
2009-06-21 9:50 ` Danny Backx
2009-06-30 21:07 ` Danny Backx
2009-06-30 21:56 ` Pedro Alves
2009-07-01 18:41 ` Danny Backx
2009-07-01 18:52 ` Pedro Alves
2009-07-01 19:12 ` Danny Backx
2009-07-01 20:12 ` Pedro Alves
2009-07-04 18:14 ` Pedro Alves [this message]
2009-07-08 9:55 ` Danny Backx
2009-07-08 11:34 ` Danny Backx
2009-07-27 20:40 ` Danny Backx
2009-07-01 19:31 ` Danny Backx
2009-06-14 14:34 ` Pedro Alves
2009-06-14 14:05 ` Pedro Alves
-- strict thread matches above, loose matches on Subject: below --
2009-06-07 9:18 Danny Backx
2009-06-07 17:03 ` Pedro Alves
2009-06-07 18:02 ` Danny Backx
2009-06-07 18:15 ` Pedro Alves
2009-06-07 19:13 ` Danny Backx
2009-06-07 19:28 ` Pedro Alves
2009-06-08 18:13 ` Danny Backx
2009-06-12 22:18 ` Danny Backx
2009-06-13 6:28 ` Johnny Willemsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200907041915.32158.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=danny.backx@scarlet.be \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox