3

How to display stack trace in VS Code?

From display stack trace in VS Code, it says,

When you issue the k, kb, kp, kP, or kv command, a stack trace is displayed in a tabular format. If line loading is enabled, source modules and line numbers are also displayed.

However, I am just not able to make it working. This is what I get when trying with the k, kb, kp, kP, or kv commands:

k
Unable to eval expression: "could not find symbol value for k"
Failed to eval expression:  {
 "symbol": "k",
 "scope": {
  "goroutineID": 1,
  "frame": 0
 }
} 

Eval error: could not find symbol value for k
kb
Unable to eval expression: "could not find symbol value for kb"
Failed to eval expression:  {
 "symbol": "kb",
 "scope": {
  "goroutineID": 1,
  "frame": 0
 }
} 

Eval error: could not find symbol value for kb

~. k c
Unable to eval expression: "1:1: illegal character U+007E '~'"
Failed to eval expression:  {
 "symbol": "~. k c",
 "scope": {
  "goroutineID": 1,
  "frame": 0
 }
} 

Eval error: 1:1: illegal character U+007E '~'

So, how to display stack trace?

3
  • Oh, yeah, you are right. So any way to do it with VsCode? I'm debugging Go code BTW.
    – xpt
    Commented Jul 24, 2018 at 17:01
  • 1
    I typically just go run in the VSCode terminal, then stacktraces are output there Commented Jul 24, 2018 at 17:07
  • Oh, I need to print out stack trace when I'm debugging some complicated Go module so that I can know how I ended up there, even when no (crash) stacktraces are printed to the terminal.
    – xpt
    Commented Jul 31, 2018 at 15:10

1 Answer 1

4

The stacktrace tab is not shown in your case.

To show the panel:

  menu->>View->>Run

The CALL STACK will be shown on the left side panel by default.

Not the answer you're looking for? Browse other questions tagged or ask your own question.