The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Debugging a service in AIX 5.3 dkn1979 AIX 4 08-18-2008 06:18 PM
debugging satish@123 SUN Solaris 0 06-17-2008 10:16 AM
Debugging PL/SQL from .NET iBot Oracle Updates (RSS) 0 04-06-2008 05:10 AM
Debugging the JVM Using dbx iBot UNIX and Linux RSS News 0 03-06-2008 07:20 PM
Regarding Debugging sarwan Shell Programming and Scripting 2 02-09-2006 12:32 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-08-2008
ps_sach ps_sach is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 13
Need some help in debugging the C-Progam.

Hi i want to debug the C program with GDB debugger. I want to debug the program by line by line. I want to debug program like as we debug the program in Turbo-C using the F8. Can any one help me?

I know i have to use single stepping. But i don't know how to use it. Any help can be appreciated..


Thanks in Adv.
  #2 (permalink)  
Old 11-08-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
compile -g and then get into gdb - example
Code:
gcc -g -o myprog myprog.c
gdb myprog
gdb> break main
gdb> r [any command line args go here]
... commands as needed here
the step command step one line at a time, print <variable name> displays a variable.
help lets you see all of the commands.
  #3 (permalink)  
Old 11-09-2008
ps_sach ps_sach is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 13
Quote:
Originally Posted by jim mcnamara View Post
compile -g and then get into gdb - example
Code:
gcc -g -o myprog myprog.c
gdb myprog
gdb> break main
gdb> r [any command line args go here]
... commands as needed here
the step command step one line at a time, print <variable name> displays a variable.
help lets you see all of the commands.
Thanks Jim.
  #4 (permalink)  
Old 11-09-2008
SebaM6 SebaM6 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 34
Could I add one more question to this thread? Let's imagine that we want to debug running process or some kind of deamon. What could I do then?
  #5 (permalink)  
Old 11-10-2008
migurus migurus is offline
Registered User
  
 

Join Date: Sep 2008
Location: US
Posts: 47
gdb can attach to a running process,
if I am not mistaken the syntax is:
gdb prog process-number
  #6 (permalink)  
Old 11-11-2008
SebaM6 SebaM6 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 34
What about source code, could I also attach it to debugging running process?

Regards
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0