]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / ptr_refs / TestPtrRefs.py
1 """
2 Test the ptr_refs tool on Darwin
3 """
4
5 from __future__ import print_function
6
7 import os
8 import lldb
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
12
13 class TestPtrRefs(TestBase):
14
15     mydir = TestBase.compute_mydir(__file__)
16
17     @skipUnlessDarwin
18     def test_ptr_refs(self):
19         """Test format string functionality."""
20         self.build()
21         exe_name = 'a.out'
22         exe = os.path.join(os.getcwd(), exe_name)
23     
24         target = self.dbg.CreateTarget(exe)
25         self.assertTrue(target, VALID_TARGET)
26
27         main_file_spec = lldb.SBFileSpec ('main.c')
28         breakpoint = target.BreakpointCreateBySourceRegex('break', main_file_spec)
29         self.assertTrue(breakpoint and
30                         breakpoint.GetNumLocations() == 1,
31                         VALID_BREAKPOINT)
32
33         process = target.LaunchSimple (None, None, self.get_process_working_directory())
34         self.assertTrue(process, PROCESS_IS_VALID)
35
36         # Frame #0 should be on self.line1 and the break condition should hold.
37         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
38         self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
39
40         frame = thread.GetFrameAtIndex(0)       
41
42         self.dbg.HandleCommand("script import lldb.macosx.heap")
43         self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"]);