Debugging Pro C Programs


 
Thread Tools Search this Thread
Top Forums Programming Debugging Pro C Programs
# 1  
Old 07-10-2006
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
# 2  
Old 07-10-2006
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.
# 3  
Old 07-10-2006
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

# 4  
Old 07-11-2006
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.
# 5  
Old 07-12-2006
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.
# 6  
Old 07-12-2006
you shoud first compile your program with -g.
then dbx your exe file.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies

2. Programming

c++ debugging

hey i have a problem with a switch case in program and the debugger is messy has hell ( we use normal VI and gdb in our schoool to make it more diffiacult) any way i have a problom where for some unknown reason the debugger just skips a switch statment as if it wasent even there the rest... (2 Replies)
Discussion started by: gotenxds
2 Replies

3. UNIX for Dummies Questions & Answers

blcr debugging

hey, can any one please tell me how can i debug blcr?? actually i have checkpointd a client using blcr and i want to check out what actually happens when we checkpoint any program. so i want to see what happen when we type $cr_checkpoint pid i mean i want to debug when i enter this... (0 Replies)
Discussion started by: pratibha
0 Replies

4. UNIX for Dummies Questions & Answers

Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ?

Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right... (1 Reply)
Discussion started by: vishwamitra
1 Replies

5. Programming

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..... (5 Replies)
Discussion started by: ps_sach
5 Replies

6. Solaris

debugging

when I tried to debug my application i got the following. gdb -v GNU gdb 6.6 file is in C and Xmotiff Languages (gdb) attach 25499 Attaching to process 25499 Retry #1: Retry #2: Retry #3: Retry #4: 0xfea40b68 in ?? () (gdb) where #0 0xfea40b68 in ?? () (0 Replies)
Discussion started by: satish@123
0 Replies

7. Programming

How to compile pro*c, C programs

Hi, How to precompile the c program which has proc statements within it. If it is only c, I will use the following cmd cc filename.c -o output so please tell me what command I have to use for precompilation. I beleave that this is not an oracle or proc forum, but still I hope will... (1 Reply)
Discussion started by: sweta
1 Replies

8. Shell Programming and Scripting

Regarding Debugging

Hi, If we want to debug a shell script, then set -vx has to be included in the begining of the script. Just i want to know what purpose -vx is used. Thanks in advace Sarwan (2 Replies)
Discussion started by: sarwan
2 Replies

9. UNIX for Dummies Questions & Answers

domain logon problem - FreeBSD PDC w/ win2k pro and winxp pro

this is the seventh problem i'm having with samba. for some reason, i cannot logon to the domain. i've created user accounts... and i was able to establish a connection between the samba server (my PDC) and my workstations by logging in as "root." however now when i try to logon it gives... (5 Replies)
Discussion started by: xyyz
5 Replies
Login or Register to Ask a Question