2 Tests calling builtin functions using expression evaluation.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class ExprCommandCallBuiltinFunction(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 # Builtins are expanded by Clang, so debug info shouldn't matter.
18 NO_DEBUG_INFO_TESTCASE = True
22 # Find the line number to break for main.c.
23 self.line = line_number(
25 '// Please test these expressions while stopped at this line:')
30 # Set breakpoint in main and run exe
31 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
32 lldbutil.run_break_set_by_file_and_line(
33 self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
35 self.runCmd("run", RUN_SUCCEEDED)
37 interp = self.dbg.GetCommandInterpreter()
38 result = lldb.SBCommandReturnObject()
40 # Test different builtin functions.
42 self.expect_expr("__builtin_isinf(0.0f)", result_type="int", result_value="0")
43 self.expect_expr("__builtin_isnormal(0.0f)", result_type="int", result_value="0")
44 self.expect_expr("__builtin_constant_p(1)", result_type="int", result_value="1")
45 self.expect_expr("__builtin_abs(-14)", result_type="int", result_value="14")