From: Tomas Martinec <fyzmat@gmail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb@sourceware.org
Subject: Re: Stepping of multithreaded application
Date: Thu, 12 May 2011 10:45:00 -0000 [thread overview]
Message-ID: <BANLkTikJZTcQHMjbJacbx9U+8usn_ggxaw@mail.gmail.com> (raw)
In-Reply-To: <201105111829.15404.pedro@codesourcery.com>
>> That is not supported in the virtual machine
>> and the machine responds so. I believe not supporting the Hc0 command
>> is not wrong for the virtual machine.
>
> IMO, it's wrong. But I don't think it'd make a difference, unless
> the target gives preference to the already/previously selected
> Hg/c thread.
> In any case, you should really teach your VM about the vCont
> packet instead of 'Hc'/'s'/'c'.
I will implement both the Hc0 and vCont in the virtual machine. But at
first I will try to make just the Hc/s/c commands working.
> Please try the patch below. It's "any_thread_ptid" that causes "Hc0".
> If we're stepping, obviously we need to step the correct thread, not
> a random one. I don't really understand how this hasn't been a
> problem before.
There was another problem after applying the patch. The GDB resumed
the thread 1 after the thread 3 stepped. I think I have made a fix:
--- infrun_old.c 2010-08-31 21:31:23.000000000 +0200
+++ infrun.c 2011-05-12 12:20:15.000000000 +0200
@@ -3513,6 +3513,8 @@
singlestep_breakpoints_inserted_p = 0;
}
+ ecs->event_thread->trap_expected = 0;
+
/* Note: We do not call context_switch at this point, as the
context is already set up for stepping the original thread. */
switch_to_thread (deferred_step_ptid);
The trap_expected flag of the thread 1 was not cleared after the step
of thread 1. Therefore the code has run into the following branch
during step handling of the thread 3:
infrun.c: line 4182
/* In all-stop mode, if we're currently stepping but have stopped in
some other thread, we need to switch back to the stepped thread. */
if (!non_stop)
{
struct thread_info *tp;
tp = iterate_over_threads (currently_stepping_or_nexting_callback,
ecs->event_thread);
if (tp)
{
// this branch is done, which is wrong; it is done,
because the thread 1
// has trap_expected set and therefore the thread is
considered to be stepping
//
// the thread 1 is resumed in this branch; in my case
the thread 3 never finishes stepping
The debugging seems to be fine after applying my fix. Still I think
somebody more familiar with the GDB should review it.
Tomas
next prev parent reply other threads:[~2011-05-12 10:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-10 16:27 Tomas Martinec
2011-05-10 18:37 ` Pedro Alves
2011-05-11 6:06 ` Tomas Martinec
2011-05-11 17:29 ` Pedro Alves
2011-05-12 10:45 ` Tomas Martinec [this message]
2011-05-16 11:17 ` Pedro Alves
2011-05-16 15:23 ` Tomas Martinec
2011-05-17 12:03 ` Pedro Alves
2011-05-17 14:07 ` Tomas Martinec
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=BANLkTikJZTcQHMjbJacbx9U+8usn_ggxaw@mail.gmail.com \
--to=fyzmat@gmail.com \
--cc=gdb@sourceware.org \
--cc=pedro@codesourcery.com \
/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