[gdb/target] Fix pretty-printer for MPX bnd registers
authorTom de Vries <tdevries@suse.de>
Wed, 9 Oct 2019 21:52:46 +0000 (23:52 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 9 Oct 2019 21:52:46 +0000 (23:52 +0200)
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.

gdb/ChangeLog:

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

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

gdb/ChangeLog
gdb/python/lib/gdb/printer/bound_registers.py

index 2a39ab29b5ab2f14efbe3effa9ba0d1494131cea..9402ba41119e617f271570bcf94ce991e1c6aac2 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-09  Tom de Vries  <tdevries@suse.de>
+
+       * python/lib/gdb/printer/bound_registers.py: Use
+       '^builtin_type_bound128' as regexp argument for
+       add_builtin_pretty_printer.
+
 2019-10-09  Christian Biesinger  <cbiesinger@google.com>
 
        * guile/guile.c (guile_extension_script_ops): Remove forward
index f39d22004124f978df68e3a797a084966703f390..1e8a3ccdfb668dbe6045212e40f4b03097e58e94 100644 (file)
@@ -39,5 +39,5 @@ class MpxBound128Printer:
         return result
 
 gdb.printing.add_builtin_pretty_printer ('mpx_bound128',
-                                         '^__gdb_builtin_type_bound128',
+                                         '^builtin_type_bound128',
                                          MpxBound128Printer)