Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: pfee@talk21.com
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Enhancement - show old and new thread info when switching during debugging
Date: Fri, 29 Jul 2011 17:47:00 -0000	[thread overview]
Message-ID: <1311957205.11694.YahooMailRC@web86707.mail.ird.yahoo.com> (raw)
In-Reply-To: <20110729161711.GI5177@adacore.com>

> > I've copied output from GDB 7.3 before and after my patch into the  bug

> > report along with some notes on the implementation.
> 
> I think I  understand what you are trying to say.  What I am saying is
> that you can  find which thread you switched from, by going up the
> debugger output until  you find a "[Switching to Thread ...]" message.
> So, the information is  already there. I agree it's not ultra convenient,
> but I personally think it's  better than your approach (the new message
> becomes way to long,  IMO).
> 
> In your case, if going up the output is not good enough, I  would
> suggest two alternative solutions, in order of preference:
>   -  Have GDB maintain variable $old_thread or $prev_thread that
>     you  can then use to switch to the previous thread;
> 
>       (gdb)  thread $old_thread
> 
>     would return you to the previous thread  before the switch.
>   - At least print the new thread ID first;

Ah, I see your point now also.

The previous "Switching to" message may be lost if the terminal output buffer 
isn't long enough.

I like your idea of being able to use a "thread $prev_thread" command.  That's 
better than my patch as I have printed out the hex target thread ID and decimal 
LWP numbers but not the GDB thread ID. It's the GDB thread ID that used with the 
"thread" command.  Hence even with my patch, the user would still have to issue 
"info threads", then match the LWP (or target ID) against GDB's ID.

However I don't currently know how to interact with GDB convenience variables.  
You second suggestion is to reorder the output e.g.

[Switching to Thread 0x7ffff7fd67000 (LWP 4282) from Thread 0x7ffff7fd8740 (LWP 
4279)]

That would be simple to do.  Would you recommend adjusting the printf statement 
or learning how to create a new convenience variable?

Thanks,
Paul


  reply	other threads:[~2011-07-29 16:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 15:29 pfee
2011-07-29 16:01 ` Joel Brobecker
2011-07-29 16:33   ` pfee
2011-07-29 17:38     ` Joel Brobecker
2011-07-29 17:47       ` pfee [this message]
2011-07-29 20:40         ` Philippe Waroquiers
2011-07-30  2:44   ` Tom Tromey
2011-07-30 11:39     ` Joel Brobecker
2011-07-30 11:44       ` Pedro Alves
2011-07-30 14:12         ` pfee
2011-08-08 11:35           ` pfee
2011-08-08 15:07             ` Pedro Alves
2011-08-08 15:20               ` pfee
2011-08-09 15:25                 ` pfee
2011-08-10 15:10                   ` Pedro Alves
2011-08-16 16:01                     ` pfee
2011-07-30 12:40       ` pfee
2011-07-30 11:32 ` Tom Tromey
2011-07-30 22:07 ` Jan Kratochvil

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=1311957205.11694.YahooMailRC@web86707.mail.ird.yahoo.com \
    --to=pfee@talk21.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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