Add a scripted way to re-present a stop location (#158128)
This patch adds the notion of "Facade" locations which can be reported from a ScriptedResolver instead of the actual underlying breakpoint location for the breakpoint. Also add a "was_hit" method to the scripted resolver that allows the breakpoint to say which of these "Facade" locations was hit, and "get_location_description" to provide a description for the facade locations. I apologize in advance for the size of the patch. Almost all of what's here was necessary to (a) make the feature testable and (b) not break any of the current behavior. The motivation for this feature is given in the "Providing Facade Locations" section that I added to the python-reference.rst so I won't repeat it here. rdar://152112327
This commit is contained in:
1 parent
c4f36758b7
commit
36bce68b97
37 files changed
+865
-146
No files matched your search
+26
@@ -81,6 +81,32 @@ std::optional<std::string> ScriptedBreakpointPythonInterface::GetShortHelp() {
|
||||
return obj->GetAsString()->GetValue().str();
|
||||
}
|
||||
|
||||
lldb::BreakpointLocationSP ScriptedBreakpointPythonInterface::WasHit(
|
||||
lldb::StackFrameSP frame_sp, lldb::BreakpointLocationSP bp_loc_sp) {
|
||||
Status py_error;
|
||||
lldb::BreakpointLocationSP loc_sp = Dispatch<lldb::BreakpointLocationSP>(
|
||||
"was_hit", py_error, frame_sp, bp_loc_sp);
|
||||
|
||||
if (py_error.Fail())
|
||||
return bp_loc_sp;
|
||||
|
||||
return loc_sp;
|
||||
}
|
||||
|
||||
std::optional<std::string>
|
||||
ScriptedBreakpointPythonInterface::GetLocationDescription(
|
||||
lldb::BreakpointLocationSP bp_loc_sp, lldb::DescriptionLevel level) {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj =
|
||||
Dispatch("get_location_description", error, bp_loc_sp, level);
|
||||
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return obj->GetAsString()->GetValue().str();
|
||||
}
|
||||
|
||||
void ScriptedBreakpointPythonInterface::Initialize() {
|
||||
const std::vector<llvm::StringRef> ci_usages = {
|
||||
"breakpoint set -P classname [-k key -v value ...]"};
|
||||
|
||||
Reference in new issue
Block a user