public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 10/22] Add optional styled argument to gdb.execute
       [not found] <20210306174102.21597-1-ssbssa.ref@yahoo.de>
@ 2021-03-06 17:40 ` Hannes Domani
  2021-03-06 17:40   ` [PATCH 11/22] Use styled argument of gdb.execute() for cccw command Hannes Domani
                     ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

This makes it possible to use the colored output of commands, e.g. for
a custom TuiWindow.

gdb/ChangeLog:

2020-12-29  Hannes Domani  <ssbssa@yahoo.de>

	* cli/cli-script.c (execute_control_commands_to_string): Use
	styled argument.
	* cli/cli-script.h (execute_control_commands_to_string): Add
	styled argument.
	* python/python.c (execute_gdb_command): Parse "styled" argument.

gdb/doc/ChangeLog:

2020-12-29  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (Basic Python): Document "styled" argument.
---
 gdb/cli/cli-script.c |  4 ++--
 gdb/cli/cli-script.h |  2 +-
 gdb/doc/python.texi  |  6 +++++-
 gdb/python/python.c  | 24 ++++++++++++++++++------
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 9d0dd7796e0..8729c7c7132 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -422,13 +422,13 @@ execute_control_commands (struct command_line *cmdlines, int from_tty)
 
 std::string
 execute_control_commands_to_string (struct command_line *commands,
-				    int from_tty)
+				    int from_tty, bool styled)
 {
   /* GDB_STDOUT should be better already restored during these
      restoration callbacks.  */
   set_batch_flag_and_restore_page_info save_page_info;
 
-  string_file str_file;
+  string_file str_file (styled);
 
   {
     current_uiout->redirect (&str_file);
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index 8624bf55839..57cfff4ba33 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -135,7 +135,7 @@ extern void execute_control_commands (struct command_line *cmdlines,
    will be temporarily set to true.  */
 
 extern std::string execute_control_commands_to_string
-    (struct command_line *commands, int from_tty);
+    (struct command_line *commands, int from_tty, bool styled = false);
 
 /* Exported to gdb/breakpoint.c */
 
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 97a28d054fa..565e87d0784 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -217,7 +217,7 @@ A string containing the python directory (@pxref{Python}).
 @end defvar
 
 @findex gdb.execute
-@defun gdb.execute (command @r{[}, from_tty @r{[}, to_string@r{]]})
+@defun gdb.execute (command @r{[}, from_tty @r{[}, to_string @r{[}, styled@r{]]]})
 Evaluate @var{command}, a string, as a @value{GDBN} CLI command.
 If a GDB exception happens while @var{command} runs, it is
 translated as described in @ref{Exception Handling,,Exception Handling}.
@@ -234,6 +234,10 @@ returned as a string.  The default is @code{False}, in which case the
 return value is @code{None}.  If @var{to_string} is @code{True}, the
 @value{GDBN} virtual terminal will be temporarily set to unlimited width
 and height, and its pagination will be disabled; @pxref{Screen Size}.
+
+If both @var{to_string} and @var{styled} are @code{True}, then the returned
+string also contains the ANSI terminal escape styling sequences used for
+colored output.
 @end defun
 
 @findex gdb.breakpoints
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 009c0c4c6d7..e4e00e4627c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -574,13 +574,15 @@ static PyObject *
 execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
 {
   const char *arg;
-  PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
-  int from_tty, to_string;
-  static const char *keywords[] = { "command", "from_tty", "to_string", NULL };
+  PyObject *from_tty_obj = NULL, *to_string_obj = NULL, *styled_obj = NULL;
+  int from_tty, to_string, styled;
+  static const char *keywords[] = { "command", "from_tty", "to_string",
+				    "styled", NULL };
 
-  if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
+  if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg,
 					&PyBool_Type, &from_tty_obj,
-					&PyBool_Type, &to_string_obj))
+					&PyBool_Type, &to_string_obj,
+					&PyBool_Type, &styled_obj))
     return NULL;
 
   from_tty = 0;
@@ -601,6 +603,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       to_string = cmp;
     }
 
+  styled = 0;
+  if (styled_obj)
+    {
+      int cmp = PyObject_IsTrue (styled_obj);
+      if (cmp < 0)
+	return NULL;
+      styled = cmp;
+    }
+
   std::string to_string_res;
 
   scoped_restore preventer = prevent_dont_repeat ();
@@ -638,7 +649,8 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
 
 	if (to_string)
 	  to_string_res = execute_control_commands_to_string (lines.get (),
-							      from_tty);
+							      from_tty,
+							      styled);
 	else
 	  execute_control_commands (lines.get (), from_tty);
       }
-- 
2.30.1


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

* [PATCH 11/22] Use styled argument of gdb.execute() for cccw command
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
@ 2021-03-06 17:40   ` Hannes Domani
  2021-03-06 17:40   ` [PATCH 12/22] Add optional full_window argument to TuiWindow.write Hannes Domani
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/python/lib/gdb/command/tui_windows.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
index 3177e601341..3769c84138f 100644
--- a/gdb/python/lib/gdb/command/tui_windows.py
+++ b/gdb/python/lib/gdb/command/tui_windows.py
@@ -712,7 +712,7 @@ class CustomCommandWindow(TextWindow):
         self.lines = []
         for c in self.commands:
             try:
-                self.lines.extend([octal_escape(l) for l in gdb.execute(c, to_string=True).split("\n")])
+                self.lines.extend([octal_escape(l) for l in gdb.execute(c, to_string=True, styled=True).split("\n")])
                 if (self.lines and not self.lines[-1]):
                     del self.lines[-1]
             except:
-- 
2.30.1


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

* [PATCH 12/22] Add optional full_window argument to TuiWindow.write
  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   ` 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
                     ` (8 subsequent siblings)
  10 siblings, 2 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

To prevent flickering when first calling erase, then write, this new
argument indicates that the passed string contains the full contents of
the window.  This fills every unused cell of the window with a space, so
it's not necessary to call erase beforehand.
---
 gdb/doc/python.texi |  6 +++++-
 gdb/python/py-tui.c | 17 ++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 565e87d0784..0e613d564e5 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5876,10 +5876,14 @@ displayed above the window.  This attribute can be modified.
 Remove all the contents of the window.
 @end defun
 
-@defun TuiWindow.write (@var{string})
+@defun TuiWindow.write (@var{string} @r{[}, @var{full_window}@r{]})
 Write @var{string} to the window.  @var{string} can contain ANSI
 terminal escape styling sequences; @value{GDBN} will translate these
 as appropriate for the terminal.
+
+If the @var{full_window} parameter is @code{True}, then @var{string}
+contains the full contents of the window.  This is similar to calling
+@code{erase} before @code{write}, but avoids the flickering.
 @end defun
 
 The factory function that you supply should return an object
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 02dcd6949df..e0522f65a99 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -114,7 +114,7 @@ class tui_py_window : public tui_win_info
   }
 
   /* Write STR to the window.  */
-  void output (const char *str);
+  void output (const char *str, bool full_window);
 
   /* A helper function to compute the viewport width.  */
   int viewport_width () const
@@ -246,12 +246,18 @@ tui_py_window::click (int mouse_x, int mouse_y, int mouse_button)
 }
 
 void
-tui_py_window::output (const char *text)
+tui_py_window::output (const char *text, bool full_window)
 {
   if (m_inner_window != nullptr)
     {
+      if (full_window)
+	werase (m_inner_window.get ());
+
       tui_puts (text, m_inner_window.get ());
-      tui_wrefresh (m_inner_window.get ());
+      if (full_window)
+	check_and_display_highlight_if_needed ();
+      else
+	tui_wrefresh (m_inner_window.get ());
     }
 }
 
@@ -422,13 +428,14 @@ gdbpy_tui_write (PyObject *self, PyObject *args)
 {
   gdbpy_tui_window *win = (gdbpy_tui_window *) self;
   const char *text;
+  int full_window = 0;
 
-  if (!PyArg_ParseTuple (args, "s", &text))
+  if (!PyArg_ParseTuple (args, "s|i", &text, &full_window))
     return nullptr;
 
   REQUIRE_WINDOW (win);
 
-  win->window->output (text);
+  win->window->output (text, full_window);
 
   Py_RETURN_NONE;
 }
-- 
2.30.1


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

* [PATCH 13/22] Use the full_window argument of TuiWindow.write to prevent flickering
  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 17:40   ` Hannes Domani
  2021-03-06 17:40   ` [PATCH 14/22] Add set_tui_auto_display python function Hannes Domani
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/python/lib/gdb/command/tui_windows.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
index 3769c84138f..f539abf6724 100644
--- a/gdb/python/lib/gdb/command/tui_windows.py
+++ b/gdb/python/lib/gdb/command/tui_windows.py
@@ -112,9 +112,10 @@ class TextWindow(object):
         stop = self.line_ofs + self.win.height
         if stop > l:
             stop = l
-        self.win.erase()
         if stop > start:
-            self.win.write("".join([escaped_substr(l, self.col_ofs, self.win.width) for l in self.lines[start:stop]]))
+            self.win.write("".join([escaped_substr(l, self.col_ofs, self.win.width) for l in self.lines[start:stop]]), True)
+        else:
+            self.win.erase()
 
 
 def is_string_instance(s):
-- 
2.30.1


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

* [PATCH 14/22] Add set_tui_auto_display python function
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (2 preceding siblings ...)
  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
  2021-03-06 17:40   ` [PATCH 15/22] Disable automatic display while the display window is active Hannes Domani
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 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


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

* [PATCH 15/22] Disable automatic display while the display window is active
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (3 preceding siblings ...)
  2021-03-06 17:40   ` [PATCH 14/22] Add set_tui_auto_display python function Hannes Domani
@ 2021-03-06 17:40   ` Hannes Domani
  2021-03-06 17:40   ` [PATCH 16/22] Show raw flag in info display Hannes Domani
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/python/lib/gdb/command/tui_windows.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
index f539abf6724..bd885e7e168 100644
--- a/gdb/python/lib/gdb/command/tui_windows.py
+++ b/gdb/python/lib/gdb/command/tui_windows.py
@@ -550,6 +550,11 @@ class DisplayWindow(VariableWindow):
     def __init__(self, win):
         super(DisplayWindow, self).__init__(win, "display", "dv")
         self.disp_re = re.compile('^(?P<num>\d+): +(?P<enabled>[yn]) +(?P<fmt>\/\w+ +)?(?P<expr>.*)')
+        gdb.set_tui_auto_display(False)
+
+    def close(self):
+        VariableWindow.close(self)
+        gdb.set_tui_auto_display(True)
 
     def variables(self):
         thread = gdb.selected_thread()
-- 
2.30.1


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

* [PATCH 16/22] Show raw flag in info display
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (4 preceding siblings ...)
  2021-03-06 17:40   ` [PATCH 15/22] Disable automatic display while the display window is active Hannes Domani
@ 2021-03-06 17:40   ` Hannes Domani
  2021-03-06 17:40   ` [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers Hannes Domani
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/printcmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 92ca53cb1c6..26738558f99 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2163,7 +2163,9 @@ Num Enb Expression\n"));
 	printf_filtered ("/%d%c%c ", d->format.count, d->format.size,
 			 d->format.format);
       else if (d->format.format)
-	printf_filtered ("/%c ", d->format.format);
+	printf_filtered ("/%s%c ", d->format.raw ? "r" : "", d->format.format);
+      else if (d->format.raw)
+	printf_filtered ("/r ");
       puts_filtered (d->exp_string.c_str ());
       if (d->block && !contained_in (get_selected_block (0), d->block, true))
 	printf_filtered (_(" (cannot be evaluated in the current context)"));
-- 
2.30.1


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

* [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (5 preceding siblings ...)
  2021-03-06 17:40   ` [PATCH 16/22] Show raw flag in info display Hannes Domani
@ 2021-03-06 17:40   ` 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
                     ` (3 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/python/lib/gdb/command/tui_windows.py | 51 ++++++++++++++---------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
index bd885e7e168..f6e10500db7 100644
--- a/gdb/python/lib/gdb/command/tui_windows.py
+++ b/gdb/python/lib/gdb/command/tui_windows.py
@@ -201,21 +201,24 @@ class VariableWindow(TextWindow):
             value = v.value()
             sym_not_init = False
             num = 0
+            raw = False
             fmt = None
             error = None
             if hasattr(v, "undeclared"):
                 sym_not_init = v.undeclared()
             if hasattr(v, "number"):
                 num = v.number()
+            if hasattr(v, "raw"):
+                raw = v.raw()
             if hasattr(v, "format"):
                 fmt = v.format()
             if hasattr(v, "error"):
                 error = v.error()
-            self.add_val(name, name, value, 0, num, cur_vals, keep_prev, False, sym_not_init, fmt, True, error)
+            self.add_val(name, name, value, 0, num, cur_vals, keep_prev, False, sym_not_init, raw, fmt, True, error)
         self.prev_vals = cur_vals
         self.redraw()
 
-    def add_val(self, n, fn, v, inset, num, cur_vals, keep_prev, def_expand, sym_not_init, fmt, dyn_type, error):
+    def add_val(self, n, fn, v, inset, num, cur_vals, keep_prev, def_expand, sym_not_init, raw, fmt, dyn_type, error):
         n2 = fn
         if inset == 0:
             if num == 0:
@@ -277,11 +280,11 @@ class VariableWindow(TextWindow):
             try:
                 is_optimized_out = v.is_optimized_out
             except:
-                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, fmt, False, str(sys.exc_info()[1]))
+                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, raw, fmt, False, str(sys.exc_info()[1]))
                 return
 
             if is_optimized_out and v.type.strip_typedefs().code not in [gdb.TYPE_CODE_STRUCT, gdb.TYPE_CODE_UNION]:
-                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, fmt, False, "optimized out")
+                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, raw, fmt, False, "optimized out")
                 return
 
             v_addr = v.address
@@ -296,10 +299,12 @@ class VariableWindow(TextWindow):
             if cv is not None and cv.address == v_addr.address and cv.type == v_addr.type:
                 cv_str = " = \033[1;36m$" + self.convenience_name + "\033[0m"
 
-        try:
-            pp = gdb.default_visualizer(v)
-        except:
-            pp = None
+        pp = None
+        if not raw:
+            try:
+                pp = gdb.default_visualizer(v)
+            except:
+                pp = None
         if pp:
             valstr = None
             try:
@@ -379,19 +384,19 @@ class VariableWindow(TextWindow):
                                     if key_prev is not None and "\n" in key_prev:
                                         key_prev = None
                                     if key_prev is None:
-                                        self.add_val("key", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, fmt, True, None)
+                                        self.add_val("key", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, True, None)
                                 else:
                                     if key_prev is not None:
-                                        self.add_val("[" + str(key_prev) + "]", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, fmt, True, None)
+                                        self.add_val("[" + str(key_prev) + "]", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, True, None)
                                     else:
-                                        self.add_val("value", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, fmt, True, None)
+                                        self.add_val("value", fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, True, None)
                         else:
                             for c in childs:
                                 (nc, vc) = c
                                 fnc = ":".join([n2, nc])
-                                self.add_val(nc, fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, fmt, True, None)
+                                self.add_val(nc, fnc, vc, inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, True, None)
             except:
-                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, fmt, False, str(sys.exc_info()[1]))
+                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, raw, fmt, False, str(sys.exc_info()[1]))
             return
 
         t = v.type.strip_typedefs()
@@ -439,7 +444,7 @@ class VariableWindow(TextWindow):
                 self.line_names.append(n2)
                 cur_entry[1] = valstr
             except:
-                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, fmt, False, str(sys.exc_info()[1]))
+                self.add_val(n, fn, None, inset, num, cur_vals, keep_prev, False, sym_not_init, raw, fmt, False, str(sys.exc_info()[1]))
                 return
         else:
             (var_col_s, var_col_e, val_col_s, val_col_e) = val_cmp_color(prev_val, False)
@@ -458,7 +463,7 @@ class VariableWindow(TextWindow):
             for i in range(low, high + 1):
                 nc = "[%d]" % i
                 fnc = ":".join([n2, nc])
-                self.add_val(nc, fnc, v[i], inset + 1, 0, cur_vals, keep_prev, False, False, fmt, True, None)
+                self.add_val(nc, fnc, v[i], inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, True, None)
             return
 
         if is_ptr:
@@ -468,7 +473,7 @@ class VariableWindow(TextWindow):
                 v = v.dereference()
             except:
                 v = None
-            self.add_val(nc, fnc, v, inset + 1, 0, cur_vals, keep_prev, target_type.code != gdb.TYPE_CODE_PTR, False, fmt, True, None)
+            self.add_val(nc, fnc, v, inset + 1, 0, cur_vals, keep_prev, target_type.code != gdb.TYPE_CODE_PTR, False, raw, fmt, True, None)
             return
 
         fields = None
@@ -493,14 +498,15 @@ class VariableWindow(TextWindow):
                 vf = v[f]
                 fnc = ":".join([n2, n, "%d" % num])
                 num += 1
