public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gdb: remove interp_pre_command_loop
@ 2023-09-06 19:29 Simon Marchi
  2023-09-06 19:29 ` [PATCH 2/2] gdb: remove interp_supports_command_editing Simon Marchi
  2023-09-07 18:03 ` [PATCH 1/2] gdb: remove interp_pre_command_loop Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Marchi @ 2023-09-06 19:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

It is a trivial wrapper around the pre_command_loop method, remove it.

Change-Id: Idb2c61f9b68988528006a9a9b2b528f43781eef4
---
 gdb/interps.c | 10 ----------
 gdb/interps.h |  4 ----
 gdb/main.c    |  2 +-
 gdb/ui.c      |  2 +-
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/gdb/interps.c b/gdb/interps.c
index 7baa8491eb19..fa294dfa1a3d 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -262,16 +262,6 @@ command_interp (void)
     return current_ui->current_interpreter;
 }
 
-/* See interps.h.  */
-
-void
-interp_pre_command_loop (struct interp *interp)
-{
-  gdb_assert (interp != NULL);
-
-  interp->pre_command_loop ();
-}
-
 /* See interp.h  */
 
 int
diff --git a/gdb/interps.h b/gdb/interps.h
index c041d0d95b61..95a885d1b691 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -261,10 +261,6 @@ extern void clear_interpreter_hooks (void);
    if it uses GDB's own simplified form of readline.  */
 extern int interp_supports_command_editing (struct interp *interp);
 
-/* Called before starting an event loop, to give the interpreter a
-   chance to e.g., print a prompt.  */
-extern void interp_pre_command_loop (struct interp *interp);
-
 /* List the possible interpreters which could complete the given
    text.  */
 extern void interpreter_completer (struct cmd_list_element *ignore,
diff --git a/gdb/main.c b/gdb/main.c
index 3e93f5839472..cf46f6acb208 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -470,7 +470,7 @@ captured_command_loop ()
 
   /* Give the interpreter a chance to print a prompt, if necessary  */
   if (ui->prompt_state != PROMPT_BLOCKED)
-    interp_pre_command_loop (top_level_interpreter ());
+    top_level_interpreter ()->pre_command_loop ();
 
   /* Now it's time to start the event loop.  */
   start_event_loop ();
diff --git a/gdb/ui.c b/gdb/ui.c
index 5fe001262a83..38ec61ea6731 100644
--- a/gdb/ui.c
+++ b/gdb/ui.c
@@ -227,7 +227,7 @@ new_ui_command (const char *args, int from_tty)
 
     set_top_level_interpreter (interpreter_name);
 
-    interp_pre_command_loop (top_level_interpreter ());
+    top_level_interpreter ()->pre_command_loop ();
 
     /* Make sure the file is not closed.  */
     stream.release ();

base-commit: 313b2841b8e9046ea658104988e01bedf6148d5f
-- 
2.42.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gdb: remove interp_supports_command_editing
  2023-09-06 19:29 [PATCH 1/2] gdb: remove interp_pre_command_loop Simon Marchi
@ 2023-09-06 19:29 ` Simon Marchi
  2023-09-07 18:03   ` Tom Tromey
  2023-09-07 18:03 ` [PATCH 1/2] gdb: remove interp_pre_command_loop Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2023-09-06 19:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

It is a trivial wrapper around the supports_command_editing method,
remove it.

Change-Id: I0fe3d7dc69601b3b89f82e055f7fe3d4af1becf7
---
 gdb/event-top.c | 4 ++--
 gdb/interps.c   | 8 --------
 gdb/interps.h   | 4 ----
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/gdb/event-top.c b/gdb/event-top.c
index 005ef4b7054d..d1be23bcbe9b 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -299,8 +299,8 @@ change_line_handler (int editing)
 
   /* Don't try enabling editing if the interpreter doesn't support it
      (e.g., MI).  */
-  if (!interp_supports_command_editing (top_level_interpreter ())
-      || !interp_supports_command_editing (command_interp ()))
+  if (!top_level_interpreter ()->supports_command_editing ()
+      || !command_interp ()->supports_command_editing ())
     return;
 
   if (editing)
diff --git a/gdb/interps.c b/gdb/interps.c
index fa294dfa1a3d..adac98125239 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -262,14 +262,6 @@ command_interp (void)
     return current_ui->current_interpreter;
 }
 
-/* See interp.h  */
-
-int
-interp_supports_command_editing (struct interp *interp)
-{
-  return interp->supports_command_editing ();
-}
-
 /* interp_exec - This executes COMMAND_STR in the current 
    interpreter.  */
 
diff --git a/gdb/interps.h b/gdb/interps.h
index 95a885d1b691..287df2c8c810 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -257,10 +257,6 @@ extern struct interp *command_interp (void);
 
 extern void clear_interpreter_hooks (void);
 
-/* Returns true if INTERP supports using the readline library; false
-   if it uses GDB's own simplified form of readline.  */
-extern int interp_supports_command_editing (struct interp *interp);
-
 /* List the possible interpreters which could complete the given
    text.  */
 extern void interpreter_completer (struct cmd_list_element *ignore,
-- 
2.42.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gdb: remove interp_pre_command_loop
  2023-09-06 19:29 [PATCH 1/2] gdb: remove interp_pre_command_loop Simon Marchi
  2023-09-06 19:29 ` [PATCH 2/2] gdb: remove interp_supports_command_editing Simon Marchi
@ 2023-09-07 18:03 ` Tom Tromey
  2023-09-08  1:56   ` Simon Marchi
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2023-09-07 18:03 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> It is a trivial wrapper around the pre_command_loop method, remove it.

Makes sense to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gdb: remove interp_supports_command_editing
  2023-09-06 19:29 ` [PATCH 2/2] gdb: remove interp_supports_command_editing Simon Marchi
@ 2023-09-07 18:03   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-09-07 18:03 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> It is a trivial wrapper around the supports_command_editing method,
Simon> remove it.

Looks good.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gdb: remove interp_pre_command_loop
  2023-09-07 18:03 ` [PATCH 1/2] gdb: remove interp_pre_command_loop Tom Tromey
@ 2023-09-08  1:56   ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2023-09-08  1:56 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches; +Cc: Simon Marchi

On 9/7/23 14:03, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> It is a trivial wrapper around the pre_command_loop method, remove it.
> 
> Makes sense to me.
> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom

Thanks, pushed both patches.

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-08  1:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06 19:29 [PATCH 1/2] gdb: remove interp_pre_command_loop Simon Marchi
2023-09-06 19:29 ` [PATCH 2/2] gdb: remove interp_supports_command_editing Simon Marchi
2023-09-07 18:03   ` Tom Tromey
2023-09-07 18:03 ` [PATCH 1/2] gdb: remove interp_pre_command_loop Tom Tromey
2023-09-08  1:56   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).