[Lldb-commits] [lldb] dd453a1 - Add setting to disable LanguageRuntime UnwindPlans

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 8 13:30:22 PDT 2021


Author: Jason Molenda
Date: 2021-04-08T13:28:59-07:00
New Revision: dd453a1389b6a7e6d9214b449d3c54981b1a89b6

URL: https://github.com/llvm/llvm-project/commit/dd453a1389b6a7e6d9214b449d3c54981b1a89b6
DIFF: https://github.com/llvm/llvm-project/commit/dd453a1389b6a7e6d9214b449d3c54981b1a89b6.diff

LOG: 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

Added: 
    

Modified: 
    lldb/include/lldb/Target/Process.h
    lldb/source/Target/LanguageRuntime.cpp
    lldb/source/Target/Process.cpp
    lldb/source/Target/TargetProperties.td

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index dbe61d892c499..abd0d39fe9699 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -84,6 +84,8 @@ class ProcessProperties : public Properties {
   void SetUnwindOnErrorInExpressions(bool ignore);
   bool GetStopOnSharedLibraryEvents() const;
   void SetStopOnSharedLibraryEvents(bool stop);
+  bool GetDisableLangRuntimeUnwindPlans() const;
+  void SetDisableLangRuntimeUnwindPlans(bool disable);
   bool GetDetachKeepsStopped() const;
   void SetDetachKeepsStopped(bool keep_stopped);
   bool GetWarningsOptimization() const;

diff  --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp
index 1fbe94b7f535e..be878d69fa00d 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -265,6 +265,8 @@ LanguageRuntime::GetRuntimeUnwindPlan(Thread &thread, RegisterContext *regctx,
   ProcessSP process_sp = thread.GetProcess();
   if (!process_sp.get())
     return UnwindPlanSP();
+  if (process_sp->GetDisableLangRuntimeUnwindPlans() == true)
+    return UnwindPlanSP();
   for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) {
     if (LanguageRuntime *runtime = process_sp->GetLanguageRuntime(lang_type)) {
       UnwindPlanSP plan_sp = runtime->GetRuntimeUnwindPlan(

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 6db410fa6bf0e..4e01c3bbbf4f7 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -238,6 +238,18 @@ void ProcessProperties::SetStopOnSharedLibraryEvents(bool stop) {
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, stop);
 }
 
+bool ProcessProperties::GetDisableLangRuntimeUnwindPlans() const {
+  const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+      nullptr, idx, g_process_properties[idx].default_uint_value != 0);
+}
+
+void ProcessProperties::SetDisableLangRuntimeUnwindPlans(bool disable) {
+  const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, disable);
+  m_process->Flush();
+}
+
 bool ProcessProperties::GetDetachKeepsStopped() const {
   const uint32_t idx = ePropertyDetachKeepsStopped;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(

diff  --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index 030c0a7917e82..e22f94069131a 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -206,6 +206,10 @@ let Definition = "process" in {
     Global,
     DefaultFalse,
     Desc<"If true, stop when a shared library is loaded or unloaded.">;
+  def DisableLangRuntimeUnwindPlans: Property<"disable-language-runtime-unwindplans", "Boolean">,
+    Global,
+    DefaultFalse,
+    Desc<"If true, LanguageRuntime plugins' UnwindPlans will not be used when backtracing.">;
   def DetachKeepsStopped: Property<"detach-keeps-stopped", "Boolean">,
     Global,
     DefaultFalse,


        


More information about the lldb-commits mailing list