This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Displaced stepping not always working as expected
On 09/21/2011 06:23 PM, Pedro Alves wrote:
> On Wednesday 21 September 2011 07:08:43, Yao Qi wrote:
>> The line of log looks strange to me. Why LWP 763 switch to itself?
>
> This is non-stop mode, and fetch_inferior_event always prints the
> "context switch":
>
> if (non_stop
> && ecs->ws.kind != TARGET_WAITKIND_IGNORE
> && ecs->ws.kind != TARGET_WAITKIND_EXITED
> && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
> /* In non-stop mode, each thread is handled individually. Switch
> early, so the global state is set correctly for this
> thread. */
> context_switch (ecs->ptid);
>
Pedro,
I don't quite understand this piece of code and the comments here, but I
think that debug log "context switch from Thread A to Thread A" is not
useful, if not confusing. How about this patch?
--
Yao (éå)
gdb/
* infrun.c (context_switch): Print debug message when switching to
a different thread.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9a2de5c..225034c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2852,7 +2852,7 @@ nullify_last_target_wait_ptid (void)
static void
context_switch (ptid_t ptid)
{
- if (debug_infrun)
+ if (debug_infrun && !ptid_equal (ptid, inferior_ptid))
{
fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
target_pid_to_str (inferior_ptid));