public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 14/22] Add set_tui_auto_display python function
Date: Sat,  6 Mar 2021 18:40:54 +0100	[thread overview]
Message-ID: <20210306174102.21597-5-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210306174102.21597-1-ssbssa@yahoo.de>

---
 gdb/printcmd.c       | 10 ++++++++++
 gdb/python/python.c  | 26 ++++++++++++++++++++++++++
 gdb/tui/tui-interp.c |  4 +++-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 58e39c7365f..92ca53cb1c6 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1823,6 +1823,11 @@ display_and_x_command_completer (struct cmd_list_element *ignore,
 
 \f
 
+#ifdef TUI
+extern bool tui_active;
+extern bool tui_auto_display;
+#endif
+
 /* Add an expression to the auto-display chain.
    Specify the expression.  */
 
@@ -1863,6 +1868,11 @@ display_command (const char *arg, int from_tty)
 			current_program_space, tracker.block ());
   all_displays.emplace_back (newobj);
 
+#ifdef TUI
+  if (tui_active && !tui_auto_display)
+    from_tty = 0;
+#endif
+
   if (from_tty)
     do_one_display (newobj);
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index e4e00e4627c..d0b4581437a 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -961,6 +961,28 @@ gdbpy_invalidate_cached_frames (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+#ifdef TUI
+extern bool tui_auto_display;
+
+/* Submit an event to the gdb thread.  */
+static PyObject *
+gdbpy_set_tui_auto_display (PyObject *self, PyObject *args)
+{
+  PyObject *auto_display_obj = NULL;
+
+  if (!PyArg_ParseTuple (args, "O!", &PyBool_Type, &auto_display_obj))
+    return NULL;
+
+  int auto_display = PyObject_IsTrue (auto_display_obj);
+  if (auto_display < 0)
+    return NULL;
+
+  tui_auto_display = auto_display;
+
+  Py_RETURN_NONE;
+}
+#endif
+
 /* Read a file as Python code.
    This is the extension_language_script_ops.script_sourcer "method".
    FILE is the file to load.  FILENAME is name of the file FILE.
@@ -2131,6 +2153,10 @@ Set the value of the convenience variable $NAME." },
     METH_VARARGS | METH_KEYWORDS,
     "register_window_type (NAME, CONSTRUCSTOR) -> None\n\
 Register a TUI window constructor." },
+
+  { "set_tui_auto_display", gdbpy_set_tui_auto_display, METH_VARARGS,
+    "set_tui_auto_display (value) -> None\n\
+Set automatic display in TUI." },
 #endif	/* TUI */
 
   {NULL, NULL, 0, NULL}
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index f70e1a7b4c2..0e03a494c20 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -38,6 +38,7 @@
 /* Set to true when the TUI mode must be activated when we first start
    gdb.  */
 static bool tui_start_enabled = false;
+bool tui_auto_display = true;
 
 class tui_interp final : public cli_interp_base
 {
@@ -95,7 +96,8 @@ tui_on_normal_stop (struct bpstats *bs, int print_frame)
 
       thread = inferior_thread ();
       if (should_print_stop_to_console (interp, thread))
-	print_stop_event (tui->interp_ui_out ());
+	print_stop_event (tui->interp_ui_out (),
+			  !tui_active || tui_auto_display);
     }
 }
 
-- 
2.30.1


  parent reply	other threads:[~2021-03-06 17:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210306174102.21597-1-ssbssa.ref@yahoo.de>
2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
2021-03-06 17:40   ` [PATCH 11/22] Use styled argument of gdb.execute() for cccw command Hannes Domani
2021-03-06 17:40   ` [PATCH 12/22] Add optional full_window argument to TuiWindow.write Hannes Domani
2021-03-06 18:13     ` Eli Zaretskii
2021-03-11 21:49     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 13/22] Use the full_window argument of TuiWindow.write to prevent flickering Hannes Domani
2021-03-06 17:40   ` Hannes Domani [this message]
2021-03-06 17:40   ` [PATCH 15/22] Disable automatic display while the display window is active Hannes Domani
2021-03-06 17:40   ` [PATCH 16/22] Show raw flag in info display Hannes Domani
2021-03-06 17:40   ` [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers Hannes Domani
2021-03-11 21:47     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 18/22] Update the source location with Frame.select Hannes Domani
2021-03-11 21:53     ` Tom Tromey
2021-03-06 17:40   ` [PATCH 19/22] Refresh the TUI source window when changing the frame in the frame window Hannes Domani
2021-03-06 18:13   ` [PATCH 10/22] Add optional styled argument to gdb.execute Eli Zaretskii
2021-03-08 10:01   ` Andrew Burgess

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=20210306174102.21597-5-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@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).