Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lldb/include/lldb/Target/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ProcessProperties : public Properties {
void SetStopOnSharedLibraryEvents(bool stop);
bool GetDisableLangRuntimeUnwindPlans() const;
void SetDisableLangRuntimeUnwindPlans(bool disable);
void DisableLanguageRuntimeUnwindPlansCallback();
bool GetDetachKeepsStopped() const;
void SetDetachKeepsStopped(bool keep_stopped);
bool GetWarningsOptimization() const;
Expand Down
12 changes: 12 additions & 0 deletions lldb/source/Target/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process)
m_collection_sp->SetValueChangedCallback(
ePropertyPythonOSPluginPath,
[this] { m_process->LoadOperatingSystemPlugin(true); });
m_collection_sp->SetValueChangedCallback(
ePropertyDisableLangRuntimeUnwindPlans,
[this] { DisableLanguageRuntimeUnwindPlansCallback(); });
}

m_experimental_properties_up =
Expand Down Expand Up @@ -321,6 +324,15 @@ void ProcessProperties::SetDisableLangRuntimeUnwindPlans(bool disable) {
m_process->Flush();
}

void ProcessProperties::DisableLanguageRuntimeUnwindPlansCallback() {
if (!m_process)
return;
for (auto thread_sp : m_process->Threads()) {
thread_sp->ClearStackFrames();
thread_sp->DiscardThreadPlans(/*force*/ true);
}
}

bool ProcessProperties::GetDetachKeepsStopped() const {
const uint32_t idx = ePropertyDetachKeepsStopped;
return GetPropertyAtIndexAs<bool>(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SWIFT_SOURCES := main.swift
SWIFTFLAGS_EXTRAS := -parse-as-library
include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbtest as lldbtest
import lldbsuite.test.lldbutil as lldbutil

class TestDisableLanguageUnwinder(lldbtest.TestBase):

@swiftTest
@skipIf(oslist=['windows', 'linux'])
def test(self):
"""Test async unwind"""
self.build()
src = lldb.SBFileSpec('main.swift')
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, 'break here', src)

self.assertIn("syncFunc", thread.GetFrameAtIndex(0).GetFunctionName())
self.assertIn("callSyncFunc", thread.GetFrameAtIndex(1).GetFunctionName())
self.assertIn("main", thread.GetFrameAtIndex(2).GetFunctionName())

self.runCmd("settings set target.process.disable-language-runtime-unwindplans true")

self.assertIn("syncFunc", thread.GetFrameAtIndex(0).GetFunctionName())
self.assertIn("callSyncFunc", thread.GetFrameAtIndex(1).GetFunctionName())
self.assertNotIn("main", thread.GetFrameAtIndex(2).GetFunctionName())
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
func syncFunc() {
print("break here")
}

func callSyncFunc() async {
syncFunc()
}

@main struct Main {
static func main() async {
await callSyncFunc()
}
}