-                self.add_val(n, fnc, vf, inset + 1, 0, cur_vals, keep_prev, False, False, fmt, False, None)
+                self.add_val(n, fnc, vf, inset + 1, 0, cur_vals, keep_prev, False, False, raw, fmt, False, None)
 
 class VarNameValue(object):
-    def __init__(self, sym, val, undecl, num, fmt, err):
+    def __init__(self, sym, val, undecl, num, r, fmt, err):
         self.sym = sym
         self.val = val
         self.undecl = undecl
         self.num = num
+        self.r = r
         self.fmt = fmt
         self.err = err
 
@@ -516,6 +522,9 @@ class VarNameValue(object):
     def number(self):
         return self.num
 
+    def raw(self):
+        return self.r
+
     def format(self):
         return self.fmt
 
@@ -541,7 +550,7 @@ class LocalsWindow(VariableWindow):
                     for symbol in block:
                         if symbol.is_argument or symbol.is_variable:
                             sym_not_init = symbol.is_variable and symbol.line > 0 and cur_line <= symbol.line
-                            yield VarNameValue(symbol.name, symbol.value(frame), sym_not_init, 0, None, None)
+                            yield VarNameValue(symbol.name, symbol.value(frame), sym_not_init, 0, False, None, None)
                 if block.function:
                     break
                 block = block.superblock
@@ -573,6 +582,7 @@ class DisplayWindow(VariableWindow):
                     expr = expr[:-len(cant_eval_str)].strip()
                 v = None
                 sym_not_init = False
+                raw = False
                 fmt = None
                 error = None
                 if m.group("enabled") != "y":
@@ -580,6 +590,7 @@ class DisplayWindow(VariableWindow):
                 elif thread_valid and not cant_eval:
                     format_flags = m.group("fmt")
                     if format_flags:
+                        raw = "r" in format_flags
                         for f in format_flags:
                             if f in formats:
                                 fmt = f
@@ -597,7 +608,7 @@ class DisplayWindow(VariableWindow):
                     except:
                         v = None
                         error = str(sys.exc_info()[1])
-                yield VarNameValue(expr, v, sym_not_init, num, fmt, error)
+                yield VarNameValue(expr, v, sym_not_init, num, raw, fmt, error)
 
 
 template_re = None
-- 
2.30.1


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

* [PATCH 18/22] Update the source location with Frame.select
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (6 preceding siblings ...)
  2021-03-06 17:40   ` [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers Hannes Domani
@ 2021-03-06 17:40   ` 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
                     ` (2 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

If the optional argument is True, then the current source location is
also updated, the same as if 'frame #' were used.
With this, a following 'list' call will show the source location of the
current frame instead of the previous one, and the TUI source window is
also updated.

PR python/24534
---
 gdb/python/py-frame.c | 29 ++++++++++++++++++++++++++++-
 gdb/tui/tui-hooks.c   |  8 ++++++++
 gdb/tui/tui-hooks.h   |  2 ++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 8e32ba55de4..ef4eae1d745 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -28,6 +28,11 @@
 #include "symfile.h"
 #include "objfiles.h"
 
+#ifdef TUI
+#include "tui/tui.h"
+#include "tui/tui-hooks.h"
+#endif
+
 struct frame_object {
   PyObject_HEAD
   struct frame_id frame_id;
@@ -564,12 +569,34 @@ static PyObject *
 frapy_select (PyObject *self, PyObject *args)
 {
   struct frame_info *fi;
+  PyObject *update_sal_obj = NULL;
+
+  if (!PyArg_ParseTuple (args, "|O!", &PyBool_Type, &update_sal_obj))
+    return NULL;
+
+  int update_sal = 0;
+  if (update_sal_obj)
+    {
+      update_sal = PyObject_IsTrue (update_sal_obj);
+      if (update_sal < 0)
+	return NULL;
+    }
 
   try
     {
       FRAPY_REQUIRE_VALID (self, fi);
 
       select_frame (fi);
+
+      if (update_sal)
+	{
+	  set_current_sal_from_frame (fi);
+
+#ifdef TUI
+	  if (tui_active)
+	    tui_frame_changed ();
+#endif
+	}
     }
   catch (const gdb_exception &except)
     {
@@ -748,7 +775,7 @@ Return the frame's symtab and line." },
   { "read_var", frapy_read_var, METH_VARARGS,
     "read_var (variable) -> gdb.Value.\n\
 Return the value of the variable in this frame." },
-  { "select", frapy_select, METH_NOARGS,
+  { "select", frapy_select, METH_VARARGS,
     "Select this frame as the user's current frame." },
   {NULL}  /* Sentinel */
 };
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 2d7660acade..fa8f63e1146 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -187,6 +187,14 @@ tui_before_prompt (const char *current_gdb_prompt)
   from_source_symtab = false;
 }
 
+void
+tui_frame_changed (void)
+{
+  from_stack = true;
+  tui_refresh_frame_and_register_information ();
+  from_stack = false;
+}
+
 /* Observer for the normal_stop notification.  */
 
 static void
diff --git a/gdb/tui/tui-hooks.h b/gdb/tui/tui-hooks.h
index 11f8ef3d0d1..2ed2021cea6 100644
--- a/gdb/tui/tui-hooks.h
+++ b/gdb/tui/tui-hooks.h
@@ -20,6 +20,8 @@
 #ifndef TUI_TUI_HOOKS_H
 #define TUI_TUI_HOOKS_H
 
+extern void tui_frame_changed (void);
+
 extern void tui_install_hooks (void);
 extern void tui_remove_hooks (void);
 
-- 
2.30.1


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

* [PATCH 19/22] Refresh the TUI source window when changing the frame in the frame window
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (7 preceding siblings ...)
  2021-03-06 17:40   ` [PATCH 18/22] Update the source location with Frame.select Hannes Domani
