import gdb
+import sys
+
+if sys.version_info[0] >= 3:
+ long = int
# This is not quite right, as local vars may override symname
def read_global_var (symname):
quark = long(quark)
if quark == 0:
return None
- val = read_global_var ("g_quarks")
- max_q = long(read_global_var ("g_quark_seq_id"))
+ try:
+ val = read_global_var ("quarks")
+ max_q = long(read_global_var ("quark_seq_id"))
+ except:
+ try:
+ val = read_global_var ("g_quarks")
+ max_q = long(read_global_var ("g_quark_seq_id"))
+ except:
+ return None;
if quark < max_q:
return val[quark].string()
return None
def __init__(self, ht, keys_are_strings):
self.ht = ht
if ht != 0:
- self.array = ht["nodes"]
+ self.keys = ht["keys"]
+ self.values = ht["values"]
+ self.hashes = ht["hashes"]
self.size = ht["size"]
self.pos = 0
self.keys_are_strings = keys_are_strings
self.value = None
return v
while long(self.pos) < long(self.size):
- node = self.array[self.pos]
self.pos = self.pos + 1
- if long (node["key_hash"]) >= 2:
- key = node["key"]
- val = node["value"]
+ if long (self.hashes[self.pos]) >= 2:
+ key = self.keys[self.pos]
+ val = self.values[self.pos]
if self.keys_are_strings:
key = key.cast (gdb.lookup_type("char").pointer())
try:
string_hash = read_global_var ("g_str_hash")
except:
- try:
- string_hash = read_global_var ("IA__g_str_hash")
- except:
- string_hash = None
+ string_hash = None
if self.val != 0 and string_hash != None and self.val["hash_func"] == string_hash:
self.keys_are_strings = True
return "map"
def pretty_printer_lookup (val):
- if is_g_type_instance (val):
- return GTypePrettyPrinter (val)
-
-def pretty_printer_lookup (val):
# None yet, want things like hash table and list
type = val.type.unqualified()