Hacker News new | ask | show | jobs
by xkriva11 1203 days ago
I'm missing a few other items on this list that I use daily in Pharo

- being able to open the debugger directly from the program. What the "debugger" command does in JavaScript. Conditional breakpoints are easier to work with if they can be directly included in the source code

- be able to open another debugger on top of the code I see in the debugger. I'm doing the stepping, I'm at a certain point in the method, and I can simply mark the part of the method code that has already been executed or is yet to be executed and start stepping it with the next debugger. This is especially useful for code without side effects. Then I can continue stepping the original method.

- be able to have multiple debuggers open and compare their status

- to have more freedom in the visualization of values and objects. Having them open in other windows independent of the original debugger, being able to interact with them using code (which can be debugged independently)

- be able to save the state of the application and debuggers so that for very hard-to-reproduce errors, I can easily recover the hard-to-retrieve state and experiment with it repeatedly without worrying that I won't get the state again right away

2 comments

> Conditional breakpoints are easier to work with if they can be directly included in the source code

The following code (probably, haven't tested it) allows to create a conditional breakpoint only when a certain method is called by tracing down the call stack

  debuggerIsInMethod: aMethodName
  ctx := GRPlatform current thisContext. "grab callstack"
 
  [ctx isNotNil] whileTrue: [
    (aMethodName asSymbol = ctx method selector) ifTrue: [ ^ true ].
    ctx := ctx sender ] ].
  ^ false
So in another method you can send (call the method) that's deeper in the call stack by doing:

  someMethod
    "do work"
    debuggerIsInYourMethod: 'aMethodHigherUpTheCallStack' ifTrue: [ 1 halt ].
    "do more work"
Use case: Suppose someMethod is being sent/called from everywhere, but you only want to debug it when aMethodHigherUpTheCallStack is sent/called. With this conditional breakpoint (in code), you can :)
Most record-and-replay debuggers let you store the recording to debug as many times as you want.

Pernosco (which builds on rr) has some really powerful state-recording and state-sharing UI for long-term and collaborative debugging. https://pernos.co/about/notebook/