From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers
Date: Sat, 6 Mar 2021 18:40:57 +0100 [thread overview]
Message-ID: <20210306174102.21597-8-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210306174102.21597-1-ssbssa@yahoo.de>
---
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
next prev 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 ` [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 ` Hannes Domani [this message]
2021-03-11 21:47 ` [PATCH 17/22] Use the raw flag of automatic display to disable pretty printers 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-8-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).