Files
clang-p2996/lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py
Raphael Isemann 15f34ff2d8 [lldb] Allow expect_expr without a running target
Summary:
If we don't have a current frame then we can still run many expressions
as long as we have an active target. With this patch `expect_expr` directly
calls the target's EvaluateExpression function when there is no current frame.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D77197
2020-04-01 09:39:24 +02:00

29 lines
865 B
Python

"""
Tests calling builtin functions using expression evaluation.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ExprCommandCallBuiltinFunction(TestBase):
mydir = TestBase.compute_mydir(__file__)
# Builtins are expanded by Clang, so debug info shouldn't matter.
NO_DEBUG_INFO_TESTCASE = True
def test(self):
self.build()
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
self.expect_expr("__builtin_isinf(0.0f)", result_type="int", result_value="0")
self.expect_expr("__builtin_isnormal(0.0f)", result_type="int", result_value="0")
self.expect_expr("__builtin_constant_p(1)", result_type="int", result_value="1")
self.expect_expr("__builtin_abs(-14)", result_type="int", result_value="14")