Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Denis PILAT <denis.pilat@st.com>
To: gdb-patches <gdb-patches@sourceware.org>
Cc: Denis PILAT <denis.pilat@st.com>
Subject: Re: [RFC] thread apply commands change selected frame
Date: Wed, 24 Jan 2007 10:42:00 -0000	[thread overview]
Message-ID: <45B73813.9060005@st.com> (raw)
In-Reply-To: <20070121173341.GG12463@nevyn.them.org>

Daniel Jacobowitz wrote:
> On Thu, Jan 11, 2007 at 12:24:35PM +0100, Denis PILAT wrote:
>> Hi everyone,
>>
>> I noticed a potential problem in thread.c: the "thread apply" commands 
>> change the selected frame, I think it should not.
>> If you are doing
>>    (gdb) up
>>    (gdb) thread apply all print 1
>>    (gdb) down
>> then the frame selected before the up is not being restored by the down, 
>> we have an error message instead.
>
> Yeah, that's a strange behavior.
>
>> I need your opinion before going ahead in this patch.
>
> It looks right to me.  With a ChangeLog entry and testsuite results
> from some target with threads, it would be OK to commit.
>
There is one regression in the last test of gdb.threads/threadapply.exp 
since this test does not expect to get the stack frame. With my patch 
the current stack frame is alway printed at the end of a thread apply 
command.
I also changed the semantic since I remove the print_stack_frame from 
the cleanup command so from the error treatment.

I don't catch the original behaviour: it seems to print the stack frame 
only if the last thread we switched to (in the loop) is not the one we 
were before. In that case the user see that because he is in thread 2 
before typing the command:

(gdb) thread apply all p 1
[New Thread 1077955504 (LWP 27106)]
Thread 3 (Thread 1077955504 (LWP 27106)):
$1 = 1
Thread 2 (Thread 1075854256 (LWP 27105)):
$2 = 1
Thread 1 (Thread 1073748160 (LWP 27045)):
$3 = 1
12                      fputc ('x', stderr);

This last line is not printed if current thread is 1 before typing the 
command, that means 3 last line are always inconsistent.

What behavior do we want in normal case (we retrieve the original 
thread) and in case where we can't since the thread has died for instance ?

-- 
Denis



  reply	other threads:[~2007-01-24 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-11 11:24 Denis PILAT
2007-01-21 17:33 ` Daniel Jacobowitz
2007-01-24 10:42   ` Denis PILAT [this message]
2007-01-31  8:58     ` Denis PILAT
2007-01-31 14:54       ` Daniel Jacobowitz
2007-01-31 19:30         ` Denis PILAT
2007-01-31 19:33           ` Daniel Jacobowitz
2007-02-01  9:49             ` [RFA] " Denis PILAT
2007-02-01 14:33               ` Daniel Jacobowitz
2007-02-02 12:40                 ` Denis PILAT

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=45B73813.9060005@st.com \
    --to=denis.pilat@st.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