public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/30353] [gdb/cli] segfault on -eiex "set editing off"
Date: Mon, 17 Apr 2023 09:31:45 +0000	[thread overview]
Message-ID: <bug-30353-4717-KDqeCy9GeF@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30353-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30353

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
The easiest way to fix this is:
...
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 53ddd515be7..f6e92655b0d 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -287,7 +287,13 @@ change_line_handler (int editing)
   if (ui != main_ui)
     return;

-  /* Don't try enabling editing if the interpreter doesn't support it
+  if (top_level_interpreter () == nullptr || command_interp () == nullptr)
+    {
+      gdb_printf ("Cannot set editing to on or off, no interpreter yet.\n");
+      return;
+    }
+
+    /* 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 ()))
...
which gives us:
...
$ gdb -eiex "set editing off"
Cannot set editing to on or off, no interpreter yet.
(gdb) 
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-04-17  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 10:06 [Bug cli/30353] New: " vries at gcc dot gnu.org
2023-04-14 10:09 ` [Bug cli/30353] " vries at gcc dot gnu.org
2023-04-17  9:31 ` vries at gcc dot gnu.org [this message]
2023-04-17  9:46 ` vries at gcc dot gnu.org
2023-04-21  8:00 ` vries at gcc dot gnu.org

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=bug-30353-4717-KDqeCy9GeF@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).