Add an -A option to "break set -p" to search all files for matches. Also add the version of
SBTarget::BreakpointCreateBySourceRegex that takes file spec lists to the Python interface, and add a test for this. <rdar://problem/19805037> llvm-svn: 228938
This commit is contained in:
parent
29786d4c16
commit
e732052f16
|
@ -764,13 +764,13 @@ public:
|
||||||
|
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
BreakpointCreateBySourceRegex (const char *source_regex,
|
BreakpointCreateBySourceRegex (const char *source_regex,
|
||||||
const lldb::SBFileSpec &source_file,
|
const SBFileSpec &source_file,
|
||||||
const char *module_name = NULL);
|
const char *module_name = NULL);
|
||||||
|
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
BreakpointCreateBySourceRegex (const char *source_regex,
|
BreakpointCreateBySourceRegex (const char *source_regex,
|
||||||
const SBFileSpecList &module_list,
|
const SBFileSpecList &module_list,
|
||||||
const lldb::SBFileSpecList &source_file);
|
const SBFileSpecList &source_file);
|
||||||
|
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
BreakpointCreateForException (lldb::LanguageType language,
|
BreakpointCreateForException (lldb::LanguageType language,
|
||||||
|
|
|
@ -694,6 +694,9 @@ public:
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
|
BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
|
||||||
|
|
||||||
|
lldb::SBBreakpoint
|
||||||
|
BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpecList &module_list, const lldb::SBFileSpecList &file_list);
|
||||||
|
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
BreakpointCreateForException (lldb::LanguageType language,
|
BreakpointCreateForException (lldb::LanguageType language,
|
||||||
bool catch_bp,
|
bool catch_bp,
|
||||||
|
|
|
@ -1277,9 +1277,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
|
||||||
}
|
}
|
||||||
|
|
||||||
lldb::SBBreakpoint
|
lldb::SBBreakpoint
|
||||||
SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
|
SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
|
||||||
const SBFileSpecList &module_list,
|
const SBFileSpecList &module_list,
|
||||||
const lldb::SBFileSpecList &source_file_list)
|
const lldb::SBFileSpecList &source_file_list)
|
||||||
{
|
{
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,8 @@ public:
|
||||||
m_hardware (false),
|
m_hardware (false),
|
||||||
m_language (eLanguageTypeUnknown),
|
m_language (eLanguageTypeUnknown),
|
||||||
m_skip_prologue (eLazyBoolCalculate),
|
m_skip_prologue (eLazyBoolCalculate),
|
||||||
m_one_shot (false)
|
m_one_shot (false),
|
||||||
|
m_all_files (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +136,10 @@ public:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'A':
|
||||||
|
m_all_files = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
m_func_names.push_back (option_arg);
|
m_func_names.push_back (option_arg);
|
||||||
m_func_name_type_mask |= eFunctionNameTypeBase;
|
m_func_name_type_mask |= eFunctionNameTypeBase;
|
||||||
|
@ -339,6 +344,7 @@ public:
|
||||||
m_one_shot = false;
|
m_one_shot = false;
|
||||||
m_use_dummy = false;
|
m_use_dummy = false;
|
||||||
m_breakpoint_names.clear();
|
m_breakpoint_names.clear();
|
||||||
|
m_all_files = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OptionDefinition*
|
const OptionDefinition*
|
||||||
|
@ -376,6 +382,7 @@ public:
|
||||||
LazyBool m_skip_prologue;
|
LazyBool m_skip_prologue;
|
||||||
bool m_one_shot;
|
bool m_one_shot;
|
||||||
bool m_use_dummy;
|
bool m_use_dummy;
|
||||||
|
bool m_all_files;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -505,7 +512,7 @@ protected:
|
||||||
{
|
{
|
||||||
const size_t num_files = m_options.m_filenames.GetSize();
|
const size_t num_files = m_options.m_filenames.GetSize();
|
||||||
|
|
||||||
if (num_files == 0)
|
if (num_files == 0 && !m_options.m_all_files)
|
||||||
{
|
{
|
||||||
FileSpec file;
|
FileSpec file;
|
||||||
if (!GetDefaultFile (target, file, result))
|
if (!GetDefaultFile (target, file, result))
|
||||||
|
@ -729,6 +736,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
|
||||||
"specified with the -f option. The -f option can be specified more than once. "
|
"specified with the -f option. The -f option can be specified more than once. "
|
||||||
"If no source files are specified, uses the current \"default source file\"" },
|
"If no source files are specified, uses the current \"default source file\"" },
|
||||||
|
|
||||||
|
{ LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
|
||||||
|
"All files are searched for source pattern matches." },
|
||||||
|
|
||||||
{ LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage,
|
{ LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage,
|
||||||
"Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" },
|
"Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" },
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,25 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
|
||||||
func_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
|
func_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
|
||||||
self.assertTrue(func_bkpt, VALID_BREAKPOINT)
|
self.assertTrue(func_bkpt, VALID_BREAKPOINT)
|
||||||
|
|
||||||
|
# Also test that setting a source regex breakpoint with an empty file spec list sets it on all files:
|
||||||
|
no_files_bkpt = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList())
|
||||||
|
self.assertTrue(no_files_bkpt, VALID_BREAKPOINT)
|
||||||
|
num_locations = no_files_bkpt.GetNumLocations()
|
||||||
|
self.assertTrue(num_locations >= 2, "Got at least two breakpoint locations")
|
||||||
|
got_one_in_A = False
|
||||||
|
got_one_in_B = False
|
||||||
|
for idx in range(0, num_locations):
|
||||||
|
comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
|
||||||
|
print "Got comp unit: ", comp_unit.GetFilename()
|
||||||
|
if comp_unit.GetFilename() == "a.c":
|
||||||
|
got_one_in_A = True
|
||||||
|
elif comp_unit.GetFilename() == "b.c":
|
||||||
|
got_one_in_B = True
|
||||||
|
|
||||||
|
self.assertTrue(got_one_in_A, "Failed to match the pattern in A")
|
||||||
|
self.assertTrue(got_one_in_B, "Failed to match the pattern in B")
|
||||||
|
self.target.BreakpointDelete(no_files_bkpt.GetID())
|
||||||
|
|
||||||
PythonBreakpointCommandSettingTestCase.my_var = 10
|
PythonBreakpointCommandSettingTestCase.my_var = 10
|
||||||
error = lldb.SBError()
|
error = lldb.SBError()
|
||||||
error = body_bkpt.SetScriptCallbackBody("\
|
error = body_bkpt.SetScriptCallbackBody("\
|
||||||
|
|
Loading…
Reference in New Issue