Debugging Program during execution


 
Thread Tools Search this Thread
Top Forums Programming Debugging Program during execution
# 1  
Old 08-31-2009
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 execution apart from GDB.

Last edited by uunniixx; 09-01-2009 at 02:45 AM..
# 2  
Old 08-31-2009
Am not clear.

Did you mean to say - an automatic code coverage run ( similar to that ) when executed via debugger ( GDB ) ?
# 3  
Old 09-01-2009
No, I did not meant about code coverage functionality. My understanding on code coverage is that % of code executed, while I am looking for debugging a flow.

The options that I have provided provide details of files:line that the code in execution has covered while valgrind states particular type of issues with the code.

Here's an output of valgrind:

11> valgrind w

==21875== Conditional jump or move depends on uninitialised value(s)
==21875== at 0x40308D9A: profil_counter (../sysdeps/posix/profil.c:47)
==21875== by 0x4018402B: vgPlain_HT_destruct (vg_hashtable.c:213)
==21875== by 0x40295B46: __libc_system (in /lib/libc-2.1.3.so)
==21875== by 0x8048570: main (w.cpp:7)
==21875==

12> addr2line -Cfe w 0x8048570
main
/x/home/xxxxxxxxxx/w.cpp:7
13>

Same with compiler options that I have listed. Now if these tools can provide information of the code flow in execution, is there a possible way to list complete 'file:line' of the code execution path?
# 4  
Old 09-03-2009
I gone though gcov tool and that exactly suffices my need but the issue is that our codebase has hundreds of file compiled, linked to form one binary. So how do I use this tool on all the files as running on each file is very time consuming and does not seems to be a good approach.
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

Execution of compressed program

I need UNIX scripts for polling, Uncompressing files and moving files between directory. Also trying to save file paths and any other variables in an independent file (.env) and use these at runtime by executing this file in the main script. (3 Replies)
Discussion started by: new2script
3 Replies

3. Shell Programming and Scripting

Automating execution of commands inside a program

I have a program dnapars I execute the program from command line as following: ./dnapars The program then prompts me some message as a user menu from where I have to select a series of options in the order R U Y R. And then I copy the output file (outfile) in another result file. I wrote the... (3 Replies)
Discussion started by: deeptisjains
3 Replies

4. Programming

Help with C++ program execution.

//Find the root of the equation (x^2)-2 by bisection method. #include<iostream> using namespace std; double a,x; double f(double x) { return ((x*x)-2); } //Suppose the function is (x*x)-2. void calcx(double a1,double b1) { x =... (2 Replies)
Discussion started by: poonam.gaigole
2 Replies

5. Solaris

Program execution order like FIFO queue

Hi all: I have a problem with a C++ service runing on solaris 10. This service only set a signal on oracle table. When the service detect a cut off on the line (tcp/ip), trigger a cobol program for set the signal OFF. When the line is on again, the service trigger the same cobol program for set... (0 Replies)
Discussion started by: hcastellani
0 Replies

6. Programming

A program to trace execution of another program

Hi, I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally. If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Discussion started by: jiten_hegde
3 Replies

7. UNIX for Dummies Questions & Answers

multifile c program compilation and execution

i am using unix os and my program is divided in two text files .:):) how to compile and make one executable file, using unix command. (1 Reply)
Discussion started by: alokmishra8
1 Replies

8. Programming

execution small C++ program in UNIX

Hi my friends I am beginner unix programmer I have written small c++ program in text editor and I have change it mode to 555 to make it executable file to use it in unix O.P. #include<iostream.h> main() { cout<<"Hello World"; } but some syntax erroe came for << can any one help... (5 Replies)
Discussion started by: bintaleb
5 Replies

9. UNIX for Advanced & Expert Users

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 (3 Replies)
Discussion started by: bogarams
3 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