Skip to content
Ivan edited this page Oct 9, 2018 · 21 revisions

This page is maintained by Ivan ...


Definitions

Debugging is the process of finding and resolving defects or problems within a computer program that prevent correct operation of computer software or a system.

Two tactics of debugging exists:

  1. By using debugging programs which includes user interface for step-by-step program running e.g. GNU Debugger.
  2. Output of the current state of the program using output statements located at critical points of the program on the monitor.

The GNU Project Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, Objective-C, Free Pascal, Fortran, Go, Java and partially others.

How to build a program to be used by GDB?

If you are using Linux, you probably already have gdb. You only have to follow the guide below. But if you are using Windows, you will need to use this guide on YouTube or this one there.

1. Open console. (Ctrl + Alt + T for Linux)

2. Open directory with your program file. (Use command "ls -al" to view your directory list. Use "cd 'path'")

3. Compile your program with "-g" key in order to include information about debugging into your running file. Write in console "gcc -g 'NameOfFile.c' -o 'NameOfRunFile'".

// GNU Debugger is usually used to debug C or C++ files.

4. And then you can upload your program into gdb. Write in console "gdb 'NameOfRunFile'" for Linux. If it works you will instantly appear in (gdb) console.

Clone this wiki locally