MCPcopy Create free account
hub / github.com/facebook/chisel / evaluate

Function evaluate

fbchisellldbbase.py:210–230  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

208# >>> fbchisellldbbase.evaluate('NSString *str = @"hello world"; RETURN(@{@"key": str});')
209# {u'key': u'hello world'}
210def evaluate(expr):
211 if not check_expr(expr):
212 raise Exception(
213 "Invalid Expression, the last expression not include a RETURN family marco"
214 )
215
216 command = "({" + RETURN_MACRO + "\n" + expr + "})"
217 ret = evaluateExpressionValue(command, printErrors=True)
218 if not ret.GetError().Success():
219 print(ret.GetError())
220 return None
221 else:
222 process = lldb.debugger.GetSelectedTarget().GetProcess()
223 error = lldb.SBError()
224 ret = process.ReadCStringFromMemory(int(ret.GetValue(), 16), 2 ** 20, error)
225 if not error.Success():
226 print(error)
227 return None
228 else:
229 ret = json.loads(ret)
230 return ret["return"]
231
232
233def currentLanguage():

Callers

nothing calls this directly

Calls 2

check_exprFunction · 0.85
evaluateExpressionValueFunction · 0.85

Tested by

no test coverage detected