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

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.

$ 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

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.

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.

you shoud first compile your program with -g.
then dbx your exe file.