GNU Binutils with patches for OS216
Revisión | 09748966c1b65c953971f8e56d7f6113cfbfda95 (tree) |
---|---|
Tiempo | 2013-11-20 22:42:53 |
Autor | Walfred Tedeschi <walfred.tedeschi@inte...> |
Commiter | Walfred Tedeschi |
Add pretty-printer for MPX bnd registers.
Boundary length is simpler implemented by means of a pretty
printer. This simplifies users life when examining a bound register.
Changelog:
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* python/lib/gdb/command/bound_register.py: New file.
* gdb/data-directory/Makefile.in: copy bond_register.py to the right path to
be initialized at gdb startup.
testsuite/
* gdb.python/py-pp-maint.exp: Consider new pretty-print added for registers.
Change-Id: Id4f39845e5ece56c370a1fd4343648909f08b731
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
@@ -1,5 +1,11 @@ | ||
1 | 1 | 2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com> |
2 | 2 | |
3 | + * python/lib/gdb/command/bound_register.py: New file. | |
4 | + * gdb/data-directory/Makefile.in: copy bond_register.py to the right path to | |
5 | + be initialized at gdb startup. | |
6 | + | |
7 | +2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com> | |
8 | + | |
3 | 9 | * amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): |
4 | 10 | Add MPX registers. |
5 | 11 | (amd64_linux_read_description): Add initialization for MPX and |
@@ -61,6 +61,7 @@ PYTHON_FILES = \ | ||
61 | 61 | gdb/types.py \ |
62 | 62 | gdb/printing.py \ |
63 | 63 | gdb/prompt.py \ |
64 | + gdb/command/bound_registers.py \ | |
64 | 65 | gdb/command/__init__.py \ |
65 | 66 | gdb/command/frame_filters.py \ |
66 | 67 | gdb/command/type_printers.py \ |
@@ -0,0 +1,45 @@ | ||
1 | +# Pretty-printer utilities. | |
2 | +# Copyright (C) 2013 Free Software Foundation, Inc. | |
3 | + | |
4 | +# This program is free software; you can redistribute it and/or modify | |
5 | +# it under the terms of the GNU General Public License as published by | |
6 | +# the Free Software Foundation; either version 3 of the License, or | |
7 | +# (at your option) any later version. | |
8 | +# | |
9 | +# This program is distributed in the hope that it will be useful, | |
10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | +# GNU General Public License for more details. | |
13 | +# | |
14 | +# You should have received a copy of the GNU General Public License | |
15 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | + | |
17 | +import gdb.printing | |
18 | + | |
19 | +class BoundPrinter: | |
20 | + """Adds size field to a _rawbound128 type.""" | |
21 | + | |
22 | + def __init__ (self, val): | |
23 | + self.val = val | |
24 | + | |
25 | + def to_string (self): | |
26 | + upper = self.val["ubound"] | |
27 | + lower = self.val["lbound"] | |
28 | + size = (long) ((upper) - (lower)) | |
29 | + if size > -1: | |
30 | + size = size + 1 | |
31 | + result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper, size) | |
32 | + return result | |
33 | + | |
34 | +# There are two pattern matching used: first one is related to a library | |
35 | +# second is related to the type. Since we are displaying a register all | |
36 | +# libraries are accepted. Type to be processed is the same present | |
37 | +# in the xml file. | |
38 | + | |
39 | +def build_pretty_printer (): | |
40 | + pp = gdb.printing.RegexpCollectionPrettyPrinter (".*") | |
41 | + pp.add_printer ('bound', '^__gdb_builtin_type_bound128', BoundPrinter) | |
42 | + return pp | |
43 | + | |
44 | +gdb.printing.register_pretty_printer (gdb.current_objfile (), | |
45 | + build_pretty_printer ()) |
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com> |
2 | 2 | |
3 | +2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com> | |
4 | + | |
5 | + * gdb.python/py-pp-maint.exp: Consider new pretty-print added | |
6 | + for bnd registers. | |
7 | + | |
3 | 8 | * gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having |
4 | 9 | start and end equal 0. |
5 | 10 |
@@ -60,7 +60,7 @@ gdb_test "print flt" " = x=<42> y=<43>" \ | ||
60 | 60 | gdb_test "print ss" " = a=<a=<1> b=<$hex>> b=<a=<2> b=<$hex>>" \ |
61 | 61 | "print ss enabled #1" |
62 | 62 | |
63 | -set num_pp 6 | |
63 | +set num_pp 7 | |
64 | 64 | |
65 | 65 | gdb_test "disable pretty-printer" \ |
66 | 66 | "$num_pp printers disabled.*0 of $num_pp printers enabled" |
@@ -78,7 +78,7 @@ gdb_test "disable pretty-printer global lookup_function_lookup_test" \ | ||
78 | 78 | "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled" |
79 | 79 | |
80 | 80 | gdb_test "disable pretty-printer global pp-test;.*" \ |
81 | - "[expr $num_pp - 1] printers disabled.*0 of $num_pp printers enabled" | |
81 | + "[expr $num_pp - 2] printers disabled.*1 of $num_pp printers enabled" | |
82 | 82 | |
83 | 83 | gdb_test "info pretty-printer global .*function" \ |
84 | 84 | {.*function_lookup_test \[disabled\].*} |
@@ -93,13 +93,13 @@ gdb_test "print ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \ | ||
93 | 93 | "print ss disabled" |
94 | 94 | |
95 | 95 | gdb_test "enable pretty-printer global lookup_function_lookup_test" \ |
96 | - "1 printer enabled.*1 of $num_pp printers enabled" | |
96 | + "1 printer enabled.*2 of $num_pp printers enabled" | |
97 | 97 | |
98 | 98 | # This doesn't enable any printers because each subprinter in the collection |
99 | 99 | # is still individually disabled. But this is still needed, to enable the |
100 | 100 | # collection itself. |
101 | 101 | gdb_test "enable pretty-printer global pp-test" \ |
102 | - "0 printers enabled.*1 of $num_pp printers enabled" | |
102 | + "0 printers enabled.*2 of $num_pp printers enabled" | |
103 | 103 | |
104 | 104 | gdb_test "enable pretty-printer global pp-test;.*ss.*" \ |
105 | 105 | "2 printers enabled.*[expr $num_pp - 3] of $num_pp printers enabled" |