This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Eliminate tui_command_loop


On Sat, Sep 10, 2011 at 9:51 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Saturday 10 September 2011 13:46:22, Matt Rice wrote:
>
>> I suppose the right thing to do is add interp_set_uiout(interp, uiout)
>> so tui can control whatever its current_interpreter->interpreter_out field is.
>
> Yeah. ?Though I think making current_interpreter->interpreter_out a callback
> that returns the correct uiout instead is a bit better. ?One place less
> to store the uiout to use that way. ?(I wonder if we can make the tui return
> cli_out and friends when the TUI is off.)
>

good idea I think,  since sending the previous email, I'm also a
little worried about the inverse scenario though,
that current_uiout can become out of date, when we call tui_enable/tui_disable

it'd seem adding something
  current_uiout = current_interpreter->procs->ui_out_proc (current_interpreter);
in start_event_loop would get us back to where
tui_command_loop was when it set the current_uiout.

or something like:
interp_changed_ui_out(struct interp *interp)
{
  if (interp == current_interpreter)
    current_uiout = current_interpreter->procs->ui_out_proc
(current_interpreter);
}

(and calling that from tui_enable/tui_disable after setting tui_active)

I believe that this sort of current_uiout problem is going to be less apparent,

e.g. if we're using the cli out and we should be using the tui one we
may just get wrong behavior instead of a segfault because
a) tui_out contains cli_out_impl stuff, so the behaviour may even
appear correct.
b) because tui_old_uiout probably won't segfault somewhere random in
ncurses like tui_out does when we use the wrong one.

I haven't figured out a way to cause issues this way, but haven't
tried terribly hard,
testsuite/gdb.base/tui-layout.exp though does appear to get a stale
current_uiout because I added
some a gdb_assert though i'm not sure how long/if it is long enough to
cause problems.

I could easily be missing something though and it's fine.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]