aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2025-04-02 12:48:57 +0200
committerGitHub <noreply@github.com>2025-04-02 12:48:57 +0200
commitd7afafdbc464e65c56a0a1d77bad426aa7538306 (patch)
tree3d1856a1ad12a4f45e44153c8fa8e6ff78dc06c7 /lldb/source/Commands/CommandObjectTarget.cpp
parentf066d7504e736f7dc8bee3b9c514a86e229fd622 (diff)
downloadllvm-d7afafdbc464e65c56a0a1d77bad426aa7538306.zip
llvm-d7afafdbc464e65c56a0a1d77bad426aa7538306.tar.gz
llvm-d7afafdbc464e65c56a0a1d77bad426aa7538306.tar.bz2
[lldb] Return *const* UnwindPlan pointers from FuncUnwinders (#133247)
These plans are cached and accessed from multiple threads. Modifying them would be a Bad Idea(tm).
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp106
1 files changed, 49 insertions, 57 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index c77bddb..3f7d300 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3641,77 +3641,70 @@ protected:
result.GetOutputStream().Printf("\n");
- UnwindPlanSP non_callsite_unwind_plan =
- func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread);
- if (non_callsite_unwind_plan) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread)) {
result.GetOutputStream().Printf(
"Asynchronous (not restricted to call-sites) UnwindPlan is '%s'\n",
- non_callsite_unwind_plan->GetSourceName().AsCString());
+ plan_sp->GetSourceName().AsCString());
}
- UnwindPlanSP callsite_unwind_plan =
- func_unwinders_sp->GetUnwindPlanAtCallSite(*target, *thread);
- if (callsite_unwind_plan) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetUnwindPlanAtCallSite(*target, *thread)) {
result.GetOutputStream().Printf(
"Synchronous (restricted to call-sites) UnwindPlan is '%s'\n",
- callsite_unwind_plan->GetSourceName().AsCString());
+ plan_sp->GetSourceName().AsCString());
}
- UnwindPlanSP fast_unwind_plan =
- func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread);
- if (fast_unwind_plan) {
- result.GetOutputStream().Printf(
- "Fast UnwindPlan is '%s'\n",
- fast_unwind_plan->GetSourceName().AsCString());
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread)) {
+ result.GetOutputStream().Printf("Fast UnwindPlan is '%s'\n",
+ plan_sp->GetSourceName().AsCString());
}
result.GetOutputStream().Printf("\n");
- UnwindPlanSP assembly_sp =
- func_unwinders_sp->GetAssemblyUnwindPlan(*target, *thread);
- if (assembly_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetAssemblyUnwindPlan(*target, *thread)) {
result.GetOutputStream().Printf(
"Assembly language inspection UnwindPlan:\n");
- assembly_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP of_unwind_sp =
- func_unwinders_sp->GetObjectFileUnwindPlan(*target);
- if (of_unwind_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetObjectFileUnwindPlan(*target)) {
result.GetOutputStream().Printf("object file UnwindPlan:\n");
- of_unwind_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP of_unwind_augmented_sp =
- func_unwinders_sp->GetObjectFileAugmentedUnwindPlan(*target, *thread);
- if (of_unwind_augmented_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetObjectFileAugmentedUnwindPlan(*target,
+ *thread)) {
result.GetOutputStream().Printf("object file augmented UnwindPlan:\n");
- of_unwind_augmented_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP ehframe_sp =
- func_unwinders_sp->GetEHFrameUnwindPlan(*target);
- if (ehframe_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetEHFrameUnwindPlan(*target)) {
result.GetOutputStream().Printf("eh_frame UnwindPlan:\n");
- ehframe_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP ehframe_augmented_sp =
- func_unwinders_sp->GetEHFrameAugmentedUnwindPlan(*target, *thread);
- if (ehframe_augmented_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetEHFrameAugmentedUnwindPlan(*target,
+ *thread)) {
result.GetOutputStream().Printf("eh_frame augmented UnwindPlan:\n");
- ehframe_augmented_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- if (UnwindPlanSP plan_sp =
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
func_unwinders_sp->GetDebugFrameUnwindPlan(*target)) {
result.GetOutputStream().Printf("debug_frame UnwindPlan:\n");
plan_sp->Dump(result.GetOutputStream(), thread.get(),
@@ -3719,7 +3712,7 @@ protected:
result.GetOutputStream().Printf("\n");
}
- if (UnwindPlanSP plan_sp =
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
func_unwinders_sp->GetDebugFrameAugmentedUnwindPlan(*target,
*thread)) {
result.GetOutputStream().Printf("debug_frame augmented UnwindPlan:\n");
@@ -3728,36 +3721,35 @@ protected:
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP arm_unwind_sp =
- func_unwinders_sp->GetArmUnwindUnwindPlan(*target);
- if (arm_unwind_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetArmUnwindUnwindPlan(*target)) {
result.GetOutputStream().Printf("ARM.exidx unwind UnwindPlan:\n");
- arm_unwind_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- if (UnwindPlanSP symfile_plan_sp =
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
func_unwinders_sp->GetSymbolFileUnwindPlan(*thread)) {
result.GetOutputStream().Printf("Symbol file UnwindPlan:\n");
- symfile_plan_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- UnwindPlanSP compact_unwind_sp =
- func_unwinders_sp->GetCompactUnwindUnwindPlan(*target);
- if (compact_unwind_sp) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetCompactUnwindUnwindPlan(*target)) {
result.GetOutputStream().Printf("Compact unwind UnwindPlan:\n");
- compact_unwind_sp->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}
- if (fast_unwind_plan) {
+ if (std::shared_ptr<const UnwindPlan> plan_sp =
+ func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread)) {
result.GetOutputStream().Printf("Fast UnwindPlan:\n");
- fast_unwind_plan->Dump(result.GetOutputStream(), thread.get(),
- LLDB_INVALID_ADDRESS);
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
result.GetOutputStream().Printf("\n");
}