Run time Debugging


 
Thread Tools Search this Thread
Top Forums Programming Run time Debugging
# 1  
Old 03-30-2010
Run time Debugging

We have recently downloaded, installed and compiled gcc-3.0.4 code. gcc compiler has built successfully and we where able to compile some same test cpp file. I would like to know how we can modify gcc source code so that we add additional run time debugging statements like the binary in execution compiled by my gcc should print below statement in a log file:

<filename.cpp>::<FunctionName><#linenumber><statement>

or any additional information that I can insert via this tailored compiler code Any references would be highly appreciable.
# 2  
Old 03-30-2010
I don't think you're going to be able to do that by modifying the compiler. This is what things like debuggers are for.
# 3  
Old 04-04-2010
If that so then how does code coverage tools / testing tools implement their functionality. Please have a look at the BullsEye testing tool - Bullseye Testing Technology, debugging and profiling tool - valgrind etc probably could be a few in the list.
# 4  
Old 04-12-2010
Quote:
Originally Posted by uunniixx
If that so then how does code coverage tools / testing tools implement their functionality.
Sorry, I didn't see your reply.

They didn't need to modify gcc at all to get debug info from it. These tools understand gcc's own debugging information, which it embeds in objects and executables when given the -ggdb flag. "gdb" comes from "the GNU Debugger"; again, this is what things like debuggers are for.
# 5  
Old 04-12-2010
Quote:
Originally Posted by uunniixx
If that so then how does code coverage tools / testing tools implement their functionality. Please have a look at the BullsEye testing tool - Bullseye Testing Technology, debugging and profiling tool - valgrind etc probably could be a few in the list.
If what you're trying to do is profile your app, use a profiling tool.

If you're trying to come up with some auditing mechanism whereby you can record every step your application took, don't mess with the compiler.

Why? Go look at how many bugs get filed against compilers. Now, look at who writes those compilers, and how many test cases the off-the-shelf compilers have to pass.

In other words, there are a good number of bugs, but the compilers are maintained by experts in the field AND the compilers are subject to not only the test cases the maintainers put their code through but also the testing done by everyone else using that compiler.

Now, you want to modify that compiler? How much testing are you going to put it through? Anywhere near what the standard compiler code base goes through?

And then your app is going to be completely dependent upon what's now your own private compiler?

Do you really want to mess with the application that translates your source code into machine language? How would you even know if you broke it?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run a task in a script at a particular time

I have an ETL process that triggers a shell script. This script picks the files created by the ETL process and does an SFTP. These are huge files. Due to infrastructure limitations, we need to trigger the actual SFTP part only during the 2nd, 16th, 31st and 46th minute of an hour. Please let me... (2 Replies)
Discussion started by: vskr72
2 Replies

2. Shell Programming and Scripting

Time taken to run grep in different OS

Hi , I am greping a keyword in all sql files in Solaris and Linux. Solaris bash-3.00$ time grep -iwc BEN_STARTUP_LERS_TL084701_WHO *.sql Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0... (4 Replies)
Discussion started by: millan
4 Replies

3. Shell Programming and Scripting

Can we run tail -f for a specified time?

Hi all, I want to check a log file that gets updated very frequently, almost every second. What I want to do from a script is to check this log file 1) for a particular string 2) for a specified time while it is getting updated. And as soon as it finds that particular string the command... (4 Replies)
Discussion started by: pat_pramod
4 Replies

4. Solaris

Java Run Time

I have installed IBM Java Runtime V1.4.2 in solaris. but when i give java -version, it gets me this:java version "1.5.0_20" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02) Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode, sharing) can you please tell me how do i... (3 Replies)
Discussion started by: ichwaiznicht
3 Replies

5. AIX

time of a particular command run

Hello all, I need to find, what time a particular command was run in one of our AIX box. In our environment, we use 'powerbroker' to login as root and there are so many people who use this. I tried history command, which shown me similar to below: 406 ls -l | *user* 407 ls -l... (1 Reply)
Discussion started by: gsabarinath
1 Replies

6. Shell Programming and Scripting

last run time of any script

how to find when last time a scrit has ran? (7 Replies)
Discussion started by: RahulJoshi
7 Replies

7. Shell Programming and Scripting

Run several commands at a time

Hello guys, I am new at shell scripting and I want to create a script that runs several commands at a time, ie: uptime, w, df -h and so on and send the output of this commands to a text file so it can be send via email at a certain time using crontab. Any help will be much appreciated! (4 Replies)
Discussion started by: agasamapetilon
4 Replies

8. Shell Programming and Scripting

run script for given time

Hi! I need to run my script for a specific number of time, as specified by the user: For instance, if the user specified 10, my script should run for until 10 seconds expire. How do I do this? (0 Replies)
Discussion started by: looza
0 Replies

9. Shell Programming and Scripting

Run script at same time

Hi My five script run throgh crontab at same time at 6 clock. Due to problem in the data load .Now I want to check time of load finish run these jobs. I create a script which check the load finish time but I have no idea how I run these JObs. This is very urget to me. Please reply me as soon... (3 Replies)
Discussion started by: Jamil Qadir
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