This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> > What he wants is the last user selected thread, > > not the thread that happens to be current when switch_to_thread > > is called. > > > > - user resumes with thread 1 selected > > - thread 2 hits breakpoint, gdb switches to thread 2 > > - breakpoint doesn't cause stop, target is re-resumed > > - thread 3 hits breakpoint, gdb switches to thread 3 > > - breakpoint causes stop, previous_inferior_ptid is > > thread 1, but the last switch_to_thread would have > > recorded $previous_thread as thread 2 > > > > If you want a convenience variable, please model it on > > $_thread --- see end of thread.c:_initialize_thread. > > > > Note that the previously selected thread may not exist anymore, > > it may have exited meanwhile, for example, or the inferior > > exec'ed. > > > > -- > > Pedro Alves > > > > Hi Pedro, > > I agree with your example, the previous_inferior_ptid in infrun.c, >normal_stop() > > has the information I need. I'll try and use that to populate the new > convenience variable. > > I'll a try to construct a test program that creates a scenario where the > previous thread as died by the time normal_stop() executes. > Hello again, I've looked into convenience variables and have developed a new patch. The gdb output when switching threads is no longer altered, instead the $_prev_thread convenience variable can be used to switch back to the previous thread. When making this patch I renamed an existing variable from previous_inferior_ptid to current_inferior_ptid. That way we have values that move from inferior_ptid (the new ptid) to current_inferior_ptid and finally to previous_inferior_ptid (which is exposed via the convenience variable). This seemed better than leaving the variables names as was and introducing something confusing like previous_previous_inferior_ptid. By the way, I've made the patches against GDB trunk, I presume that's preferred over GDB 7.3. Comments welcome. Thanks, Paul 2011-08-08 Paul Fee <pfee@talk21.com> * inferior.h: Add function for handling $_prev_thread convenience variable * infrun.c: Rename previous_inferior_ptid to current_inferior_ptid. Add function for handling $_prev_thread convenience variable * thread.c: Add $_prev_thread convenience variable
Attachment:
prev_thread.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |