Purposefully debugging without using a debugger?

后端 未结 20 1832
春和景丽
春和景丽 2021-02-01 08:49

In chapter 5 of \"The Practice of Programming\" Brian Kernighan and Rob Pike write:

As a personal choice, we tend not to use debuggers beyond getting a st

20条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 09:43

    I rarely use a debugger simply because we do not have one that we can attach to a live system. We can load an image and use the debugger to calculate offsets inside of structures, or translate a program counter to a file & line number. But in general, we code defensively, log errors, and keep a lot of statistics so we have a chance of diagnosing a failure post-hoc.

    Having a working debugger, or an emulation environment, would have occasionally saved me days or weeks of twiddle, reproduce, diagnose.

提交回复
热议问题