From 34983d5f8fbdced8f38d61a933ce32aff3e0886c Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 9 Jan 2013 23:22:08 +0000 Subject: [PATCH] [utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the value. Some lldb changes made lldb.frame not set until a script is invoked, which made the formatters not working after a restart. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172017 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/ClangDataFormat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/ClangDataFormat.py b/utils/ClangDataFormat.py index a80f0b579f..38ef76b325 100644 --- a/utils/ClangDataFormat.py +++ b/utils/ClangDataFormat.py @@ -39,6 +39,7 @@ class SourceLocation(object): def __init__(self, srcloc): self.srcloc = srcloc self.ID = srcloc.GetChildAtIndex(0).GetValueAsUnsigned() + self.frame = srcloc.GetFrame() def offset(self): return getValueFromExpression(self.srcloc, ".getOffset()").GetValueAsUnsigned() @@ -50,7 +51,7 @@ class SourceLocation(object): return getValueFromExpression(self.srcloc, ".isMacroID()").GetValueAsUnsigned() def isLocal(self, srcmgr_path): - return lldb.frame.EvaluateExpression("(%s).isLocalSourceLocation(%s)" % (srcmgr_path, getExpressionPath(self.srcloc))).GetValueAsUnsigned() + return self.frame.EvaluateExpression("(%s).isLocalSourceLocation(%s)" % (srcmgr_path, getExpressionPath(self.srcloc))).GetValueAsUnsigned() def getPrint(self, srcmgr_path): print_str = getValueFromExpression(self.srcloc, ".printToString(%s)" % srcmgr_path) @@ -59,7 +60,7 @@ class SourceLocation(object): def summary(self): if self.isInvalid(): return "" - srcmgr_path = findObjectExpressionPath("clang::SourceManager", lldb.frame) + srcmgr_path = findObjectExpressionPath("clang::SourceManager", self.frame) if srcmgr_path: return "%s (offset: %d, %s, %s)" % (self.getPrint(srcmgr_path), self.offset(), "macro" if self.isMacro() else "file", "local" if self.isLocal(srcmgr_path) else "loaded") return "(offset: %d, %s)" % (self.offset(), "macro" if self.isMacro() else "file") @@ -152,7 +153,7 @@ def findObject(typename, frame): return found if not found.TypeIsPointerType() else found.Dereference() def getValueFromExpression(val, expr): - return lldb.frame.EvaluateExpression(getExpressionPath(val) + expr) + return val.GetFrame().EvaluateExpression(getExpressionPath(val) + expr) def getExpressionPath(val): stream = lldb.SBStream() -- 2.40.0