[Lldb-commits] [PATCH] D126359: [LLDB] Add basic floating point ops to IR interpreter

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 27 10:12:11 PDT 2022


clayborg added inline comments.


================
Comment at: lldb/test/API/lang/c/fpeval/TestFPEval.py:32-33
+        self.runCmd("run", RUN_SUCCEEDED)
+        self.expect("expr --allow-jit false  -- a + b", VARIABLES_DISPLAYED_CORRECTLY,
+                    substrs=['double', '44'])
+        self.expect("expr --allow-jit false  -- a - b", VARIABLES_DISPLAYED_CORRECTLY,
----------------
if we want to verify if the above "a+b" works as expected compared to JITed code, you can also run an expression like:

```
expr eval(a, b, add)
```
Then then we would want to compare the expression results to make sure the binary answer matches exactly. To do this, we will want to use the LLDB native APIs:
```
no_jit_options = lldb.SBExpressionOptions()
no_jit_options = expt_options.SetAllowJIT(False)
jit_options = lldb.SBExpressionOptions()
jit_options = expt_options.SetAllowJIT(True)
no_jit_value = frame.EvaluateExpression("a+b", no_jit_options)
jit_value = frame.EvaluateExpression("eval(a, b, add)", jit_options)
no_jit_data = no_jit_value.GetData()
jit_data = no_jit_value.GetData()
```
Then we need to compare the data byte for byte.





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126359/new/

https://reviews.llvm.org/D126359



More information about the lldb-commits mailing list