-
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
[lldb] Introduce Swift "task info" command #9875
Conversation
@swift-ci test |
I'm impressed by how pretty and useful the assertEqual() output is! |
agree! |
@swift-ci test macOS |
@swift-ci test |
@swift-ci test |
@swift-ci test linux |
1 similar comment
@swift-ci test linux |
(cherry picked from commit a267f0f947abd97f1b5911bfd6a7be83317aed16)
fedc00b
to
140f2c6
Compare
I modified the commit history of this PR's branch so that I could cleanly cherry pick @felipepiovezan's commit a267f0f947abd97f1b5911bfd6a7be83317aed16 (from #9839). See fedc00b7d8caab509fc7da6b80627a96d5fddb9f for the initial commit history of this PR. |
@swift-ci test |
@swift-ci test macOS |
@@ -2642,30 +2642,32 @@ std::optional<lldb::addr_t> SwiftLanguageRuntime::TrySkipVirtualParentProlog( | |||
return pc_value + prologue_size; | |||
} | |||
|
|||
std::optional<lldb::addr_t> GetTaskAddrFromThreadLocalStorage(Thread &thread) { | |||
llvm::Expected<lldb::addr_t> GetTaskAddrFromThreadLocalStorage(Thread &thread) { | |||
#if SWIFT_THREADING_USE_DIRECT_TSD |
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.
For my own education, what does this mean?
@@ -2643,7 +2705,7 @@ std::optional<lldb::addr_t> SwiftLanguageRuntime::TrySkipVirtualParentProlog( | |||
} | |||
|
|||
llvm::Expected<lldb::addr_t> GetTaskAddrFromThreadLocalStorage(Thread &thread) { | |||
#if SWIFT_THREADING_USE_DIRECT_TSD | |||
#if !SWIFT_THREADING_USE_RESERVED_TLS_KEYS |
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. Using SWIFT_THREADING_USE_RESERVED_TLS_KEYS
is to ensure that swift::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, where thread_local
variables are used instead of TSD.
|
||
class TestCase(TestBase): | ||
|
||
@skipUnlessDarwin |
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.
Is this conceptual for the features tested in async/tasks
? Or is this a workaround for the Windows test failure linked above? In that case, can we mark it xfail
instead, so that it pops up when this is fixed?
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.
this is specific to this task info
command. A thread's current task is stored differently on Darwin, vs other platforms. This PR supports only Darwin, a follow up PR will need to support other platforms.
Adds
language swift task info
, which accesses the thread's currentTask
, and prints the task instance.This is equivalent to using
withUnsafeCurrentTask
, but works without expression evaluation. This lets users print the current task, even when there's noTask
variable to reference.