Debugging a c/c++ program


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Debugging a c/c++ program
# 1  
Old 04-15-2006
Data Debugging a c/c++ program

Can anyone tell the commands we use for debugging a programm in dbx with explanation for each?

Iam totally new to unix environment
# 2  
Old 04-19-2006
(dbx) help
Command syntax: "help <keyword>", <keyword> is one of the following list:

most_used, quit, alias, record, playback, history, lineedit, run,
rerun, stop, step, next, trace, delete, catch, ignore,
cont, return, when, goto, print, printx, printo, printd,
printf, printregs, where, status, whatis, which, whereis, assign,
tag, up, down, func, dump, display, list, search,
edit, file, use, set, setenv, sh, stopi, conti,
stepi, nexti, tracei, listobj, enable, disable, kernel, tlist,
tset, tstack, call, attach, detach, plist, switch, variable,
register, builtin, expression
# 3  
Old 04-22-2006
Thanks Raom Smilie
# 4  
Old 05-14-2006
simple debugging in *nix

if you have the GCC,G++ debugger, which you probably do... you can take your source code text (made or copied in one of the text editors) and assign it the extension you want.. say its EXAMPLE.cpp , to debug just type in the shell command line

gcc -lg++ -Wall -pedantic -ansi -g -o EXOUT EXAMPLE.cpp

this takes and debuggs EXAMPLE.cpp, and hassle-free outputs the compiled program named EXOUT (this can be named whatever you want btw).
the -lg++ is just to tell the debugger to look in the default location for #include header files.. and then -Wall is the actual debugger part. the -o is for a simple output, instead of the a.out aproach.

Pe@cE ... this also works for plain cc instead of gcc
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Debugging a program written in two languages

Subject: Debugging a program written in two languages Platform: Linux (Kubuntu) I am trying to debug a C application with bindings to some simple functions written in Ada using the GNAT Programming Studio IDE (GPS). The main entry point is in C. The debugger is gdb. I managed to compile... (0 Replies)
Discussion started by: NiGHTS
0 Replies

2. Shell Programming and Scripting

Debugging functions

So here I have a simple function that I wish to debug. However, I am unable to debug the desired function even with set -o functrace enabled. Before resorting to asking this question, I had managed to find a possible solution that did not produce the desired results, which is located here. How... (5 Replies)
Discussion started by: BrandonD
5 Replies

3. 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

4. Homework & Coursework Questions

Fixer Debugging

School:Syrian Virtual University - Bachelor in Information Technology - Tutor: A.Issa - course: S10-iti320 hi all, would you please help me correcting and debugging this script: fx-permiss.sh which accepts a list of users as argument resiting those files permissions: say our directory... (0 Replies)
Discussion started by: erzal
0 Replies

5. Programming

Debugging Program during execution

I have made use of 'valgrind' and -finstrument-functions compiler option for debugging / analyzing code. Both the options lets us know the line / file being executed to some extent. Is there a generic way that lets program dump the file:line it is getting executed dumped to a log file during... (3 Replies)
Discussion started by: uunniixx
3 Replies

6. 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

7. 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

8. Programming

Semaphore debugging

I'm running one multithreaded application, in that one of my thread is waiting infinitely in a semphore. Is there a way to determine, in which semaphore the particular thread is waiting and which thread(s) is holding the semaphore. (5 Replies)
Discussion started by: ptprabu
5 Replies

9. 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

10. Programming

how to run debugging on c program

Can someone help me debug a c program I am running? It gives me segmentation fault. I want to turn on debugging. Can some one give the command to turn it on? Below is the error I get: Segmentation Fault (core dumped) (3 Replies)
Discussion started by: ibeg
3 Replies
Login or Register to Ask a Question