Development Index

GDB - C

C program with autotools

        $ touch NEWS README AUTHORS ChangeLog
        $ mkdir -p src/bin src/lib
        

GDB Quick Start, Learning C with GDB and Memory Layout and the Stack are great sources of introductory information.

To use gdb you need to compile program with -g flag. To debug a program;

        gdb program
        

If the program needs arguments you can set it;

        (gdb)set args -parameter1 -parameter2
        

To start the program you can type run, this way gdb will try to run the program until the end. If program crash, gdb will stop it for debuging.

        (gdb) run
        
        n - execute next line
        s - step in next line
        b - backtrace
        info locals
        print
        x
        

SysCalls

catch syscall open

Threads

When new thread is created you receive a notification. To get information about threads;

        info threads
        

To select thread;

        thread 1
        

Stopping and Starting multi-thread programs

        break linespec thread threadno
        

Strace

        strace -c ./program
        
Development Index

This is part of the c9-doc Manual. Copyright (C) 2016 c9 Team. See the file Gnu Free Documentation License for copying conditions.