Search This Blog

Blog Inauguration By : Prof. N. L. Vijaykumar, INPE - Brazil

CSE

BUGS AND DEBUGGING

  BUGS AND DEBUGGING

Bugs are errors in computer software that prevent it from functioning properly.

          


Though all programs contain bugs, the key to developing good software is to make it good enough to perform its intended tasks properly.

 Bugs may occur either due to oversight in the coding or design phases, or simply because a program is extended beyond its original purpose.

For example, the original Transmission Control Protocol (TCP) stack was not designed to handle SYN floods (a large number of concurrent but not fully established connections), and this caused one of the first major Internet crisis.

Computer programmers have to follow certain guidelines to keep bugs from their work. For example, every time an input string is read into an array, any data exceeding the array's capacity needs to be purged to avoid buffer overflows, one of the biggest security hazards.



DEBUGGING:

 Debuggers are software used to locate bugs in the code.

They allow you to run the code step by step to trace errors.

They can also show the point where the program crashed, in either the source code or the assembly code. Most of the bugs in the code are revealed during testing phases. However, a few are discovered later and fixed with 'patches'.

 Here are a few common bugs:

 Division by zero, arithmetic overflows/underflows, memory leaks (not releasing the memory ), buffer overflows (trying to read excess data in a buffer), deadlocks (between processes or threads) , off by one error (erroneous loop iteration) etc.

FEW DEBUGGING TOOLS:

Debuggers:

 Debuggers are software tools that allow programmers to step through their code, inspect variables, and control the execution of the code. Examples of debuggers include GDB, LLDB, and Visual Studio Debugger.

  Logs and print statements:

 Logs and print statements are simple ways to trace the execution of the code and see what is happening. This is often used to debug runtime errors, such as a null pointer exception.

          


Profilers:

 Profilers are tools that measure the performance of code and help identify bottlenecks. This can be useful in debugging slow performance or identifying performance issues in code.

  Memory analyzers:

 Memory analyzers are tools that help programmers identify memory leaks and other memory-related issues. This is useful in debugging issues related to memory usage and memory allocation.

Unit tests:

 Unit tests are automated tests that are written to test specific units of code. Unit tests can help identify bugs and improve code quality.

 

No comments:

Post a Comment