debugging - How to debug a program without a debugger? -


Interview question -

Once you have trouble with your code, debug the program It is quite easy. You can keep clocks, breakpoints and so on. Life is very easy due to debugger.

But how to debug a program without a debugger?

A potential approach that I know, you are putting print statements wherever you want to check the problems in your code.

Is there any other way other than this?

As a general question, it is not limited to any specific language. So please share your thoughts so that you do it?

Edit - When submitting your answer, please refer to useful resources about any concept (if you have one) such as logging
it is very helpful for those people Who will not know about it at all. (It contains me in some cases :)

Update: Michal Zanjaner created a real "best" answer and also a community wiki. In fact, lots of votes are entitled.

Actually you have a lot of possibilities, either with the recombination of the source code Or without

With re-organization.

  • Extra. Use either of the following steps in either program logs or system logging (eg output debugstring or event logon windows):
    • Always include timestamps at least seconds long resolution.
    • Consider adding thread-ids in the case of multithreaded applications.
    • Some good outputs of your structures
    • Do not print the rule with only% d, use some toasting () or some EnumToString (
    • Unit Testing
    • "Audiovisual" Monitoring: If something happens
      • Use buzzer
      • Run the system sound
      • Defeat

        without re-assignment
        • if you have a few LED flash enabled in the DWARPE GPO line (in embedded scenarios only) The application uses any type of network: or I will only choose for you:
        • If you use the database: Monitor queries send the database and the database itself.
        • Use virtual machines to check the exact OS / hardware setup that your system is running.
        • Use any type of system call monitor in it on the Unix box or
        • Pre-tools on Windows tools, and evenly
        • Windows GUI stuff In the situation: For check out or WPF (although the second I did not use)
        • Consider using some profile tools for your platform, this will give you an overview of what happens in your app. Hardware Monitoring: Use Oscilloscope (aka O-Scope) Monitor Signals on Hardware Lines
        • Debugging Source Code: You Can Use Your Source Sits with the code and pretends only pieces of paper and pencil that you are a computer, its so called code analysis or "on-eye-eye" debugging
        • Source control debugging when "this" works And now you have to differentiate your code from time to time.
          • Text from the column and Pivot table provides some incredible analysis packs with some text tools (with awk , grep or perl ) if you have If you have more than 32 records, consider using access as a data source.
          • With simple cube, you can analyze floating data in no time.
          • Your application is worth mentioning for dumping either as a result of the accident or on a regular basis
          • always That) to generate.
          • Approximate but least: Most Mayor platforms have some type of command line debugger (even Windows!). With some tricks such as conditional debugging and brake-print, you can get very good results with an obscure bug
          • And in fact, last but not least: use your brain and questions Everything .

          In general debugging is like science: you do not make it, you know it. Often it's like looking for a killer in a criminal case. So buy yourself and do not give up.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -