FAQs

Let’s go through some of the frequently asked questions related to the material we covered in the course.

Why do backtraces of some threads start from main() throughout the course?

If you are accustomed to the WinDbg debugger, then this is a completely justified question. The simple answer to the question is that of course, they do not start there, but by default, a stack trace is shown starting from the main function in GDB. We can change this behavior by using the set backtrace past-main command.

Is it possible to use scripts in GDB?

Yes, for example, in the past we wrote the following script to emulate the WinDbg dpp command in a file UserCommands.txt:

define dpp
  set $i = 0
  set $p = $arg0
  while $i < $arg1
    printf "%p: ", $p
    x/ga *(long *)$p
    set $i = $i + 1
    set $p = $p + 8
  end
end

We load the file in GDB ...

Access this course and 1400+ top-rated courses and projects.