[19/21] gdb: pass down current_ui to set_top_level_interpreter

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

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Testing failed
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Testing failed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Testing failed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Testing failed

Commit Message

Simon Marchi Sept. 8, 2023, 6:23 p.m. UTC
  In preparation for making set_top_level_interpreter a method of struct
ui.

Change-Id: I9d1a67f01f49743ef72c002bd7876e6d2f97b77a
---
 gdb/interps.c | 6 +++---
 gdb/interps.h | 9 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
  

Comments

Simon Marchi Sept. 11, 2023, 3:15 p.m. UTC | #1
On 9/8/23 14:23, Simon Marchi via Gdb-patches wrote:
> In preparation for making set_top_level_interpreter a method of struct
> ui.
> 
> Change-Id: I9d1a67f01f49743ef72c002bd7876e6d2f97b77a
> ---
>  gdb/interps.c | 6 +++---
>  gdb/interps.h | 9 +++++----
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/gdb/interps.c b/gdb/interps.c
> index 465c174ea794..f954d503538c 100644
> --- a/gdb/interps.c
> +++ b/gdb/interps.c
> @@ -83,15 +83,15 @@ find_interp_factory (const char *name)
>  /* See interps.h.  */
>  
>  void
> -set_top_level_interpreter (const char *name)
> +set_top_level_interpreter (ui *ui, const char *name)
>  {
>    /* Find it.  */
> -  struct interp *interp = current_ui->lookup_interp (name);
> +  struct interp *interp = ui->lookup_interp (name);
>  
>    if (interp == NULL)
>      error (_("Interpreter `%s' unrecognized"), name);
>    /* Install it.  */
> -  current_ui->set_current_interpreter (interp, true);
> +  ui->set_current_interpreter (interp, true);
>  }
>  
>  void
> diff --git a/gdb/interps.h b/gdb/interps.h
> index 278ee5aff9a5..4c094bf33e32 100644
> --- a/gdb/interps.h
> +++ b/gdb/interps.h
> @@ -215,10 +215,11 @@ class interp : public intrusive_list_node<interp>
>    bool inited = false;
>  };
>  
> -/* Set the current UI's top level interpreter to the interpreter named
> -   NAME.  Throws an error if NAME is not a known interpreter or the
> -   interpreter fails to initialize.  */
> -extern void set_top_level_interpreter (const char *name);
> +/* Set UI's top level interpreter to the interpreter named NAME.
> +
> +   Throws an error if NAME is not a known interpreter or the interpreter fails
> +   to initialize.  */
> +extern void set_top_level_interpreter (ui *ui, const char *name);
>  
>  /* Temporarily set the current interpreter, and reset it on
>     destruction.  */
> -- 
> 2.42.0
> 

The Linaro CI helpfully built this patch series and found that this
patch misses updating the set_top_level_interpreter calls, so doesn't
build (the next patch fixes things up).  I have updated this patch
locally to pass current_ui to the places that call
set_top_level_interpreter.

Simon
  

Patch

diff --git a/gdb/interps.c b/gdb/interps.c
index 465c174ea794..f954d503538c 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -83,15 +83,15 @@  find_interp_factory (const char *name)
 /* See interps.h.  */
 
 void
-set_top_level_interpreter (const char *name)
+set_top_level_interpreter (ui *ui, const char *name)
 {
   /* Find it.  */
-  struct interp *interp = current_ui->lookup_interp (name);
+  struct interp *interp = ui->lookup_interp (name);
 
   if (interp == NULL)
     error (_("Interpreter `%s' unrecognized"), name);
   /* Install it.  */
-  current_ui->set_current_interpreter (interp, true);
+  ui->set_current_interpreter (interp, true);
 }
 
 void
diff --git a/gdb/interps.h b/gdb/interps.h
index 278ee5aff9a5..4c094bf33e32 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -215,10 +215,11 @@  class interp : public intrusive_list_node<interp>
   bool inited = false;
 };
 
-/* Set the current UI's top level interpreter to the interpreter named
-   NAME.  Throws an error if NAME is not a known interpreter or the
-   interpreter fails to initialize.  */
-extern void set_top_level_interpreter (const char *name);
+/* Set UI's top level interpreter to the interpreter named NAME.
+
+   Throws an error if NAME is not a known interpreter or the interpreter fails
+   to initialize.  */
+extern void set_top_level_interpreter (ui *ui, const char *name);
 
 /* Temporarily set the current interpreter, and reset it on
    destruction.  */