mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
Add an "offset" option to "break set -n" and "break set -f -l".
That way you can set offset breakpoints that will move as the function they are contained in moves (which address breakpoints can't do...) I don't align the new address to instruction boundaries yet, so you have to get this right yourself for now. <rdar://problem/13365575> llvm-svn: 263049
This commit is contained in:
parent
58672974a9
commit
2411167fb5
@ -620,6 +620,9 @@ public:
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, lldb::addr_t offset);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr);
|
||||
|
||||
@ -657,6 +660,15 @@ public:
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByNames (const char *symbol_name[],
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
lldb::LanguageType symbol_language,
|
||||
lldb::addr_t offset,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = nullptr);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
/// @result
|
||||
/// Returns breakpoint location id.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType);
|
||||
BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType, lldb::addr_t offset = 0);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The Destructor is virtual, all significant breakpoint resolvers derive
|
||||
@ -77,6 +77,29 @@ public:
|
||||
void
|
||||
SetBreakpoint (Breakpoint *bkpt);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This updates the offset for this breakpoint. All the locations currently
|
||||
/// set for this breakpoint will have their offset adjusted when this is called.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset to add to all locations.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetOffset (lldb::addr_t offset);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This updates the offset for this breakpoint. All the locations currently
|
||||
/// set for this breakpoint will have their offset adjusted when this is called.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset to add to all locations.
|
||||
//------------------------------------------------------------------
|
||||
lldb::addr_t
|
||||
GetOffset () const
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// In response to this method the resolver scans all the modules in the breakpoint's
|
||||
/// target, and adds any new locations it finds.
|
||||
@ -145,8 +168,12 @@ protected:
|
||||
/// matching addresses to unique entries, and skip the prologue if asked to do so, and then set
|
||||
/// breakpoint locations in this breakpoint for all the resultant addresses.
|
||||
void SetSCMatchesByLine (SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, const char *log_ident);
|
||||
|
||||
lldb::BreakpointLocationSP
|
||||
AddLocation(Address loc_addr, bool *new_location = NULL);
|
||||
|
||||
Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
|
||||
lldb::addr_t m_offset; // A random offset the user asked us to add to any breakpoints we set.
|
||||
|
||||
private:
|
||||
// Subclass identifier (for llvm isa/dyn_cast)
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
BreakpointResolverFileLine (Breakpoint *bkpt,
|
||||
const FileSpec &resolver,
|
||||
uint32_t line_no,
|
||||
lldb::addr_t m_offset,
|
||||
bool check_inlines,
|
||||
bool skip_prologue,
|
||||
bool exact_match);
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
uint32_t name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
Breakpoint::MatchType type,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes an array of names. It is always MatchType = Exact.
|
||||
@ -45,6 +46,7 @@ public:
|
||||
size_t num_names,
|
||||
uint32_t name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes a C++ array of names. It is always MatchType = Exact.
|
||||
@ -52,18 +54,21 @@ public:
|
||||
std::vector<std::string> names,
|
||||
uint32_t name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
RegularExpression &func_regex,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
const char *class_name,
|
||||
const char *method,
|
||||
Breakpoint::MatchType type,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
~BreakpointResolverName() override;
|
||||
|
@ -767,6 +767,7 @@ public:
|
||||
CreateBreakpoint (const FileSpecList *containingModules,
|
||||
const FileSpec &file,
|
||||
uint32_t line_no,
|
||||
lldb::addr_t offset,
|
||||
LazyBool check_inlines,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
@ -823,6 +824,7 @@ public:
|
||||
const char *func_name,
|
||||
uint32_t func_name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool request_hardware);
|
||||
@ -844,8 +846,9 @@ public:
|
||||
const FileSpecList *containingSourceFiles,
|
||||
const char *func_names[],
|
||||
size_t num_names,
|
||||
uint32_t func_name_type_mask,
|
||||
uint32_t func_name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool request_hardware);
|
||||
@ -856,6 +859,7 @@ public:
|
||||
const std::vector<std::string> &func_names,
|
||||
uint32_t func_name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t m_offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool request_hardware);
|
||||
|
@ -33,7 +33,7 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "DebugClang"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
@ -87,7 +87,7 @@
|
||||
buildConfiguration = "DebugClang"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
launchStyle = "1"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach"
|
||||
ignoresPersistentStateOnLaunch = "YES"
|
||||
|
@ -585,6 +585,9 @@ public:
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, lldb::addr_t offset);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
|
||||
|
||||
@ -601,21 +604,62 @@ public:
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
%typemap(in) (const char **symbol_name, uint32_t num_names) {
|
||||
using namespace lldb_private;
|
||||
/* Check if is a list */
|
||||
if (PythonList::Check($input)) {
|
||||
PythonList list(PyRefType::Borrowed, $input);
|
||||
$2 = list.GetSize();
|
||||
int i = 0;
|
||||
$1 = (char**)malloc(($2+1)*sizeof(char*));
|
||||
for (i = 0; i < $2; i++) {
|
||||
PythonString py_str = list.GetItemAtIndex(i).AsType<PythonString>();
|
||||
if (!py_str.IsAllocated()) {
|
||||
PyErr_SetString(PyExc_TypeError,"list must contain strings and blubby");
|
||||
free($1);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
$1[i] = const_cast<char*>(py_str.GetString().data());
|
||||
}
|
||||
$1[i] = 0;
|
||||
} else if ($input == Py_None) {
|
||||
$1 = NULL;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"not a list");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//%typecheck(SWIG_TYPECHECK_STRING_ARRAY) (const char *symbol_name[], uint32_t num_names) {
|
||||
// $1 = 1;
|
||||
// $2 = 1;
|
||||
//}
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByNames (const char *symbol_name[],
|
||||
BreakpointCreateByNames (const char **symbol_name,
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByNames (const char *symbol_name[],
|
||||
BreakpointCreateByNames (const char **symbol_name,
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
lldb::LanguageType symbol_language,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByNames (const char **symbol_name,
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
lldb::LanguageType symbol_language,
|
||||
lldb::addr_t offset,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
|
||||
|
||||
|
@ -798,6 +798,14 @@ SBTarget::BreakpointCreateByLocation (const char *file,
|
||||
SBBreakpoint
|
||||
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
|
||||
uint32_t line)
|
||||
{
|
||||
return BreakpointCreateByLocation(sb_file_spec, line, 0);
|
||||
}
|
||||
|
||||
SBBreakpoint
|
||||
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
|
||||
uint32_t line,
|
||||
lldb::addr_t offset)
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
@ -812,7 +820,15 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
|
||||
const bool internal = false;
|
||||
const bool hardware = false;
|
||||
const LazyBool move_to_nearest_code = eLazyBoolCalculate;
|
||||
*sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal, hardware, move_to_nearest_code);
|
||||
*sb_bp = target_sp->CreateBreakpoint (NULL,
|
||||
*sb_file_spec,
|
||||
line,
|
||||
offset,
|
||||
check_inlines,
|
||||
skip_prologue,
|
||||
internal,
|
||||
hardware,
|
||||
move_to_nearest_code);
|
||||
}
|
||||
|
||||
if (log)
|
||||
@ -844,15 +860,16 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
|
||||
const bool internal = false;
|
||||
const bool hardware = false;
|
||||
const LazyBool skip_prologue = eLazyBoolCalculate;
|
||||
const lldb::addr_t offset = 0;
|
||||
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, eLanguageTypeUnknown, skip_prologue, internal, hardware);
|
||||
*sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
|
||||
}
|
||||
else
|
||||
{
|
||||
*sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, skip_prologue, internal, hardware);
|
||||
*sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,6 +921,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
|
||||
symbol_name,
|
||||
name_type_mask,
|
||||
symbol_language,
|
||||
0,
|
||||
skip_prologue,
|
||||
internal,
|
||||
hardware);
|
||||
@ -934,6 +952,18 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
|
||||
LanguageType symbol_language,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list)
|
||||
{
|
||||
return BreakpointCreateByNames(symbol_names, num_names, name_type_mask, eLanguageTypeUnknown, 0, module_list, comp_unit_list);
|
||||
}
|
||||
|
||||
lldb::SBBreakpoint
|
||||
SBTarget::BreakpointCreateByNames (const char *symbol_names[],
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask,
|
||||
LanguageType symbol_language,
|
||||
lldb::addr_t offset,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list)
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
@ -949,8 +979,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
|
||||
comp_unit_list.get(),
|
||||
symbol_names,
|
||||
num_names,
|
||||
name_type_mask,
|
||||
name_type_mask,
|
||||
symbol_language,
|
||||
offset,
|
||||
skip_prologue,
|
||||
internal,
|
||||
hardware);
|
||||
|
@ -32,8 +32,9 @@ using namespace lldb;
|
||||
//----------------------------------------------------------------------
|
||||
// BreakpointResolver:
|
||||
//----------------------------------------------------------------------
|
||||
BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy) :
|
||||
BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy, lldb::addr_t offset) :
|
||||
m_breakpoint (bkpt),
|
||||
m_offset(offset),
|
||||
SubclassID (resolverTy)
|
||||
{
|
||||
}
|
||||
@ -176,7 +177,7 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
|
||||
}
|
||||
}
|
||||
|
||||
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(line_start));
|
||||
BreakpointLocationSP bp_loc_sp (AddLocation(line_start));
|
||||
if (log && bp_loc_sp && !m_breakpoint->IsInternal())
|
||||
{
|
||||
StreamString s;
|
||||
@ -202,3 +203,22 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BreakpointLocationSP
|
||||
BreakpointResolver::AddLocation(Address loc_addr, bool *new_location)
|
||||
{
|
||||
loc_addr.Slide(m_offset);
|
||||
return m_breakpoint->AddLocation(loc_addr, new_location);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BreakpointResolver::SetOffset (lldb::addr_t offset)
|
||||
{
|
||||
// There may already be an offset, so we are actually adjusting location addresses by the difference.
|
||||
// lldb::addr_t slide = offset - m_offset;
|
||||
// FIXME: We should go fix up all the already set locations for the new slide.
|
||||
|
||||
m_offset = offset;
|
||||
}
|
||||
|
||||
|
@ -121,8 +121,8 @@ BreakpointResolverAddress::SearchCallback
|
||||
}
|
||||
}
|
||||
|
||||
BreakpointLocationSP bp_loc_sp(m_breakpoint->AddLocation(m_addr));
|
||||
m_resolved_addr = m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
|
||||
BreakpointLocationSP bp_loc_sp(AddLocation(m_addr));
|
||||
if (bp_loc_sp && !m_breakpoint->IsInternal())
|
||||
{
|
||||
StreamString s;
|
||||
|
@ -31,11 +31,12 @@ BreakpointResolverFileLine::BreakpointResolverFileLine
|
||||
Breakpoint *bkpt,
|
||||
const FileSpec &file_spec,
|
||||
uint32_t line_no,
|
||||
lldb::addr_t offset,
|
||||
bool check_inlines,
|
||||
bool skip_prologue,
|
||||
bool exact_match
|
||||
) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),
|
||||
BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver, offset),
|
||||
m_file_spec (file_spec),
|
||||
m_line_number (line_no),
|
||||
m_inlines (check_inlines),
|
||||
@ -117,6 +118,7 @@ BreakpointResolverFileLine::CopyForBreakpoint (Breakpoint &breakpoint)
|
||||
lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine(&breakpoint,
|
||||
m_file_spec,
|
||||
m_line_number,
|
||||
m_offset,
|
||||
m_inlines,
|
||||
m_skip_prologue,
|
||||
m_exact_match));
|
||||
|
@ -31,8 +31,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
uint32_t name_type_mask,
|
||||
LanguageType language,
|
||||
Breakpoint::MatchType type,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
|
||||
m_class_name (),
|
||||
m_regex (),
|
||||
m_match_type (type),
|
||||
@ -60,8 +61,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
size_t num_names,
|
||||
uint32_t name_type_mask,
|
||||
LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
|
||||
m_match_type (Breakpoint::Exact),
|
||||
m_language (language),
|
||||
m_skip_prologue (skip_prologue)
|
||||
@ -76,8 +78,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
std::vector<std::string> names,
|
||||
uint32_t name_type_mask,
|
||||
LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
|
||||
m_match_type (Breakpoint::Exact),
|
||||
m_language (language),
|
||||
m_skip_prologue (skip_prologue)
|
||||
@ -91,8 +94,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
RegularExpression &func_regex,
|
||||
lldb::LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
|
||||
m_class_name (nullptr),
|
||||
m_regex (func_regex),
|
||||
m_match_type (Breakpoint::Regexp),
|
||||
@ -101,12 +105,16 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
|
||||
{
|
||||
}
|
||||
|
||||
BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt,
|
||||
const char *class_name,
|
||||
const char *method,
|
||||
Breakpoint::MatchType type,
|
||||
bool skip_prologue ) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
|
||||
BreakpointResolverName::BreakpointResolverName
|
||||
(
|
||||
Breakpoint *bkpt,
|
||||
const char *class_name,
|
||||
const char *method,
|
||||
Breakpoint::MatchType type,
|
||||
lldb::addr_t offset,
|
||||
bool skip_prologue
|
||||
) :
|
||||
BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
|
||||
m_class_name (class_name),
|
||||
m_regex (),
|
||||
m_match_type (type),
|
||||
@ -124,7 +132,7 @@ BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt,
|
||||
BreakpointResolverName::~BreakpointResolverName() = default;
|
||||
|
||||
BreakpointResolverName::BreakpointResolverName(const BreakpointResolverName &rhs) :
|
||||
BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver),
|
||||
BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver, rhs.m_offset),
|
||||
m_lookups(rhs.m_lookups),
|
||||
m_class_name(rhs.m_class_name),
|
||||
m_regex(rhs.m_regex),
|
||||
@ -344,7 +352,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
|
||||
{
|
||||
if (filter.AddressPasses(break_addr))
|
||||
{
|
||||
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
|
||||
BreakpointLocationSP bp_loc_sp (AddLocation(break_addr, &new_location));
|
||||
bp_loc_sp->SetIsReExported(is_reexported);
|
||||
if (bp_loc_sp && new_location && !m_breakpoint->IsInternal())
|
||||
{
|
||||
|
@ -277,6 +277,16 @@ public:
|
||||
m_breakpoint_names.push_back (option_arg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
{
|
||||
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
|
||||
lldb::addr_t tmp_offset_addr;
|
||||
tmp_offset_addr = Args::StringToAddress(&exe_ctx, option_arg, 0, &error);
|
||||
if (error.Success())
|
||||
m_offset_addr = tmp_offset_addr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
m_one_shot = true;
|
||||
break;
|
||||
@ -353,6 +363,7 @@ public:
|
||||
m_source_text_regexp.clear();
|
||||
m_modules.Clear();
|
||||
m_load_addr = LLDB_INVALID_ADDRESS;
|
||||
m_offset_addr = 0;
|
||||
m_ignore_count = 0;
|
||||
m_thread_id = LLDB_INVALID_THREAD_ID;
|
||||
m_thread_index = UINT32_MAX;
|
||||
@ -395,6 +406,7 @@ public:
|
||||
std::string m_source_text_regexp;
|
||||
FileSpecList m_modules;
|
||||
lldb::addr_t m_load_addr;
|
||||
lldb::addr_t m_offset_addr;
|
||||
uint32_t m_ignore_count;
|
||||
lldb::tid_t m_thread_id;
|
||||
uint32_t m_thread_index;
|
||||
@ -453,6 +465,10 @@ protected:
|
||||
Breakpoint *bp = nullptr;
|
||||
FileSpec module_spec;
|
||||
const bool internal = false;
|
||||
|
||||
// If the user didn't specify skip-prologue, having an offset should turn that off.
|
||||
if (m_options.m_offset_addr != 0 && m_options.m_skip_prologue == eLazyBoolCalculate)
|
||||
m_options.m_skip_prologue = eLazyBoolNo;
|
||||
|
||||
switch (break_type)
|
||||
{
|
||||
@ -484,6 +500,7 @@ protected:
|
||||
bp = target->CreateBreakpoint (&(m_options.m_modules),
|
||||
file,
|
||||
m_options.m_line_num,
|
||||
m_options.m_offset_addr,
|
||||
check_inlines,
|
||||
m_options.m_skip_prologue,
|
||||
internal,
|
||||
@ -531,6 +548,7 @@ protected:
|
||||
m_options.m_func_names,
|
||||
name_type_mask,
|
||||
m_options.m_language,
|
||||
m_options.m_offset_addr,
|
||||
m_options.m_skip_prologue,
|
||||
internal,
|
||||
m_options.m_hardware).get();
|
||||
@ -725,6 +743,7 @@ private:
|
||||
#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) )
|
||||
#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
|
||||
#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 )
|
||||
#define LLDB_OPT_EXPR_LANGUAGE ( LLDB_OPT_SET_FROM_TO(3, 8) )
|
||||
|
||||
@ -838,6 +857,10 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
|
||||
{ LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName,
|
||||
"Adds this to the list of names for this breakopint."},
|
||||
|
||||
{ LLDB_OPT_OFFSET_APPLIES, false, "address-slide", 'R', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress,
|
||||
"Add the specified offset to whatever address(es) the breakpoint resolves to. "
|
||||
"At present this applies the offset directly as given, and doesn't try to align it to instruction boundaries."},
|
||||
|
||||
{ LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
|
||||
"Move breakpoints to nearest code. If not set the target.move-to-nearest-code setting is used." },
|
||||
|
||||
|
@ -5278,6 +5278,7 @@ public:
|
||||
BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint (NULL, // Don't limit the breakpoint to certain modules
|
||||
m_file_sp->GetFileSpec(), // Source file
|
||||
m_selected_line + 1, // Source line number (m_selected_line is zero based)
|
||||
0, // No offset
|
||||
eLazyBoolCalculate, // Check inlines using global setting
|
||||
eLazyBoolCalculate, // Skip prologue using global setting,
|
||||
false, // internal
|
||||
@ -5314,6 +5315,7 @@ public:
|
||||
BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint (NULL, // Don't limit the breakpoint to certain modules
|
||||
m_file_sp->GetFileSpec(), // Source file
|
||||
m_selected_line + 1, // Source line number (m_selected_line is zero based)
|
||||
0, // No offset
|
||||
eLazyBoolCalculate, // Check inlines using global setting
|
||||
eLazyBoolCalculate, // Skip prologue using global setting,
|
||||
false, // internal
|
||||
|
@ -1551,6 +1551,7 @@ DynamicLoaderDarwinKernel::SetNotificationBreakpointIfNeeded ()
|
||||
"OSKextLoadedKextSummariesUpdated",
|
||||
eFunctionNameTypeFull,
|
||||
eLanguageTypeUnknown,
|
||||
0,
|
||||
skip_prologue,
|
||||
internal_bp,
|
||||
hardware).get();
|
||||
|
@ -412,6 +412,7 @@ ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch
|
||||
exception_names.size(),
|
||||
eFunctionNameTypeBase,
|
||||
eLanguageTypeUnknown,
|
||||
0,
|
||||
eLazyBoolNo));
|
||||
|
||||
return resolver_sp;
|
||||
|
@ -136,6 +136,7 @@ AppleObjCRuntimeV1::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bo
|
||||
eFunctionNameTypeBase,
|
||||
eLanguageTypeUnknown,
|
||||
Breakpoint::Exact,
|
||||
0,
|
||||
eLazyBoolNo));
|
||||
// FIXME: don't do catch yet.
|
||||
return resolver_sp;
|
||||
|
@ -730,6 +730,7 @@ AppleObjCRuntimeV2::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bo
|
||||
eFunctionNameTypeBase,
|
||||
eLanguageTypeUnknown,
|
||||
Breakpoint::Exact,
|
||||
0,
|
||||
eLazyBoolNo));
|
||||
// FIXME: We don't do catch breakpoints for ObjC yet.
|
||||
// Should there be some way for the runtime to specify what it can do in this regard?
|
||||
|
@ -1157,6 +1157,7 @@ PlatformDarwin::SetThreadCreationBreakpoint (Target &target)
|
||||
llvm::array_lengthof(g_bp_names),
|
||||
eFunctionNameTypeFull,
|
||||
eLanguageTypeUnknown,
|
||||
0,
|
||||
skip_prologue,
|
||||
internal,
|
||||
hardware);
|
||||
|
@ -342,6 +342,7 @@ BreakpointSP
|
||||
Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
const FileSpec &file,
|
||||
uint32_t line_no,
|
||||
lldb::addr_t offset,
|
||||
LazyBool check_inlines,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
@ -393,12 +394,13 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
if (move_to_nearest_code == eLazyBoolCalculate)
|
||||
move_to_nearest_code = GetMoveToNearestCode() ? eLazyBoolYes : eLazyBoolNo;
|
||||
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine(nullptr,
|
||||
remapped_file,
|
||||
line_no,
|
||||
check_inlines,
|
||||
skip_prologue,
|
||||
!static_cast<bool>(move_to_nearest_code)));
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (nullptr,
|
||||
remapped_file,
|
||||
line_no,
|
||||
offset,
|
||||
check_inlines,
|
||||
skip_prologue,
|
||||
!static_cast<bool>(move_to_nearest_code)));
|
||||
return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
|
||||
}
|
||||
|
||||
@ -447,8 +449,9 @@ BreakpointSP
|
||||
Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
const FileSpecList *containingSourceFiles,
|
||||
const char *func_name,
|
||||
uint32_t func_name_type_mask,
|
||||
uint32_t func_name_type_mask,
|
||||
LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool hardware)
|
||||
@ -463,12 +466,13 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
if (language == lldb::eLanguageTypeUnknown)
|
||||
language = GetLanguage();
|
||||
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverName(nullptr,
|
||||
func_name,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
Breakpoint::Exact,
|
||||
skip_prologue));
|
||||
BreakpointResolverSP resolver_sp (new BreakpointResolverName (nullptr,
|
||||
func_name,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
Breakpoint::Exact,
|
||||
offset,
|
||||
skip_prologue));
|
||||
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
|
||||
}
|
||||
return bp_sp;
|
||||
@ -480,6 +484,7 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
const std::vector<std::string> &func_names,
|
||||
uint32_t func_name_type_mask,
|
||||
LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool hardware)
|
||||
@ -495,11 +500,13 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
if (language == lldb::eLanguageTypeUnknown)
|
||||
language = GetLanguage();
|
||||
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverName(nullptr,
|
||||
func_names,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
skip_prologue));
|
||||
|
||||
BreakpointResolverSP resolver_sp (new BreakpointResolverName (nullptr,
|
||||
func_names,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
offset,
|
||||
skip_prologue));
|
||||
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
|
||||
}
|
||||
return bp_sp;
|
||||
@ -510,8 +517,9 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
const FileSpecList *containingSourceFiles,
|
||||
const char *func_names[],
|
||||
size_t num_names,
|
||||
uint32_t func_name_type_mask,
|
||||
uint32_t func_name_type_mask,
|
||||
LanguageType language,
|
||||
lldb::addr_t offset,
|
||||
LazyBool skip_prologue,
|
||||
bool internal,
|
||||
bool hardware)
|
||||
@ -522,16 +530,23 @@ Target::CreateBreakpoint (const FileSpecList *containingModules,
|
||||
SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
|
||||
|
||||
if (skip_prologue == eLazyBoolCalculate)
|
||||
skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
|
||||
{
|
||||
if (offset == 0)
|
||||
skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo;
|
||||
else
|
||||
skip_prologue = eLazyBoolNo;
|
||||
}
|
||||
if (language == lldb::eLanguageTypeUnknown)
|
||||
language = GetLanguage();
|
||||
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverName(nullptr,
|
||||
func_names,
|
||||
num_names,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
skip_prologue));
|
||||
BreakpointResolverSP resolver_sp (new BreakpointResolverName (nullptr,
|
||||
func_names,
|
||||
num_names,
|
||||
func_name_type_mask,
|
||||
language,
|
||||
offset,
|
||||
skip_prologue));
|
||||
resolver_sp->SetOffset(offset);
|
||||
bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
|
||||
}
|
||||
return bp_sp;
|
||||
@ -610,10 +625,11 @@ Target::CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
|
||||
bool skip =
|
||||
(skip_prologue == eLazyBoolCalculate) ? GetSkipPrologue()
|
||||
: static_cast<bool>(skip_prologue);
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverName(nullptr,
|
||||
func_regex,
|
||||
requested_language,
|
||||
skip));
|
||||
BreakpointResolverSP resolver_sp(new BreakpointResolverName (nullptr,
|
||||
func_regex,
|
||||
requested_language,
|
||||
0,
|
||||
skip));
|
||||
|
||||
return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user