(expr)
| 208 | # >>> fbchisellldbbase.evaluate('NSString *str = @"hello world"; RETURN(@{@"key": str});') |
| 209 | # {u'key': u'hello world'} |
| 210 | def 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 | |
| 233 | def currentLanguage(): |
nothing calls this directly
no test coverage detected