Skip to content

Commit 844fff6

Browse files
committed
Add setting to disable LanguageRuntime UnwindPlans
When debugging LanguageRuntime unwindplans, it can be helpful to disable their use and see the normal stack walk. Add a setting for this. Differential Revision: https://reviews.llvm.org/D99828 (cherry picked from commit dd453a1)
1 parent d2c157e commit 844fff6

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class ProcessProperties : public Properties {
8585
void SetUnwindOnErrorInExpressions(bool ignore);
8686
bool GetStopOnSharedLibraryEvents() const;
8787
void SetStopOnSharedLibraryEvents(bool stop);
88+
bool GetDisableLangRuntimeUnwindPlans() const;
89+
void SetDisableLangRuntimeUnwindPlans(bool disable);
8890
bool GetDetachKeepsStopped() const;
8991
void SetDetachKeepsStopped(bool keep_stopped);
9092
bool GetWarningsOptimization() const;

lldb/source/Target/LanguageRuntime.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ LanguageRuntime::GetRuntimeUnwindPlan(Thread &thread, RegisterContext *regctx,
265265
ProcessSP process_sp = thread.GetProcess();
266266
if (!process_sp.get())
267267
return UnwindPlanSP();
268+
if (process_sp->GetDisableLangRuntimeUnwindPlans() == true)
269+
return UnwindPlanSP();
268270
for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) {
269271
if (LanguageRuntime *runtime = process_sp->GetLanguageRuntime(lang_type)) {
270272
UnwindPlanSP plan_sp = runtime->GetRuntimeUnwindPlan(

lldb/source/Target/Process.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,18 @@ void ProcessProperties::SetStopOnSharedLibraryEvents(bool stop) {
242242
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, stop);
243243
}
244244

245+
bool ProcessProperties::GetDisableLangRuntimeUnwindPlans() const {
246+
const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
247+
return m_collection_sp->GetPropertyAtIndexAsBoolean(
248+
nullptr, idx, g_process_properties[idx].default_uint_value != 0);
249+
}
250+
251+
void ProcessProperties::SetDisableLangRuntimeUnwindPlans(bool disable) {
252+
const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
253+
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, disable);
254+
m_process->Flush();
255+
}
256+
245257
bool ProcessProperties::GetDetachKeepsStopped() const {
246258
const uint32_t idx = ePropertyDetachKeepsStopped;
247259
return m_collection_sp->GetPropertyAtIndexAsBoolean(

lldb/source/Target/TargetProperties.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ let Definition = "process" in {
206206
Global,
207207
DefaultFalse,
208208
Desc<"If true, stop when a shared library is loaded or unloaded.">;
209+
def DisableLangRuntimeUnwindPlans: Property<"disable-language-runtime-unwindplans", "Boolean">,
210+
Global,
211+
DefaultFalse,
212+
Desc<"If true, LanguageRuntime plugins' UnwindPlans will not be used when backtracing.">;
209213
def DetachKeepsStopped: Property<"detach-keeps-stopped", "Boolean">,
210214
Global,
211215
DefaultFalse,

0 commit comments

Comments
 (0)