News for hackers. Stuff that matters.
Re:Show HN: Time travel debugger for web development by mysterydip on Wednesday September 15, 2021 @10:58AM (#28539981)
The problem with breakpoints is my loop runs 1000 times and I only care about the one time it errors. Making watch logic for that sometimes is too complicated or changes the outcome (race conditions especially). This seems like a great solution. I'll be checking it out!
Re:Show HN: Time travel debugger for web development by Lio on Wednesday September 15, 2021 @01:35PM (#28542015)
If you can trigger a debugger from a keyword it's usually pretty easy to trigger it conditionally or on an exception in the code rather than through a GUI.

That works well for ruby and javascript and probably lots of others.

e.g. something like the equivalent of

  def foo
    bar.map do |b|
     b.do_something!
     debugger if b.state == :something_youre_interested_in
    end
  rescue => e
   debugger
  end

I'm really excited by Replay. I think it will be invaluable.
Re:Show HN: Time travel debugger for web development by lovegoblin on Wednesday September 15, 2021 @05:37PM (#28544699)
Yes, but I think this is what they meant by

> Making watch logic for that sometimes is too complicated or changes the outcome (race conditions especially).

Re:Show HN: Time travel debugger for web development by HeavyStorm on Saturday September 18, 2021 @12:16AM (#28573662)
Why is that better than using your IDE? Your writing debugging code directly in you production code...
Re:Show HN: Time travel debugger for web development by tedmielczarek on Thursday September 23, 2021 @12:07PM (#28631135)
I haven't personally used Replay, but from my experience using rr (a native debugger that also provides time-traveling features) being able to replay execution both backwards and forwards in time on a whim is amazing. These tools excel at diagnosing bugs that are hard to reproduce, because you only have to reproduce the bug once under the debugger and then you can endlessly replay that execution until you figure it out. As Jason said above, you can retroactively add print statements in places that would be useful, without having to waste time trying to reproduce the bug again!

roc (the original author of rr) founded a company to build an even more compelling product on top of rr called Pernosco. They have some mind-blowing demos I'd recommend you check out: https://pernos.co/ .

Being able to easily answer questions like "where did the value in this variable come from, and when did it get set?" makes debugging a wildly different experience.

Re:Show HN: Time travel debugger for web development by sprremix on Sunday September 19, 2021 @08:45AM (#28583889)
How would you debug something inside of a loop (1000s of values) with a line breakpoint in your IDE? Your debugger will trigger the breakpoint every single time it walks through the loop, even when everything is going fine. Now if you conditionally trigger the breakpoint inside the loop using code, it will trigger once and only if it encounters whatever error you want to catch.

Obviously you remove that debug statement from your code after you're finished debugging.

Re:Show HN: Time travel debugger for web development by ZeikJT on Monday September 20, 2021 @03:04AM (#28591007)
Browsers have conditional breakpoints available in their tools/debuggers so you can write them without changing the code.
Re:Show HN: Time travel debugger for web development by mattmanser on Wednesday September 15, 2021 @07:19PM (#28545718)
Err, conditional breakpoints are your friend.

Also the GP claims "nobody" uses breakpoints? Everyone in my team uses them all the time.

Suppose it all depends on your language/tool chain, in my experience breakpoints are very commonly used by developers in visual studio.

Re:Show HN: Time travel debugger for web development by cambaceres on Thursday September 16, 2021 @01:07AM (#28548248)
I assume he referred to breakpoints in the browser.
Re:Show HN: Time travel debugger for web development by quickthrower2 on Thursday September 16, 2021 @03:41AM (#28549140)
Chrome does conditional breakpoints - just edit the breakpoint and type your condition in - but it massively slows down the page of that code gets hit a lot.

So much so that I prefer to put the condition in my local build as source code then put a normal breakpoint on that after it has rebuilt (a few millseconds with a good watcher)

Re:Show HN: Time travel debugger for web development by HeavyStorm on Saturday September 18, 2021 @12:17AM (#28573668)
I use it ALL the time. Not sure how people are debugging code nowadays?
Re:Show HN: Time travel debugger for web development by rubyist5eva on Wednesday September 15, 2021 @11:44AM (#28540545)
Which debugger do you use because I live in JetBrains tools and their debugger front-end support for conditional or on exception break points is phenomenal
Re:Show HN: Time travel debugger for web development by mysterydip on Wednesday September 15, 2021 @12:40PM (#28541315)
What I mean is coming up with a condition to make as a watch/breakpoint isn't always obvious. Especially with errors that happen "sometimes randomly".
Re:Show HN: Time travel debugger for web development by onionisafruit on Wednesday September 15, 2021 @12:47PM (#28541394)
That’s exactly where replay should shine. Stick a breakpoint in your error handler, then rewind when it breaks.
Re:Show HN: Time travel debugger for web development by jaril on Wednesday September 15, 2021 @12:53PM (#28541478)
Actually it might be even easier — if your specific error shows up in the console, there's a handy rewind button right beside it :)
Re:Show HN: Time travel debugger for web development by rubyist5eva on Wednesday September 15, 2021 @07:28PM (#28545814)
If an error causes an exception there is an option to suspend execution when one is thrown.
Re:Show HN: Time travel debugger for web development by zerd on Wednesday September 15, 2021 @11:13PM (#28547529)
But typically it will throw an exception _after_ the interesting code happened. For instance it might throw a NullPointerException, but you want to know what set it to null in the first place. With breakpoints you have to suspend on exception, and then add additional breakpoints earlier in the code, and then rerun the code. With rewind you can just step backwards.
Re:Show HN: Time travel debugger for web development by bentlegen on Wednesday September 15, 2021 @12:05PM (#28540803)
The debugger in devtools also has these capabilities.
Re:Show HN: Time travel debugger for web development by spicybright on Wednesday September 15, 2021 @01:51PM (#28542185)
Can confirm. Use it often both on Chrome and Firefox.

I love the idea of reply, but is it targeting the wrong people to get the post leverage out of it? Print statements generally don't need to be used for debugging if you know how to use a debugger. Which really isn't difficult if you spend maybe half an hour learning it's features.

Re:Show HN: Time travel debugger for web development by breuleux on Wednesday September 15, 2021 @09:03PM (#28546621)
For Python, but only if execution is deterministic, I made a small library that tries to address that issue: https://github.com/breuleux/breakword (it prints data alongside a deterministic list of words and you can set a breakpoint on a word of interest in a second run).

It's really a poor man's replay, though. That tool looks really slick, I'll definitely give the Python version a go if/when it comes!

Re:Show HN: Time travel debugger for web development by mattmanser on Wednesday September 15, 2021 @07:18PM (#28545706)
Err, conditional breakpoints are your friend.

Also, "nobody" uses breakpoints? Everyone in my team uses them all the time.

Re:Show HN: Time travel debugger for web development by vagrantJin on Friday September 17, 2021 @11:31AM (#28566634)
Perhaps the comment was a generalization and not a attack on your process. Its not a radical claim to suggest breakpoints are not as popular as console.logs