[13/21] gdb/mi: use m_ui instead of current_ui in mi_interp::resume

Message ID 20230908190227.96319-14-simon.marchi@efficios.com
State New
Headers
Series ui / interp cleansup |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Simon Marchi Sept. 8, 2023, 6:23 p.m. UTC
  No behavior changes expected.

Change-Id: Ic379a18d6a6d83a55cd4a6d1239d4daa98966cc8
---
 gdb/mi/mi-interp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Comments

Andrew Burgess Sept. 12, 2023, 10:44 a.m. UTC | #1
Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

> No behavior changes expected.
>
> Change-Id: Ic379a18d6a6d83a55cd4a6d1239d4daa98966cc8
> ---
>  gdb/mi/mi-interp.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
> index f260d98837cf..b676e22f3550 100644
> --- a/gdb/mi/mi-interp.c
> +++ b/gdb/mi/mi-interp.c
> @@ -118,14 +118,13 @@ void
>  mi_interp::resume ()
>  {
>    struct mi_interp *mi = this;
> -  struct ui *ui = current_ui;
>  
>    /* As per hack note in mi_interpreter_init, swap in the output
>       channels... */
> -  gdb_setup_readline (ui, 0);
> +  gdb_setup_readline (m_ui, 0);
>  
> -  ui->call_readline = gdb_readline_no_editing_callback;
> -  ui->input_handler = mi_execute_command_input_handler;
> +  m_ui->call_readline = gdb_readline_no_editing_callback;
> +  m_ui->input_handler = mi_execute_command_input_handler;
>  
>    gdb_stdout = mi->out;

Same stdout question as for the previous two patches.

I'm wondering if we're going to have to live in some halfway house for a
while, in which case maybe we should be adding an assert like:

  gdb_assert (current_ui == m_ui);

Or maybe I've jut not understood something here (or maybe a later patch
fixes all this suff, and I'm just making noise).

Thanks,
Andrew

>    /* Route error and log output through the MI.  */
> -- 
> 2.42.0
  
Simon Marchi Sept. 12, 2023, 4:36 p.m. UTC | #2
On 9/12/23 06:44, Andrew Burgess via Gdb-patches wrote:
> Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> No behavior changes expected.
>>
>> Change-Id: Ic379a18d6a6d83a55cd4a6d1239d4daa98966cc8
>> ---
>>  gdb/mi/mi-interp.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
>> index f260d98837cf..b676e22f3550 100644
>> --- a/gdb/mi/mi-interp.c
>> +++ b/gdb/mi/mi-interp.c
>> @@ -118,14 +118,13 @@ void
>>  mi_interp::resume ()
>>  {
>>    struct mi_interp *mi = this;
>> -  struct ui *ui = current_ui;
>>  
>>    /* As per hack note in mi_interpreter_init, swap in the output
>>       channels... */
>> -  gdb_setup_readline (ui, 0);
>> +  gdb_setup_readline (m_ui, 0);
>>  
>> -  ui->call_readline = gdb_readline_no_editing_callback;
>> -  ui->input_handler = mi_execute_command_input_handler;
>> +  m_ui->call_readline = gdb_readline_no_editing_callback;
>> +  m_ui->input_handler = mi_execute_command_input_handler;
>>  
>>    gdb_stdout = mi->out;
> 
> Same stdout question as for the previous two patches.
> 
> I'm wondering if we're going to have to live in some halfway house for a
> while, in which case maybe we should be adding an assert like:
> 
>   gdb_assert (current_ui == m_ui);
> 
> Or maybe I've jut not understood something here (or maybe a later patch
> fixes all this suff, and I'm just making noise).

If I change those uses of gdb_stdout and friends, I think these methods
(init, resume, suspend) are pretty-much independent of global state.

Simon
  

Patch

diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index f260d98837cf..b676e22f3550 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -118,14 +118,13 @@  void
 mi_interp::resume ()
 {
   struct mi_interp *mi = this;
-  struct ui *ui = current_ui;
 
   /* As per hack note in mi_interpreter_init, swap in the output
      channels... */
-  gdb_setup_readline (ui, 0);
+  gdb_setup_readline (m_ui, 0);
 
-  ui->call_readline = gdb_readline_no_editing_callback;
-  ui->input_handler = mi_execute_command_input_handler;
+  m_ui->call_readline = gdb_readline_no_editing_callback;
+  m_ui->input_handler = mi_execute_command_input_handler;
 
   gdb_stdout = mi->out;
   /* Route error and log output through the MI.  */