def source_regex_locations(self):
    ' Test that restricting source expressions to files & to functions. '
    exe = os.path.join(os.getcwd(), 'a.out')
    target = self.dbg.CreateTarget(exe)
    self.assertTrue(target, VALID_TARGET)
    target_files = lldb.SBFileSpecList()
    target_files.Append(lldb.SBFileSpec('a.c'))
    func_names = lldb.SBStringList()
    func_names.AppendString('a_func')
    source_regex = 'Set . breakpoint here'
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, func_names)
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 1), ('a.c in a_func should give one breakpoint, got %d.' % num_locations))
    loc = main_break.GetLocationAtIndex(0)
    self.assertTrue(loc.IsValid(), 'Got a valid location.')
    address = loc.GetAddress()
    self.assertTrue(address.IsValid(), 'Got a valid address from the location.')
    a_func_line = line_number('a.c', 'Set A breakpoint here')
    line_entry = address.GetLineEntry()
    self.assertTrue(line_entry.IsValid(), 'Got a valid line entry.')
    self.assertTrue((line_entry.line == a_func_line), 'Our line number matches the one lldbtest found.')
Test that restricting source expressions to files & to functions.
def source_regex_locations(self):
    '  '
    exe = os.path.join(os.getcwd(), 'a.out')
    target = self.dbg.CreateTarget(exe)
    self.assertTrue(target, VALID_TARGET)
    target_files = lldb.SBFileSpecList()
    target_files.Append(lldb.SBFileSpec('a.c'))
    func_names = lldb.SBStringList()
    func_names.AppendString('a_func')
    source_regex = 'Set . breakpoint here'
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, func_names)
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 1), ('a.c in a_func should give one breakpoint, got %d.' % num_locations))
    loc = main_break.GetLocationAtIndex(0)
    self.assertTrue(loc.IsValid(), 'Got a valid location.')
    address = loc.GetAddress()
    self.assertTrue(address.IsValid(), 'Got a valid address from the location.')
    a_func_line = line_number('a.c', 'Set A breakpoint here')
    line_entry = address.GetLineEntry()
    self.assertTrue(line_entry.IsValid(), 'Got a valid line entry.')
    self.assertTrue((line_entry.line == a_func_line), 'Our line number matches the one lldbtest found.')