From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/7] Merge async and sync code paths some more
Date: Fri, 16 Oct 2015 16:37:00 -0000 [thread overview]
Message-ID: <562127AB.4050303@redhat.com> (raw)
In-Reply-To: <20151016162250.GH3341@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]
On 10/16/2015 05:22 PM, Joel Brobecker wrote:
>> I'm trying to build a Windows gdb to see this in
>> action. Many thanks for the detailed analysis!
>
> Thanks Pedro. Let me know if I can help, I don't mind doing the
> leg-work! It's just that I needed a bit of guidance because I don't
> have the whole picture on how the mainloop is supposed to work,
> particulary with the async-vs-non-async, all-stop-vs-non-stop,
> etc.
>
I had forgotten how building on Cygwin takes ages! :-P
So my main gripe with the patch is this:
@@ -2821,6 +2821,15 @@ attach_command (char *args, int from_tty)
mark_infrun_async_event_handler ();
return;
}
+ else
+ {
+ /* We don't expect any additional attach event from the target.
+ So make sure that the infrun_async_event_handler is disabled.
+ Otherwise, the main event loop might believe that we have
+ inferior events ready, causing us to wait for those event
+ that will never come, since our inferior is now stopped. */
+ infrun_async (0);
+ }
If debugging more than one inferior (granted, Windows doesn't
support this, but, alas), this prevents gdb from reacting to pending events
for threads of the other inferior.
How about we make do_initial_windows_stuff call windows_wait/windows_resume
directly, like we did for gdbserver here:
https://sourceware.org/ml/gdb-patches/2013-12/msg00371.html
As mentioned in that thread, I've wanted to do this before
in order to get rid of stop_after_trap.
The patch below seems to work for me.
Thanks,
Pedro Alves
[-- Attachment #2: 0001-no-wfi.patch --]
[-- Type: text/x-patch, Size: 1766 bytes --]
From b77696d634a1ff7e41fe75af24c9d6efcc7c46d2 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 16 Oct 2015 16:12:45 +0100
Subject: [PATCH] no wfi
---
gdb/windows-nat.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 4ab74b4..e6c396b 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1642,7 +1642,6 @@ windows_add_all_dlls (void)
static void
do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
{
- extern int stop_after_trap;
int i;
struct inferior *inf;
struct thread_info *tp;
@@ -1681,16 +1680,20 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
target_terminal_inferior ();
windows_initialization_done = 0;
- inf->control.stop_soon = STOP_QUIETLY;
+
while (1)
{
- stop_after_trap = 1;
- wait_for_inferior ();
- tp = inferior_thread ();
- if (tp->suspend.stop_signal != GDB_SIGNAL_TRAP)
- resume (tp->suspend.stop_signal);
- else
+ struct target_waitstatus status;
+
+ windows_wait (ops, minus_one_ptid, &status, 0);
+
+ /* Note windows_wait returns TARGET_WAITKIND_SPURIOUS for thread
+ events. */
+ if (status.kind != TARGET_WAITKIND_LOADED
+ && status.kind != TARGET_WAITKIND_SPURIOUS)
break;
+
+ windows_resume (ops, minus_one_ptid, 0, GDB_SIGNAL_0);
}
/* Now that the inferior has been started and all DLLs have been mapped,
@@ -1711,8 +1714,6 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
windows_add_all_dlls ();
windows_initialization_done = 1;
- inf->control.stop_soon = NO_STOP_QUIETLY;
- stop_after_trap = 0;
return;
}
--
1.9.3
next prev parent reply other threads:[~2015-10-16 16:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 17:02 [PATCH 0/7] Replace continuations with an extendable "class" Pedro Alves
2015-08-12 17:02 ` [PATCH 3/7] Convert infcalls to thread_fsm mechanism Pedro Alves
2015-08-12 17:02 ` [PATCH 2/7] Replace "struct continuation" mechanism by something more extensible Pedro Alves
2015-08-18 12:50 ` Yao Qi
2015-08-19 14:55 ` Pedro Alves
2015-08-12 17:02 ` [PATCH 1/7] Merge async and sync code paths some more Pedro Alves
2015-08-12 19:48 ` Simon Marchi
2015-08-17 17:54 ` Pedro Alves
2015-08-17 19:28 ` Simon Marchi
2015-08-18 10:48 ` Yao Qi
2015-08-19 14:11 ` Pedro Alves
2015-08-27 13:26 ` Yao Qi
2015-10-16 0:35 ` Joel Brobecker
2015-10-16 12:24 ` Pedro Alves
2015-10-16 16:22 ` Joel Brobecker
2015-10-16 16:37 ` Pedro Alves [this message]
2015-10-16 17:05 ` Joel Brobecker
2015-10-22 16:18 ` Pedro Alves
2015-08-12 17:02 ` [PATCH 4/7] Convert the until/advance commands to thread_fsm mechanism Pedro Alves
2015-08-12 17:11 ` [PATCH 6/7] Garbage collect thread continuations Pedro Alves
2015-08-12 17:11 ` [PATCH 5/7] Garbage collect dummy_frame_ctx_saver Pedro Alves
2015-08-12 17:11 ` [PATCH 7/7] Delete enum inferior_event_handler::INF_TIMER Pedro Alves
2015-08-18 11:22 ` Yao Qi
2015-08-18 12:52 ` [PATCH 0/7] Replace continuations with an extendable "class" Yao Qi
2015-08-19 14:56 ` Pedro Alves
2015-09-09 17:33 ` Pedro Alves
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=562127AB.4050303@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--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