Enhancement - show old and new thread info when switching during debugging

pfee
2011-07-29T13:59:34Z

Hello all,

The following patch is also attached to bug 13042.
http://sourceware.org/bugzilla/show_bug.cgi?id=13042

It gives the user info about the thread they're switching from in addition to
that which they're switching to. This is useful if the switch was not intended
and

they wish to continue debugging the old thread.

Thanks,
Paul

2011-07-29 Paul Fee <pfee@talk21.com>

* infrun.c (normal_stop): Output information about previous thread when
switching

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.497
diff -u -r1.497 infrun.c
--- infrun.c 21 Jul 2011 23:46:09 -0000 1.497
+++ infrun.c 29 Jul 2011 13:54:44 -0000
@@ -5770,9 +5770,12 @@
&& last.kind != TARGET_WAITKIND_SIGNALLED
&& last.kind != TARGET_WAITKIND_EXITED)
{
+ const char* previous_pid_str = strdup (target_pid_to_str
(previous_inferior_ptid));
target_terminal_ours_for_output ();
- printf_filtered (_("[Switching to %s]\n"),
- target_pid_to_str (inferior_ptid));
+ printf_filtered (_("[Switching from %s to %s]\n"),
+ previous_pid_str,
+ target_pid_to_str (inferior_ptid));
+ free ((void*)previous_pid_str);
annotate_thread_changed ();
previous_inferior_ptid = inferior_ptid;
}