Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "pfee@talk21.com" <pfee@talk21.com>,
	Joel Brobecker <brobecker@adacore.com>,
	Tom Tromey <tromey@redhat.com>
Subject: Re: Enhancement - show old and new thread info when switching during debugging
Date: Mon, 08 Aug 2011 15:07:00 -0000	[thread overview]
Message-ID: <201108081606.58401.pedro@codesourcery.com> (raw)
In-Reply-To: <1312803282.12167.YahooMailRC@web86707.mail.ird.yahoo.com>

Hellow,

On Monday 08 August 2011 12:34:42, pfee@talk21.com wrote:

> 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.

Sorry, but current_inferior_ptid for this will be even more confusing.
There's several current_FOO globals that represent the currently selected
state.  And one of them is "current_inferior".  Having current_inferior() return
one thing, and current_inferior_ptid mean another thing will be a recipe
for long term confusion.

> 
> By the way, I've made the patches against GDB trunk, I presume that's preferred 
> over GDB 7.3.

Yes, thanks.  7.3 is in maintenance mode now.  New features go to trunk.

>Content-Type: application/octet-stream; name="prev_thread.patch"
>Content-Transfer-Encoding: base64
>Content-Disposition: attachment; filename="prev_thread.patch"

Any chance you can convince your mailer to attach patches
with "Content-Type: text/x-patch" or some other text mime
type?  If you're using a web email account, I think that
means telling your browser the mime type of the ".patch"
extension.  If you can get it to not use base64, and use
"content-disposition: inline", you get extra bonus points.

> + /* Values move from interior_ptid to current_inferior_ptid to
> +  * previous_inferior_ptid.  The previous value is exposed to the
> +  * user through the $_prev_thread convenience variable.
> +  */

Plese no leading * on every comment line.  See other
comments, and follow the same style.

In order for this to be accepted, it will need some
documentation in the manual.

I'm not sure the variable is sufficiently well defined yet.
What does gdb print in this case?

 (gdb) thread 2
 (gdb) thread 3
 (gdb) p $_prev_thread

It feels like it should print thread 2, that is, we'd
define it to the thread the user last had selected,
and so:

 (gdb) thread $_prev_thread
 (gdb) thread $_prev_thread

would cycle between thread 2 and 3.

This definition works for non-stop mode as well.
Otherwise, as is, we get to define it as "the thread that
the user had selected the last time an execution command
was ran" (and the $_prev_thread is undefined/meaningless in
non-stop mode).

-- 
Pedro Alves


  reply	other threads:[~2011-08-08 15:07 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
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 [this message]
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=201108081606.58401.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pfee@talk21.com \
    --cc=tromey@redhat.com \
    /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