summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/crawl-gdb.py
diff options
context:
space:
mode:
authorSamuel Bronson <naesten@gmail.com>2011-12-05 20:38:10 -0500
committerSamuel Bronson <naesten@gmail.com>2011-12-05 20:38:10 -0500
commit4993a36ee5840859847b4bfa11e301dd9900f38d (patch)
tree9c20443e9c63a1361b630b9efb84d66ca2b7c8a5 /crawl-ref/source/crawl-gdb.py
parentf9e7e8007b83289b301698abbf6587a0c7efa7fc (diff)
downloadcrawl-ref-4993a36ee5840859847b4bfa11e301dd9900f38d.tar.gz
crawl-ref-4993a36ee5840859847b4bfa11e301dd9900f38d.zip
GDB pretty-printer for CrawlHashTable proper.
(Still need to do CrawlStoreValue, which is the hard part, and CrawlVector, which should be about the same as this.)
Diffstat (limited to 'crawl-ref/source/crawl-gdb.py')
-rw-r--r--crawl-ref/source/crawl-gdb.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/crawl-gdb.py b/crawl-ref/source/crawl-gdb.py
index 84f5bfbe60..333aa85226 100644
--- a/crawl-ref/source/crawl-gdb.py
+++ b/crawl-ref/source/crawl-gdb.py
@@ -28,11 +28,29 @@ class FixedVector_printer:
def to_string(self):
return self.val['mData']
+# Pretty printers for "store.h"
+class CrawlHashTable_printer:
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return ""
+
+ def children(self):
+ # needs libstdc++
+ vis = gdb.default_visualizer(self.val["hash_map"].dereference())
+ if vis:
+ return vis.children()
+
+ def display_hint(self):
+ return "map"
+
def build_pretty_printer():
pp = gdb.printing.RegexpCollectionPrettyPrinter("crawl")
pp.add_printer('coord_def', '^coord_def$', coord_def_printer)
# pp.add_printer('actor', '^actor$', actor_printer)
pp.add_printer('FixedVector', '^FixedVector<.*>$', FixedVector_printer)
+ pp.add_printer('CrawlHashTable', '^CrawlHashTable$', CrawlHashTable_printer)
return pp
gdb.printing.register_pretty_printer(