dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.21k stars 1.57k forks source link

Observatory: Support "bt" / "backtrace" command in debugger, consider UI improvements #30798

Open mkustermann opened 7 years ago

mkustermann commented 7 years ago

When debugging an app running on the side today, I've sent SIGQUIT to the process and connected via observatory. At the beginning I was unable to find out how to get the current back trace.

As you can see in this screenshot screenshot

This debugging view looks very much like the one in gdb where one has the source in the upper half and the command line in the lower half. Unfortunately there is for example no "bt" or "backtrace" command for showing the current stack (as in gdb).

The only place where the stack is visible is in the upper window (big difference to gdb). Although very subtle one can see on the side a scroll bar and the fact that there is a Frame 0. After some time I figured out one can scroll down the upper split to see the full backtrace.

As a feature request:

@turnidge I heard you might be the right person to contact?

rmacnak-google commented 7 years ago

Your screenshot is of the backtrace. The first function is simply so large that you have to scroll to see the next frame.

mkustermann commented 7 years ago

Your screenshot is of the backtrace

Clearly my screenshot is not of the backtrace (I cannot see it on the screen), and as explained it is not quite obvious that it appears under the source and one need to scroll down.

Maybe @lukechurch has an idea how we could improve the UI?

turnidge commented 7 years ago

Ok, I take this bug as two pieces of feedback:

  1. You would like a textual bt or backtrace command
  2. You were confused by the stack trace window when you saw it

Adding a textual backtrace command is easy and we can consider it.

On (2), the question is whether this is confusing enough that it is worth calling out in some way or whether most of our users will pick it up quickly. Possibly. Out of curiosity, did you use the "help" command and see the "frame", "up", and "down" commands?

mkustermann commented 7 years ago

Adding a textual backtrace command is easy and we can consider it.

That would be great ! Also because select text & copy & paste doesn't seem to work too well from html code (e.g. it leaves extra empty lines, ...) - it might work much better in the command window.

... worth calling out in some way or whether most of our users will pick it up quickly.

It is quite obvious if the function you break on is very small, because then you can see other frames around it. It just happens that I haven't really used the observatory debugger before and the process I was debugging always paused in large functions.

One way it might look nicer is:

frame0 function       |----------------------------------------
frame1 function       |                                       |
frame2 function       |  ... source lines of selected frame   |         ... other information (e.g. local vars)
frame3 function       |                                       |
frame4 function       |----------------------------------------

Out of curiosity, did you use the "help" command and see the "frame", "up", and "down" commands?

Yes, I used "help" and used "frame"/.../ but all the functions were very big. The problematic process was getting into an bad state with many frames.