• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Verify that the hash computing logic for ValueObject's values can't crash us.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class ValueMD5CrashTestCase(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    def setUp(self):
18        # Call super's setUp().
19        TestBase.setUp(self)
20        # Find the line number to break at.
21        self.line = line_number('main.cpp', '// break here')
22
23    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")
24    def test_with_run_command(self):
25        """Verify that the hash computing logic for ValueObject's values can't crash us."""
26        self.build()
27        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
28
29        lldbutil.run_break_set_by_file_and_line(
30            self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
31
32        self.runCmd("run", RUN_SUCCEEDED)
33
34        # The stop reason of the thread should be breakpoint.
35        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
36                    substrs=['stopped',
37                             'stop reason = breakpoint'])
38
39        value = self.frame().FindVariable("a")
40        value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
41
42        v = value.GetValue()
43        type_name = value.GetTypeName()
44        self.assertEquals(type_name, "B *", "a is a B*")
45
46        self.runCmd("next")
47        self.runCmd("process kill")
48
49        # now the process is dead, and value needs updating
50        v = value.GetValue()
51
52        # if we are here, instead of crashed, the test succeeded
53