Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] mi: Restore original thread/frame when specifying --thread or --thread-group
Date: Fri, 05 Aug 2016 17:26:00 -0000	[thread overview]
Message-ID: <d46a5782-165d-2f73-a937-2b6f38c0949a@redhat.com> (raw)
In-Reply-To: <9a530702-6889-0d20-0a20-fcbce3cd57e2@ericsson.com>

On 08/03/2016 11:20 PM, Simon Marchi wrote:
> > On 16-08-03 09:41 AM, Pedro Alves wrote:

> I tried to set command_changes_user_selected_thread in normal_stop, but it didn't work
> right away.  That's because a breakpoint hit during an infcall calls error(), and the code
> that discards the cleanup when command_changes_user_selected_thread is true is not executed.
> 
> I solved that by adding a try/catch in mi_cmd_execute that discards the cleanup and rethrows
> the exception.

Yeah.  The approach of extending the previous_inferior_ptid's scope a bit would
avoid this, since it wouldn't need to revert back anything with a cleanup.
Might end up being that once all the spots are identified, switching to
the other approach ends up being a simpler patch.

> 
>> E.g., this user-defined command starts the program and stops in
>> thread 2.1, but MI still reverts back to the "--thread" thread:

...

> I was surprised this wasn't automatically solved with the fix in normal_stop.  That's
> because "start" sets previous_inferior_ptid to the initial thread when it is started
> (in init_wait_for_inferior).  Actually, I think that starting a new inferior is a case
> where we want to change the user selected thread.  Setting command_changes_user_selected_thread
> in init_wait_for_inferior fixes this.

Right.

> Here's an updated patch.  Notes/todo:
> 
>  - I did not test with compile yet.
>  - I thought about that just before sending: I think there's also something to do about
>    "frame X", "up" and "down", e.g.:
> 
>    -interpreter-exec --thread 1 console "up"
> 
>    won't work.

Sounds like it.  And don't we need a similar treatment for --frame ?

Thanks,
Pedro Alves


  reply	other threads:[~2016-08-05 17:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 21:14 [PATCH 0/2] Two MI changes related to separate UIs Simon Marchi
2016-08-01 21:15 ` [PATCH 2/2] mi: Add launch-type={run,attach} in =thread-group-started Simon Marchi
2016-08-02 14:49   ` Eli Zaretskii
2016-08-02 15:55     ` Simon Marchi
2016-08-17 20:17   ` Simon Marchi
2016-08-01 21:15 ` [PATCH 1/2] mi: Restore original thread/frame when specifying --thread or --thread-group Simon Marchi
2016-08-02 14:49   ` Pedro Alves
2016-08-02 17:45     ` Simon Marchi
2016-08-02 22:32       ` Simon Marchi
2016-08-03 13:41         ` Pedro Alves
2016-08-03 22:24           ` Simon Marchi
2016-08-05 17:26             ` Pedro Alves [this message]
2016-08-05 21:01               ` Simon Marchi
2016-08-17 20:24                 ` Simon Marchi

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=d46a5782-165d-2f73-a937-2b6f38c0949a@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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