aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb-gdb.py.in
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-06-27 15:21:47 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2018-06-27 15:21:47 -0400
commit9a14af7b1a6765a353d4bf710d267a1c47a162fb (patch)
tree98cbef02de6755dace125c648567792b3fe7d7f9 /gdb/gdb-gdb.py.in
parent189366cd86ce2e5758c27054b7f62d1f769a0825 (diff)
downloadgdb-9a14af7b1a6765a353d4bf710d267a1c47a162fb.zip
gdb-9a14af7b1a6765a353d4bf710d267a1c47a162fb.tar.gz
gdb-9a14af7b1a6765a353d4bf710d267a1c47a162fb.tar.bz2
Add pretty-printer for CORE_ADDR
Add a pretty-printer that prints CORE_ADDR values in hex. gdb/ChangeLog: * gdb-gdb.py.in (CoreAddrPrettyPrinter): New class. (type_lookup_function): Recognize CORE_ADDR values.
Diffstat (limited to 'gdb/gdb-gdb.py.in')
-rw-r--r--gdb/gdb-gdb.py.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index cde6068..436f05c 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -222,6 +222,17 @@ class StructMainTypePrettyPrinter:
return "\n{" + ",\n ".join(fields) + "}"
+
+class CoreAddrPrettyPrinter:
+ """Print CORE_ADDR values as hex."""
+
+ def __init__(self, val):
+ self._val = val
+
+ def to_string(self):
+ return hex(int(self._val))
+
+
def type_lookup_function(val):
"""A routine that returns the correct pretty printer for VAL
if appropriate. Returns None otherwise.
@@ -230,6 +241,8 @@ def type_lookup_function(val):
return StructTypePrettyPrinter(val)
elif val.type.tag == "main_type":
return StructMainTypePrettyPrinter(val)
+ elif val.type.name == 'CORE_ADDR':
+ return CoreAddrPrettyPrinter(val)
return None
def register_pretty_printer(objfile):