codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

Entries in call stack for Swift async functions starts with “await resume partial function for”

Open ahoppen opened this issue 2 years ago • 2 comments

OS: macOS 14.0 VSCode version: 1.84.2 CodeLLDB version: 1.10.0 Compiler: swift-DEVELOPMENT-SNAPSHOT-2023-11-13-a from swift.org Debuggee: A Swift executable

When debugging a Swift executable every async function in the call stack is prefixed with “await resume partial function for”, which takes up valuable space in the call stack view without providing too much value. It would be easier to read the stack traces if that prefix wasn’t there and the entry just included the function’s name (e.g. main() in the screenshot).

Screenshot 2023-12-06 at 13 44 34

Steps to Reproduce

  1. Create a new Swift package using mkdir /tmp/pck; cd /tmp/pck; swift package init --type executable
  2. Change main.swift to
func printHelloWorld() async {
  print("hello world")
}

func main() async {
  await printHelloWorld()
}

await main()
  1. Open /tmp/pck in VS Code
  2. Install the Swift extension
  3. Set a breakpoint on line 2 print("hello world")
  4. Debug the pck executable

ahoppen avatar Dec 06 '23 21:12 ahoppen

It's the function name that swift-lldb (you are loading a custom liblldb, right?) returns for the stack frame. Codelldb just passes that through...

vadimcn avatar Dec 06 '23 22:12 vadimcn

Just to note when running swift lldb outside of VSCode and calling thread backtrace the call stack does not include this text.

I'm not sure how they generate this and how it is different to CodeLLDB.

adam-fowler avatar Dec 07 '23 20:12 adam-fowler