Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info
Date: Tue, 02 Jun 2015 14:11:00 -0000	[thread overview]
Message-ID: <20150602141121.GP17330@embecosm.com> (raw)
In-Reply-To: <1433210261-18328-1-git-send-email-patrick@parcs.ath.cx>

* Patrick Palka <patrick@parcs.ath.cx> [2015-06-01 21:57:41 -0400]:

> Here is an example backtrace for when tui_show_frame_info() gets called
> while target_terminal_is_inferior() == 1:
> 
>   #1  0x00000000004988ee in tui_selected_frame_level_changed_hook (level=0)
>   #2  0x0000000000617b99 in select_frame (fi=0x18c9820)
>   #3  0x0000000000617c3f in get_selected_frame (message=message@entry=0x0)
>   #4  0x00000000004ce534 in update_watchpoint (b=b@entry=0x2d9a760,
>       reparse=reparse@entry=0)
>   #5  0x00000000004d625e in insert_breakpoints ()
>   #6  0x0000000000531cfe in keep_going (ecs=ecs@entry=0x7ffea7884ac0)
>   #7  0x00000000005326d7 in process_event_stop_test (ecs=ecs@entry=0x7ffea7884ac0)
>   #8  0x000000000053596e in handle_inferior_event_1 (ecs=0x7ffea7884ac0)
> 
> The fix is simple: call target_terminal_ours() before calling
> tui_show_frame_info() in TUI's frame-changed hook.

If we assume that somewhere down the call stack the terminal is
supposed to belong to the inferior, then does your patch not leave gdb
in the wrong state, where the terminal now belongs to gdb?

It feels like the terminal should probably have been claimed back by
gdb as soon as the inferior stopped, and should only be passed back to
the inferior just before it is resumed.

As an experiment, I replaced your call to target_terminal_ours with:
  gdb_assert (!target_terminal_is_inferior ());
in tui_selected_frame_level_changed_hook, this triggers frequently,
for example:
  file ~/hello.exe
  tui enable
  start

Thanks,
Andrew

> 
> gdb/ChangeLog:
> 
> 	* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call
> 	target_terminal_ours() before calling tui_show_frame_info().
> ---
>  gdb/tui/tui-hooks.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
> index e53f526..1eb5300 100644
> --- a/gdb/tui/tui-hooks.c
> +++ b/gdb/tui/tui-hooks.c
> @@ -132,6 +132,8 @@ tui_selected_frame_level_changed_hook (int level)
>    if (level < 0)
>      return;
>  
> +  target_terminal_ours ();
> +
>    fi = get_selected_frame (NULL);
>    /* Ensure that symbols for this frame are read in.  Also, determine
>       the source language of this frame, and switch to it if
> -- 
> 2.4.2.387.gf86f31a.dirty
> 


  reply	other threads:[~2015-06-02 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  1:57 Patrick Palka
2015-06-02 14:11 ` Andrew Burgess [this message]
2015-06-02 15:37   ` Patrick Palka
2015-06-02 15:53     ` Patrick Palka
2015-06-13 16:48       ` Patrick Palka
2015-06-15 15:09       ` Pedro Alves
2015-06-15 16:14         ` Patrick Palka

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=20150602141121.GP17330@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patrick@parcs.ath.cx \
    /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