LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gdb help Arch Linux (https://www.linuxquestions.org/questions/programming-9/gdb-help-arch-linux-4175536146/)

CincinnatiKid 03-08-2015 09:30 PM

gdb help Arch Linux
 
I am reading a book and am trying to follow some examples, but I can't get gdb to work like it does in the book. In the book when gdb is run on the binary, it shows general registers etc... Here is the output on my computer which really shows nothing when gdb is run, any help would be awesome:

Code:

[test@localhost Programs]$ cat HelloWorld.c
#include <stdio.h>
int main ()
{
        int i;
        for (i = 0; i < 10; i++)
                printf ("Hello World\n");
        return 0;
}
[test@localhost Programs]$ gcc -g HelloWorld.c
[test@localhost Programs]$ ./a.out
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
[test@localhost Programs]$ gdb -q a.out
Reading symbols from a.out...done.
(gdb) q


CincinnatiKid 03-08-2015 09:42 PM

Nevermind had to run some other commands like:

Code:

(gdb) break main
(gdb) run
(gdb) info registers

Those gdb commands give the output that I was looking at from the book, not sure how I missed that. Problem solved!

veerain 03-08-2015 09:48 PM

You have to type 'run' and enter to run the gdb on program.

Here is a good tutorial on using gdb.


All times are GMT -5. The time now is 11:04 AM.