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,
----------------
kpdev42 wrote:
> clayborg wrote:
> > 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.
> >
> >
> >
> IMO this will not work, because lldb always tries interpreter first and
> jitter is used only if interpreter fails. This may be circumvented by
> generating expression which interpreter cannot handle (function call?),
> however I don't see a point in doing it. Why not just check result value?
If you look at how I did the expression, the one that runs with "jit_options"
calls a function to get the result. When a function is called, it causes the
code to not be interpreted since the interpreter doesn't handle function
calls., so this would work.
> however I don't see a point in doing it. Why not just check result value?
My main concern with emulating the floating point stuff is getting a different
value from host based interpretation than we would if we actually ran it on the
actual hardware by jitting it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126359/new/
https://reviews.llvm.org/D126359
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits