The UNIX and Linux Forums  

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 PL/SQL from .NET iBot Oracle Updates (RSS) 0 04-06-2008 02:10 AM
Debugging the JVM Using dbx iBot UNIX and Linux RSS News 0 03-06-2008 03:20 PM
FTP script debugging alfredo123 Shell Programming and Scripting 1 11-08-2006 09:22 AM
function debugging. help sanchopansa High Level Programming 2 10-18-2006 04:24 AM
Regarding Debugging sarwan Shell Programming and Scripting 2 02-09-2006 08:32 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-2006
Registered User
 

Join Date: Jul 2006
Posts: 2
Stumble this Post!
Debugging Pro C Programs

Dear All,

I am debugging a pro c executable and I want to trace the variables. Using dbx I cant trace local variables.

Please let me know how I can do a breakpoint and trace of Pro C programs.

Regards,
Ramesh
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-10-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,844
Stumble this Post!
We are able to debug using gdb - the GNU debugger. For most versions of UNIX there is a free downloadable version. We have one for HPUX.
Reply With Quote
  #3 (permalink)  
Old 07-10-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 356
Stumble this Post!
Code:
$ gcc -g test.c -o test
$ gdb test
GNU gdb Red Hat Linux (6.3.0.0-1.122rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) l
1       #include <stdio.h>
2
3       int main(void) {
4           int i;
5           i = 10;
6           fprintf (stderr, "test\n");
7           return 0;
8       }
(gdb) b 5
Breakpoint 1 at 0x80483b5: file test.c, line 5.
(gdb) r
Starting program: /home/Alexander/test
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x70b000

Breakpoint 1, main () at test.c:5
5           i = 10;
(gdb) s
6           fprintf (stderr, "test\n");
(gdb) s
test
7           return 0;
(gdb) print i
$1 = 10
(gdb) q
The program is running.  Exit anyway? (y or n) y
Reply With Quote
  #4 (permalink)  
Old 07-11-2006
Registered User
 

Join Date: Jul 2006
Posts: 2
Stumble this Post!
Debugging Pro C Programs

Thanks for the reply.

Please let me know if this debugger can debug Pro C. I saw the documentation supports C. Just wanted a confirmation on its capability to debug Pro C.

Thanks in advance.
Reply With Quote
  #5 (permalink)  
Old 07-12-2006
Registered User
 

Join Date: Sep 2005
Location: india
Posts: 78
Stumble this Post!
i think ur pro*c code has to be precompiled to C/C++ before making executable.

then you can use dbx as usual.
for tracing variables in dbx u should say
trace varname
for breakpoints say
stop at linenumber.
simple.
Reply With Quote
  #6 (permalink)  
Old 07-12-2006
Registered User
 

Join Date: Jul 2006
Posts: 10
Stumble this Post!
you shoud first compile your program with -g.
then dbx your exe file.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0