News for hackers. Stuff that matters.
Re:You say “cave dweller debugging”, I say debug logging by dionian on Friday May 06, 2022 @09:44AM (#31284997)
You can't debug a program that ran in the past, but you can read its info-level logs.
Re:You say “cave dweller debugging”, I say debug logging by wooosh on Friday May 06, 2022 @11:53AM (#31286629)
You can debug programs that ran in the past using debuggers like rr[0], which support both recording execution for later debugging, or stepping backward in a running process.

[0]: https://rr-project.org/

Re:You say “cave dweller debugging”, I say debug logging by qayxc on Friday May 06, 2022 @09:47AM (#31285040)
I'd go even further and say you can't debug a program that's running somewhere else, but you can read it's logs (in pretty much real-time if need be).
Re:You say “cave dweller debugging”, I say debug logging by bckr on Friday May 06, 2022 @01:59PM (#31288074)
An idea that I've been kicking around is to, in Python codebases, have a @log decorator that first logs the name of the function, all of the parameters it's called with and a function call id, then the name of the function, its return value, and the same function call id. This can be applied to as many of the functions in the codebase as necessary to provide "replayability". Haven't got the chance to try it out yet.
Re:You say “cave dweller debugging”, I say debug logging by shakna on Friday May 06, 2022 @08:08PM (#31290903)

    import logging
    import threading

    logger = logging.getLogger(__name__)

    def log(fn):
        def log_inner(*a, **kw):
           logger.info('%s(%s, %s) @ %s', fn, a, kw, threading.get_native_id())
           return fn(*a, **kw)
        return log_inner
It's pretty easy to grab all the arguments and thread, but grabbing the return would depend on you not mutating anything permanent, so that probably needs some special casing.
Re:You say “cave dweller debugging”, I say debug logging by bckr on Thursday May 12, 2022 @08:52PM (#31361926)
Thanks for typing that up! The test will be whether this will help as much as I think it would in a real system.
Re:You say “cave dweller debugging”, I say debug logging by marginalia_nu on Friday May 06, 2022 @11:39AM (#31286445)
Depends on the program.

In critical systems, it's not unheard of to transaction log every input and every response to external requests, have strictly deterministic code, so that you specifically can replay or reconstruct a system state.

It's a pretty demanding way to build software, but you also get extremely resilient software as a result.

Re:You say “cave dweller debugging”, I say debug logging by teh_klev on Monday May 09, 2022 @07:03AM (#31312684)
You can do this in Visual Studio, it's called Time Travel Debugging.