public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/target] Fix pretty-printer for MPX bnd registers
@ 2019-10-08  6:51 Tom de Vries
  2019-10-09 17:54 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2019-10-08  6:51 UTC (permalink / raw)
  To: gdb-patches

Hi,

I'm seeing this failure:
...
(gdb) print /x $bnd0 = {0x10, 0x20}^M
$23 = {lbound = 0x10, ubound = 0x20}^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: verify size for bnd0
...

The test expects a pretty printer to be actived printing 'size 17':
...
set test_string ".*\\\: size 17.*"
gdb_test "print /x \$bnd0 = {0x10, 0x20}" "$test_string" "verify size for bnd0"
...
but that doesn't happen.

The pretty printer is for the type of the $bnd0 register, which is created
here in i386_bnd_type:
...
      t = arch_composite_type (gdbarch,
                               "__gdb_builtin_type_bound128", TYPE_CODE_STRUCT);

      append_composite_type_field (t, "lbound", bt->builtin_data_ptr);
      append_composite_type_field (t, "ubound", bt->builtin_data_ptr);

      TYPE_NAME (t) = "builtin_type_bound128";
...

And the pretty-printer is registered here in
gdb/python/lib/gdb/printer/bound_registers.py:
...
gdb.printing.add_builtin_pretty_printer ('mpx_bound128',
                                         '^__gdb_builtin_type_bound128',
                                         MpxBound128Printer)
...

Fix the pretty printer by changing the regexp argument of
add_builtin_pretty_printer to match "builtin_type_bound128", the TYPE_NAME.

Tested on x86_64-linux.

OK for trunk?

Thanks,
- Tom

[gdb/target] Fix pretty-printer for MPX bnd registers

gdb/ChangeLog:

2019-10-08  Tom de Vries  <tdevries@suse.de>

	* python/lib/gdb/printer/bound_registers.py: Use
	'^__gdb_builtin_type_bound128' as regexp argument for
	add_builtin_pretty_printer.

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

diff --git a/gdb/python/lib/gdb/printer/bound_registers.py b/gdb/python/lib/gdb/printer/bound_registers.py
index f39d2200412..1e8a3ccdfb6 100644
--- a/gdb/python/lib/gdb/printer/bound_registers.py
+++ b/gdb/python/lib/gdb/printer/bound_registers.py
@@ -39,5 +39,5 @@ class MpxBound128Printer:
         return result
 
 gdb.printing.add_builtin_pretty_printer ('mpx_bound128',
-                                         '^__gdb_builtin_type_bound128',
+                                         '^builtin_type_bound128',
                                          MpxBound128Printer)

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

* Re: [PATCH][gdb/target] Fix pretty-printer for MPX bnd registers
  2019-10-08  6:51 [PATCH][gdb/target] Fix pretty-printer for MPX bnd registers Tom de Vries
@ 2019-10-09 17:54 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2019-10-09 17:54 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> [gdb/target] Fix pretty-printer for MPX bnd registers

Tom> gdb/ChangeLog:

Tom> 2019-10-08  Tom de Vries  <tdevries@suse.de>

Tom> 	* python/lib/gdb/printer/bound_registers.py: Use
Tom> 	'^__gdb_builtin_type_bound128' as regexp argument for
Tom> 	add_builtin_pretty_printer.

The ChangeLog mentions the wrong type name.

This is ok with that fixed.

Tom

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

end of thread, other threads:[~2019-10-09 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  6:51 [PATCH][gdb/target] Fix pretty-printer for MPX bnd registers Tom de Vries
2019-10-09 17:54 ` Tom Tromey

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