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

pfee
2011-07-29T16:08:23Z

> > 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.
>
> Isn't that information already present in the previous "[Switching to
> thread ...]" message?

I've copied output from GDB 7.3 before and after my patch into the bug report
along with some notes on the implementation.

Without the patch the user is told what thread they're switching to, but not
what thread they're switching from, e.g.

[Switching to Thread 0x7ffff7fd6700 (LWP 4267)]
In a program with numerous threads, the old thread may be the one the user is
interested it. They may not have wanted to switch, but by chance the new thread
has hit a breakpoint. By giving information about what thread we're switching
away from, it becomes easier for the user to switch back to that thread and
ignore the accidental thread switch.

Example of new output:

[Switching from Thread 0x7ffff7fd8740 (LWP 4279) to Thread 0x7ffff7fd6700 (LWP
4282)]Thanks,
Paul