@ 2021-03-06 17:40   ` 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
  10 siblings, 0 replies; 16+ messages in thread
From: Hannes Domani @ 2021-03-06 17:40 UTC (permalink / raw)
  To: gdb-patches

---
 gdb/python/lib/gdb/command/tui_windows.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
index f6e10500db7..92a7a2b2f01 100644
--- a/gdb/python/lib/gdb/command/tui_windows.py
+++ b/gdb/python/lib/gdb/command/tui_windows.py
@@ -670,7 +670,7 @@ class ThreadsWindow(TextWindow):
         line = y + self.line_ofs
         if button == 1 and line < len(self.threads):
             self.threads[line].switch()
-            gdb.selected_frame().select()
+            gdb.selected_frame().select(True)
             var_change_handler()
 
 
@@ -708,7 +708,7 @@ class FramesWindow(TextWindow):
     def click(self, x, y, button):
         line = y + self.line_ofs
         if button == 1 and line < len(self.frames):
-            self.frames[line].select()
+            self.frames[line].select(True)
             var_change_handler()
 
 
-- 
2.30.1


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

* Re: [PATCH 10/22] Add optional styled argument to gdb.execute
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (8 preceding siblings ...)
  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   ` Eli Zaretskii
  2021-03-08 10:01   ` Andrew Burgess
  10 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-06 18:13 UTC (permalink / raw)
  To: Hannes Domani; +Cc: gdb-patches

> Date: Sat,  6 Mar 2021 18:40:50 +0100
> From: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
> 
> This makes it possible to use the colored output of commands, e.g. for
> a custom TuiWindow.
> 
> gdb/ChangeLog:
> 
> 2020-12-29  Hannes Domani  <ssbssa@yahoo.de>
> 
> 	* cli/cli-script.c (execute_control_commands_to_string): Use
> 	styled argument.
> 	* cli/cli-script.h (execute_control_commands_to_string): Add
> 	styled argument.
> 	* python/python.c (execute_gdb_command): Parse "styled" argument.
> 
> gdb/doc/ChangeLog:
> 
> 2020-12-29  Hannes Domani  <ssbssa@yahoo.de>
> 
> 	* python.texi (Basic Python): Document "styled" argument.

OK for the documentation part.

Thanks.

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

* Re: [PATCH 12/22] Add optional full_window argument to TuiWindow.write
  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
  1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-06 18:13 UTC (permalink / raw)
  To: Hannes Domani; +Cc: gdb-patches

> Date: Sat,  6 Mar 2021 18:40:52 +0100
> From: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
> 
> To prevent flickering when first calling erase, then write, this new
> argument indicates that the passed string contains the full contents of
> the window.  This fills every unused cell of the window with a space, so
> it's not necessary to call erase beforehand.
> ---
>  gdb/doc/python.texi |  6 +++++-
>  gdb/python/py-tui.c | 17 ++++++++++++-----
>  2 files changed, 17 insertions(+), 6 deletions(-)

The documentation part is okay, thanks.

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

* Re: [PATCH 10/22] Add optional styled argument to gdb.execute
  2021-03-06 17:40 ` [PATCH 10/22] Add optional styled argument to gdb.execute Hannes Domani
                     ` (9 preceding siblings ...)
  2021-03-06 18:13   ` [PATCH 10/22] Add optional styled argument to gdb.execute Eli Zaretskii
