Index: tools/gen-postmortem-metadata.py |
diff --git a/tools/gen-postmortem-metadata.py b/tools/gen-postmortem-metadata.py |
index 1b6a6bbcf05fd57c602f84f58db6098bfcb6a166..f7d5832f6764e9bff1214c8619dff8d29671aec1 100644 |
--- a/tools/gen-postmortem-metadata.py |
+++ b/tools/gen-postmortem-metadata.py |
@@ -227,6 +227,20 @@ footer = ''' |
''' |
# |
+# Get the base class |
+# |
+def get_base_class(klass): |
+ if (klass == 'Object'): |
+ return klass; |
+ |
+ if (not (klass in klasses)): |
+ return None; |
+ |
+ k = klasses[klass]; |
+ |
+ return get_base_class(k['parent']); |
+ |
+# |
# Loads class hierarchy and type information from "objects.h". |
# |
def load_objects(): |
@@ -264,12 +278,14 @@ def load_objects(): |
typestr += line; |
continue; |
- match = re.match('class (\w[^\s:]*)(: public (\w[^\s{]*))?\s*{', |
+ match = re.match('class (\w[^:]*)(: public (\w[^{]*))?\s*{\s*', |
line); |
if (match): |
- klass = match.group(1); |
+ klass = match.group(1).rstrip().lstrip(); |
pklass = match.group(3); |
+ if (pklass): |
+ pklass = pklass.rstrip().lstrip(); |
klasses[klass] = { 'parent': pklass }; |
# |
@@ -520,6 +536,9 @@ def emit_config(): |
keys.sort(); |
for klassname in keys: |
pklass = klasses[klassname]['parent']; |
+ bklass = get_base_class(klassname); |
+ if (bklass != 'Object'): |
+ continue; |
if (pklass == None): |
continue; |