-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Introduce Swift "task info" command #9875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,27 @@ | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import TestBase | ||
import lldbsuite.test.lldbutil as lldbutil | ||
|
||
import re | ||
|
||
|
||
def _tail(output): | ||
"""Delete the first line of output text.""" | ||
result, _ = re.subn(r"^.*\n", "", output, count=1) | ||
return result | ||
|
||
|
||
class TestCase(TestBase): | ||
|
||
@skipUnlessDarwin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this conceptual for the features tested in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is specific to this |
||
def test(self): | ||
self.build() | ||
lldbutil.run_to_source_breakpoint( | ||
self, "break here", lldb.SBFileSpec("main.swift") | ||
) | ||
self.runCmd("frame variable task") | ||
adrian-prantl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
frame_variable_output = self.res.GetOutput() | ||
self.runCmd("language swift task info") | ||
task_info_output = self.res.GetOutput() | ||
self.assertEqual(_tail(task_info_output), _tail(frame_variable_output)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@main struct Main { | ||
static func main() async { | ||
withUnsafeCurrentTask { task in | ||
if let task { | ||
print("break here") | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you flipped the condition later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
swift::tis_get_key
function is available only on Darwin. UsingSWIFT_THREADING_USE_RESERVED_TLS_KEYS
is to ensure thatswift::tls_get_key
exists. If that compiler condition is false, then this function (GetTaskAddrFromThreadLocalStorage
) will return an error. On Linux and Windows we'll need to figure out how to implement this, wherethread_local
variables are used instead of TSD.