summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h4
-rw-r--r--lldb/include/lldb/Target/Target.h17
-rw-r--r--lldb/source/API/SBTarget.cpp33
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverFileLine.cpp33
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp36
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.h1
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp5
-rw-r--r--lldb/source/Target/Target.cpp34
9 files changed, 128 insertions, 41 deletions
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index a7e54b7c760..cc1633ce170 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -31,7 +31,8 @@ public:
BreakpointResolverFileLine (Breakpoint *bkpt,
const FileSpec &resolver,
uint32_t line_no,
- bool check_inlines);
+ bool check_inlines,
+ bool skip_prologue);
virtual
~BreakpointResolverFileLine ();
@@ -62,6 +63,7 @@ protected:
FileSpec m_file_spec; // This is the file spec we are looking for.
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
+ bool m_skip_prologue;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index ab5205b3b59..3daf659562c 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -448,6 +448,7 @@ public:
const FileSpec &file,
uint32_t line_no,
bool check_inlines,
+ LazyBool skip_prologue = eLazyBoolCalculate,
bool internal = false);
// Use this to create breakpoint that matches regex against the source lines in files given in source_file_list:
@@ -474,8 +475,8 @@ public:
CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
RegularExpression &func_regexp,
- bool internal = false,
- LazyBool skip_prologue = eLazyBoolCalculate);
+ LazyBool skip_prologue = eLazyBoolCalculate,
+ bool internal = false);
// Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
@@ -485,8 +486,8 @@ public:
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
- bool internal = false,
- LazyBool skip_prologue = eLazyBoolCalculate);
+ LazyBool skip_prologue = eLazyBoolCalculate,
+ bool internal = false);
lldb::BreakpointSP
CreateExceptionBreakpoint (enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal = false);
@@ -500,16 +501,16 @@ public:
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
- bool internal = false,
- LazyBool skip_prologue = eLazyBoolCalculate);
+ LazyBool skip_prologue = eLazyBoolCalculate,
+ bool internal = false);
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
- bool internal = false,
- LazyBool skip_prologue = eLazyBoolCalculate);
+ LazyBool skip_prologue = eLazyBoolCalculate,
+ bool internal = false);
// Use this to create a general breakpoint:
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index d1275e6392b..80a152971de 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1170,7 +1170,11 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l
if (target_sp && line != 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
- *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
+
+ const bool check_inlines = true;
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
+ *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal);
}
if (log)
@@ -1200,15 +1204,18 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na
if (target_sp.get())
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
- *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, false);
+ *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal);
}
else
{
- *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, false);
+ *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal);
}
}
@@ -1242,12 +1249,15 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
TargetSP target_sp(GetSP());
if (target_sp && symbol_name && symbol_name[0])
{
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
Mutex::Locker api_locker (target_sp->GetAPIMutex());
*sb_bp = target_sp->CreateBreakpoint (module_list.get(),
comp_unit_list.get(),
symbol_name,
name_type_mask,
- false);
+ skip_prologue,
+ internal);
}
if (log)
@@ -1273,12 +1283,15 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
if (target_sp && num_names > 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
*sb_bp = target_sp->CreateBreakpoint (module_list.get(),
comp_unit_list.get(),
symbol_names,
num_names,
name_type_mask,
- false);
+ skip_prologue,
+ internal);
}
if (log)
@@ -1314,17 +1327,19 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
RegularExpression regexp(symbol_name_regex);
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
- *sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, false);
+ *sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, skip_prologue, internal);
}
else
{
- *sb_bp = target_sp->CreateFuncRegexBreakpoint (NULL, NULL, regexp, false);
+ *sb_bp = target_sp->CreateFuncRegexBreakpoint (NULL, NULL, regexp, skip_prologue, internal);
}
}
@@ -1350,8 +1365,10 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
RegularExpression regexp(symbol_name_regex);
+ const bool internal = false;
+ const LazyBool skip_prologue = eLazyBoolCalculate;
- *sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, false);
+ *sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, skip_prologue, internal);
}
if (log)
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index ca24377077d..f1b8ac55cc1 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -16,6 +16,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Target/Target.h"
#include "lldb/lldb-private-log.h"
using namespace lldb;
@@ -29,12 +30,14 @@ BreakpointResolverFileLine::BreakpointResolverFileLine
Breakpoint *bkpt,
const FileSpec &file_spec,
uint32_t line_no,
- bool check_inlines
+ bool check_inlines,
+ bool skip_prologue
) :
BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),
m_file_spec (file_spec),
m_line_number (line_no),
- m_inlines (check_inlines)
+ m_inlines (check_inlines),
+ m_skip_prologue(skip_prologue)
{
}
@@ -135,12 +138,36 @@ BreakpointResolverFileLine::SearchCallback
{
if (filter.AddressPasses(line_start))
{
+ // If the line number is before the prologue end, move it there...
+ bool skipped_prologue = false;
+ if (m_skip_prologue)
+ {
+ if (sc.function)
+ {
+ Address prologue_addr(sc.function->GetAddressRange().GetBaseAddress());
+ if (prologue_addr.IsValid() && (line_start == prologue_addr))
+ {
+ const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
+ if (prologue_byte_size)
+ {
+ prologue_addr.Slide(prologue_byte_size);
+
+ if (filter.AddressPasses(prologue_addr))
+ {
+ skipped_prologue = true;
+ line_start = prologue_addr;
+ }
+ }
+ }
+ }
+ }
+
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(line_start));
if (log && bp_loc_sp && !m_breakpoint->IsInternal())
{
StreamString s;
bp_loc_sp->GetDescription (&s, lldb::eDescriptionLevelVerbose);
- log->Printf ("Added location: %s\n", s.GetData());
+ log->Printf ("Added location (skipped prologue: %s): %s \n", skipped_prologue ? "yes" : "no", s.GetData());
}
}
else if (log)
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 625e472821f..63bcb62ef83 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -66,7 +66,8 @@ CommandObjectBreakpointSet::CommandOptions::CommandOptions(CommandInterpreter &i
m_queue_name(),
m_catch_bp (false),
m_throw_bp (false),
- m_language (eLanguageTypeUnknown)
+ m_language (eLanguageTypeUnknown),
+ m_skip_prologue (eLazyBoolCalculate)
{
}
@@ -78,6 +79,7 @@ CommandObjectBreakpointSet::CommandOptions::~CommandOptions ()
// update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
#define LLDB_OPT_FILE ( LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2 )
#define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 )
+#define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
OptionDefinition
CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
@@ -148,6 +150,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_10, false, "on-catch", 'h', required_argument, NULL, 0, eArgTypeBoolean,
"Set the breakpoint on exception catcH." },
+ { LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', required_argument, NULL, 0, eArgTypeBoolean,
+ "sKip the prologue if the breakpoint is at the beginning of a function. If not set the target.skip-prologue setting is used." },
+
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -295,6 +300,19 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (uint32_t option_idx,
if (!success)
error.SetErrorStringWithFormat ("Invalid boolean value for on-catch option: '%s'", option_arg);
}
+ case 'K':
+ {
+ bool success;
+ bool value;
+ value = Args::StringToBoolean (option_arg, true, &success);
+ if (value)
+ m_skip_prologue = eLazyBoolYes;
+ else
+ m_skip_prologue = eLazyBoolNo;
+
+ if (!success)
+ error.SetErrorStringWithFormat ("Invalid boolean value for skip prologue option: '%s'", option_arg);
+ }
break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
@@ -323,6 +341,7 @@ CommandObjectBreakpointSet::CommandOptions::OptionParsingStarting ()
m_language = eLanguageTypeUnknown;
m_catch_bp = false;
m_throw_bp = true;
+ m_skip_prologue = eLazyBoolCalculate;
}
//-------------------------------------------------------------------------
@@ -430,6 +449,8 @@ CommandObjectBreakpointSet::Execute
FileSpec module_spec;
bool use_module = false;
int num_modules = m_options.m_modules.GetSize();
+
+ const bool internal = false;
if ((num_modules > 0) && (break_type != eSetTypeAddress))
use_module = true;
@@ -461,7 +482,9 @@ CommandObjectBreakpointSet::Execute
bp = target->CreateBreakpoint (&(m_options.m_modules),
file,
m_options.m_line_num,
- m_options.m_check_inlines).get();
+ m_options.m_check_inlines,
+ m_options.m_skip_prologue,
+ internal).get();
}
break;
@@ -480,7 +503,8 @@ CommandObjectBreakpointSet::Execute
&(m_options.m_filenames),
m_options.m_func_names,
name_type_mask,
- Breakpoint::Exact).get();
+ m_options.m_skip_prologue,
+ internal).get();
}
break;
@@ -497,7 +521,11 @@ CommandObjectBreakpointSet::Execute
return false;
}
- bp = target->CreateFuncRegexBreakpoint (&(m_options.m_modules), &(m_options.m_filenames), regexp).get();
+ bp = target->CreateFuncRegexBreakpoint (&(m_options.m_modules),
+ &(m_options.m_filenames),
+ regexp,
+ m_options.m_skip_prologue,
+ internal).get();
}
break;
case eSetTypeSourceRegexp: // Breakpoint by regexp on source text.
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.h b/lldb/source/Commands/CommandObjectBreakpoint.h
index df96b04c66a..c9447452adc 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.h
+++ b/lldb/source/Commands/CommandObjectBreakpoint.h
@@ -116,6 +116,7 @@ public:
bool m_catch_bp;
bool m_throw_bp;
lldb::LanguageType m_language;
+ LazyBool m_skip_prologue;
};
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index b2df3105453..279bc85f438 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -710,7 +710,7 @@ DynamicLoaderDarwinKernel::SetNotificationBreakpointIfNeeded ()
DEBUG_PRINTF("DynamicLoaderDarwinKernel::%s() process state = %s\n", __FUNCTION__, StateAsCString(m_process->GetState()));
- const bool internal_bp = false;
+ const bool internal_bp = true;
const LazyBool skip_prologue = eLazyBoolNo;
FileSpecList module_spec_list;
module_spec_list.Append (m_kernel.module_sp->GetFileSpec());
@@ -718,8 +718,8 @@ DynamicLoaderDarwinKernel::SetNotificationBreakpointIfNeeded ()
NULL,
"OSKextLoadedKextSummariesUpdated",
eFunctionNameTypeFull,
- internal_bp,
- skip_prologue).get();
+ skip_prologue,
+ internal_bp).get();
bp->SetCallback (DynamicLoaderDarwinKernel::BreakpointHitCallback, this, true);
m_break_id = bp->GetID();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index ec042c4dce5..a16e101e031 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -848,12 +848,15 @@ PlatformDarwin::SetThreadCreationBreakpoint (Target &target)
bp_modules.Append(FileSpec(bp_module, false));
}
+ bool internal = true;
+ LazyBool skip_prologue = eLazyBoolNo;
bp_sp = target.CreateBreakpoint (&bp_modules,
NULL,
g_bp_names,
sizeof(g_bp_names)/sizeof(const char *),
eFunctionNameTypeFull,
- true);
+ skip_prologue,
+ internal);
return bp_sp;
}
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 5fe1f5e08e0..442c08e4204 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -234,10 +234,17 @@ Target::CreateSourceRegexBreakpoint (const FileSpecList *containingModules,
BreakpointSP
-Target::CreateBreakpoint (const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, bool check_inlines, bool internal)
+Target::CreateBreakpoint (const FileSpecList *containingModules,
+ const FileSpec &file,
+ uint32_t line_no,
+ bool check_inlines,
+ LazyBool skip_prologue,
+ bool internal)
{
SearchFilterSP filter_sp(GetSearchFilterForModuleList (containingModules));
- BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL, file, line_no, check_inlines));
+
+ BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL, file, line_no, check_inlines,
+ skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
return CreateBreakpoint (filter_sp, resolver_sp, internal);
}
@@ -273,8 +280,8 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
- bool internal,
- LazyBool skip_prologue)
+ LazyBool skip_prologue,
+ bool internal)
{
BreakpointSP bp_sp;
if (func_name)
@@ -296,8 +303,8 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
- bool internal,
- LazyBool skip_prologue)
+ LazyBool skip_prologue,
+ bool internal)
{
BreakpointSP bp_sp;
size_t num_names = func_names.size();
@@ -320,8 +327,8 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
- bool internal,
- LazyBool skip_prologue)
+ LazyBool skip_prologue,
+ bool internal)
{
BreakpointSP bp_sp;
if (num_names > 0)
@@ -377,7 +384,8 @@ Target::GetSearchFilterForModuleList (const FileSpecList *containingModules)
}
SearchFilterSP
-Target::GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
+Target::GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles)
{
if (containingSourceFiles == NULL || containingSourceFiles->GetSize() == 0)
return GetSearchFilterForModuleList(containingModules);
@@ -399,10 +407,10 @@ Target::GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules
BreakpointSP
Target::CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
- const FileSpecList *containingSourceFiles,
- RegularExpression &func_regex,
- bool internal,
- LazyBool skip_prologue)
+ const FileSpecList *containingSourceFiles,
+ RegularExpression &func_regex,
+ LazyBool skip_prologue,
+ bool internal)
{
SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
BreakpointResolverSP resolver_sp(new BreakpointResolverName (NULL,
OpenPOWER on IntegriCloud