LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-08-2015, 09:30 PM   #1
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Rep: Reputation: 47
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
 
Old 03-08-2015, 09:42 PM   #2
CincinnatiKid
Member
 
Registered: Jul 2010
Posts: 454

Original Poster
Rep: Reputation: 47
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!
 
Old 03-08-2015, 09:48 PM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You have to type 'run' and enter to run the gdb on program.

Here is a good tutorial on using gdb.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to compile only specific arch code (linux-3.8.2/arch/x86) ?. abdulrahuman.s@gmail.com Linux - Kernel 6 05-18-2013 04:09 PM
LXer: Arch BSD: Arch Linux Atop The FreeBSD Kernel LXer Syndicated Linux News 0 01-24-2013 03:20 PM
Arch Linux Installation Problems - arch-chroot, Grub2 Ronky Linux - Newbie 3 01-08-2013 05:22 PM
Require gdb compiler that supports arm arch utkarshrawat Programming 0 07-11-2011 02:44 AM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration