vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

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

Open ahoppen opened 7 months ago

ahoppen commented 7 months ago

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()


3. Open `/tmp/pck` in VS Code
4. Install the [Swift extension](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang)
5. Set a breakpoint on line 2 `print("hello world")`
6. Debug the `pck` executable
vadimcn commented 7 months ago

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...

adam-fowler commented 7 months ago

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.