def source_regex_restrictions(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('main.c'))
    source_regex = 'Set . breakpoint here'
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 2), ('main.c should have 2 matches, got %d.' % num_locations))
    target_files.Append(lldb.SBFileSpec('a.c'))
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 4), ('main.c and a.c should have 4 matches, got %d.' % num_locations))
    func_names = lldb.SBStringList()
    func_names.AppendString('main_func')
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, func_names)
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 2), ('main_func in main.c and a.c should have 2 matches, got %d.' % num_locations))
Test that restricting source expressions to files & to functions.
def source_regex_restrictions(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('main.c'))
    source_regex = 'Set . breakpoint here'
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 2), ('main.c should have 2 matches, got %d.' % num_locations))
    target_files.Append(lldb.SBFileSpec('a.c'))
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 4), ('main.c and a.c should have 4 matches, got %d.' % num_locations))
    func_names = lldb.SBStringList()
    func_names.AppendString('main_func')
    main_break = target.BreakpointCreateBySourceRegex(source_regex, lldb.SBFileSpecList(), target_files, func_names)
    num_locations = main_break.GetNumLocations()
    self.assertTrue((num_locations == 2), ('main_func in main.c and a.c should have 2 matches, got %d.' % num_locations))