• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión09748966c1b65c953971f8e56d7f6113cfbfda95 (tree)
Tiempo2013-11-20 22:42:53
AutorWalfred Tedeschi <walfred.tedeschi@inte...>
CommiterWalfred Tedeschi

Log Message

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

Cambiar Resumen

Diferencia incremental

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
11 2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
22
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+
39 * amd64-linux-nat.c (amd64_linux_gregset32_reg_offset):
410 Add MPX registers.
511 (amd64_linux_read_description): Add initialization for MPX and
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -61,6 +61,7 @@ PYTHON_FILES = \
6161 gdb/types.py \
6262 gdb/printing.py \
6363 gdb/prompt.py \
64+ gdb/command/bound_registers.py \
6465 gdb/command/__init__.py \
6566 gdb/command/frame_filters.py \
6667 gdb/command/type_printers.py \
--- /dev/null
+++ b/gdb/python/lib/gdb/command/bound_registers.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 ())
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
11 2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
22
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+
38 * gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having
49 start and end equal 0.
510
--- a/gdb/testsuite/gdb.python/py-pp-maint.exp
+++ b/gdb/testsuite/gdb.python/py-pp-maint.exp
@@ -60,7 +60,7 @@ gdb_test "print flt" " = x=<42> y=<43>" \
6060 gdb_test "print ss" " = a=<a=<1> b=<$hex>> b=<a=<2> b=<$hex>>" \
6161 "print ss enabled #1"
6262
63-set num_pp 6
63+set num_pp 7
6464
6565 gdb_test "disable pretty-printer" \
6666 "$num_pp printers disabled.*0 of $num_pp printers enabled"
@@ -78,7 +78,7 @@ gdb_test "disable pretty-printer global lookup_function_lookup_test" \
7878 "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"
7979
8080 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"
8282
8383 gdb_test "info pretty-printer global .*function" \
8484 {.*function_lookup_test \[disabled\].*}
@@ -93,13 +93,13 @@ gdb_test "print ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \
9393 "print ss disabled"
9494
9595 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"
9797
9898 # This doesn't enable any printers because each subprinter in the collection
9999 # is still individually disabled. But this is still needed, to enable the
100100 # collection itself.
101101 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"
103103
104104 gdb_test "enable pretty-printer global pp-test;.*ss.*" \
105105 "2 printers enabled.*[expr $num_pp - 3] of $num_pp printers enabled"