@ 2021-03-08 10:01   ` Andrew Burgess
  10 siblings, 0 replies; 16+ messages in thread
From: Andrew Burgess @ 2021-03-08 10:01 UTC (permalink / raw)
  To: Hannes Domani; +Cc: gdb-patches

* Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> [2021-03-06 18:40:50 +0100]:

> This makes it possible to use the colored output of commands, e.g. for
> a custom TuiWindow.
> 
> gdb/ChangeLog:
> 
> 2020-12-29  Hannes Domani  <ssbssa@yahoo.de>
> 
> 	* cli/cli-script.c (execute_control_commands_to_string): Use
> 	styled argument.
> 	* cli/cli-script.h (execute_control_commands_to_string): Add
> 	styled argument.
> 	* python/python.c (execute_gdb_command): Parse "styled" argument.
> 
> gdb/doc/ChangeLog:
> 
> 2020-12-29  Hannes Domani  <ssbssa@yahoo.de>
> 
> 	* python.texi (Basic Python): Document "styled" argument.
> ---
>  gdb/cli/cli-script.c |  4 ++--
>  gdb/cli/cli-script.h |  2 +-
>  gdb/doc/python.texi  |  6 +++++-
>  gdb/python/python.c  | 24 ++++++++++++++++++------
>  4 files changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index 9d0dd7796e0..8729c7c7132 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -422,13 +422,13 @@ execute_control_commands (struct command_line *cmdlines, int from_tty)
>  
>  std::string
>  execute_control_commands_to_string (struct command_line *commands,
> -				    int from_tty)
> +				    int from_tty, bool styled)
>  {
>    /* GDB_STDOUT should be better already restored during these
>       restoration callbacks.  */
>    set_batch_flag_and_restore_page_info save_page_info;
>  
> -  string_file str_file;
> +  string_file str_file (styled);
>  
>    {
>      current_uiout->redirect (&str_file);
> diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
> index 8624bf55839..57cfff4ba33 100644
> --- a/gdb/cli/cli-script.h
> +++ b/gdb/cli/cli-script.h
> @@ -135,7 +135,7 @@ extern void execute_control_commands (struct command_line *cmdlines,
>     will be temporarily set to true.  */
>  
>  extern std::string execute_control_commands_to_string
> -    (struct command_line *commands, int from_tty);
> +    (struct command_line *commands, int from_tty, bool styled = false);

The comment immediately above this function needs updating.

>  
>  /* Exported to gdb/breakpoint.c */
>  
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index 97a28d054fa..565e87d0784 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -217,7 +217,7 @@ A string containing the python directory (@pxref{Python}).
>  @end defvar
>  
>  @findex gdb.execute
> -@defun gdb.execute (command @r{[}, from_tty @r{[}, to_string@r{]]})
> +@defun gdb.execute (command @r{[}, from_tty @r{[}, to_string @r{[}, styled@r{]]]})
>  Evaluate @var{command}, a string, as a @value{GDBN} CLI command.
>  If a GDB exception happens while @var{command} runs, it is
>  translated as described in @ref{Exception Handling,,Exception Handling}.
> @@ -234,6 +234,10 @@ returned as a string.  The default is @code{False}, in which case the
>  return value is @code{None}.  If @var{to_string} is @code{True}, the
>  @value{GDBN} virtual terminal will be temporarily set to unlimited width
>  and height, and its pagination will be disabled; @pxref{Screen Size}.
> +
> +If both @var{to_string} and @var{styled} are @code{True}, then the returned
> +string also contains the ANSI terminal escape styling sequences used for
> +colored output.

I think this leaves out a lot of information.  You need to mention
that `styled` is optional, and that the default is false.  You should
also be explicit that when `to_string` is false `styled` is ignored,
something like:

  The optional argument @var{styled} defaults to @code{True}.  If both
  @var{to_string} and @var{styled} are @code{True}, then the returned
  string also contains the ANSI terminal escape styling sequences used
  for colored output.  If @var{to_string} is @code{False} then
  @var{styled} is ignored.

>  @end defun
>  
>  @findex gdb.breakpoints
> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index 009c0c4c6d7..e4e00e4627c 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -574,13 +574,15 @@ static PyObject *
>  execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
>  {
>    const char *arg;
> -  PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
> -  int from_tty, to_string;
> -  static const char *keywords[] = { "command", "from_tty", "to_string", NULL };
> +  PyObject *from_tty_obj = NULL, *to_string_obj = NULL, *styled_obj = NULL;
> +  int from_tty, to_string, styled;

That `from_tty` and `to_string` are int is a legacy of GDB's past. The
new `styled` should be bool.

Thanks,
Andrew

> +  static const char *keywords[] = { "command", "from_tty", "to_string",
> +				    "styled", NULL };
>  
> -  if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
> +  if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg,
>  					&PyBool_Type, &from_tty_obj,
> -					&PyBool_Type, &to_string_obj))
> +					&PyBool_Type, &to_string_obj,
> +					&PyBool_Type, &styled_obj))
>      return NULL;
>  
>    from_tty = 0;
> @@ -601,6 +603,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
>        to_string = cmp;
>      }
>  
> +  styled = 0;
> +  if (styled_obj)
> +    {
> +      int cmp = PyObject_IsTrue (styled_obj);
> +      if (cmp < 0)
> +	return NULL;
> +      styled = cmp;
> +    }
> +
>    std::string to_string_res;
>  
>    scoped_restore preventer = prevent_dont_repeat ();
> @@ -638,7 +649,8 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
>  
>  	if (to_string)
>  	  to_string_res = execute_control_commands_to_string (lines.get (),
> -							      from_tty);
> +							      from_tty,
> +							      styled);
>  	else
>  	  execute_control_commands (lines.get (), from_tty);
>        }
> -- 
> 2.30.1
> 

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

* Re: [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers
  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
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2021-03-11 21:47 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> diff --git a/gdb/python/lib/gdb/command/tui_windows.py b/gdb/python/lib/gdb/command/tui_windows.py
Hannes> index bd885e7e168..f6e10500db7 100644
Hannes> --- a/gdb/python/lib/gdb/command/tui_windows.py
Hannes> +++ b/gdb/python/lib/gdb/command/tui_windows.py
Hannes> @@ -201,21 +201,24 @@ class VariableWindow(TextWindow):
Hannes>              value = v.value()
Hannes>              sym_not_init = False
Hannes>              num = 0
Hannes> +            raw = False

I guess what is going on here is that this is parsing the "info display"
output, and other patches arrange to disable the ordinary display.

I think the Python hook idea would be preferable.
"display" could pass a gdb.Value to Python, along with format info (or a
list of these).

What do you think?

Tom

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

* Re: [PATCH 12/22] Add optional full_window argument to TuiWindow.write
  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
  1 sibling, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2021-03-11 21:49 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> To prevent flickering when first calling erase, then write, this new
Hannes> argument indicates that the passed string contains the full contents of
Hannes> the window.  This fills every unused cell of the window with a space, so
Hannes> it's not necessary to call erase beforehand.

This seems reasonable to me.  I suppose the idea is that if you're
updating the window, and do w.erase() followed by a write, it will flicker.

At first I thought maybe this should be a new method, but in the end it
seems fine this way.

Tom

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

* Re: [PATCH 18/22] Update the source location with Frame.select
  2021-03-06 17:40   ` [PATCH 18/22] Update the source location with Frame.select Hannes Domani
@ 2021-03-11 21:53     ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2021-03-11 21:53 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> If the optional argument is True, then the current source location is
Hannes> also updated, the same as if 'frame #' were used.
Hannes> With this, a following 'list' call will show the source location of the
Hannes> current frame instead of the previous one, and the TUI source window is
Hannes> also updated.

Hannes> +      if (update_sal)
Hannes> +	{
Hannes> +	  set_current_sal_from_frame (fi);
Hannes> +
Hannes> +#ifdef TUI
Hannes> +	  if (tui_active)
Hannes> +	    tui_frame_changed ();
Hannes> +#endif

I'm not sure this is the correct way to do this.
Maybe you need to do what frame_command_core does:

  if (get_selected_frame () != prev_frame)
    gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);

Tom

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

end of thread, other threads:[~2021-03-11 21:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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   ` [PATCH 14/22] Add set_tui_auto_display python function Hannes Domani
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

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).