LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-25-2008, 05:58 AM   #1
neutrino17
LQ Newbie
 
Registered: Apr 2008
Posts: 5

Rep: Reputation: 0
Tracing C program


The idea is to automatically modify C source (or maybe binary) so it would print the source code line as soon as it is about to execute with maximum possible info about values of particular variables, arguments to functions, addresses and etc. Yet it should run as in normal mode (w/o debugging) and should not break for example on receiving signal as gdb does. Can I somehow do that?
 
Old 04-25-2008, 08:13 AM   #2
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
Yet it should run as in normal mode (w/o debugging)

w/o the debugging symbols .. there is no way you can print line no. etc. thats for sure.

Other than that, I really don't have much of an idea.
 
Old 04-25-2008, 09:24 AM   #3
marquardl
Member
 
Registered: Apr 2008
Posts: 100

Rep: Reputation: 15
__file__

GCC has some built-in macros like __FILE__ and similar to print debugging info using printf statements. I have used this sometimes to print information, though I do nothave examples available right now. Have a look at the GCC documentation. I don't think this is portable among compilers.

Linux

Last edited by marquardl; 05-01-2008 at 04:16 AM.
 
Old 04-25-2008, 06:33 PM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
would you also like it to automatically fix any bugs that it comes across?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tracing Emails leebrent Linux - Networking 2 03-13-2008 10:09 PM
Need Help Tracing a Segmentation Fault binarybob0001 Programming 4 12-06-2007 03:27 PM
strace - tracing program vars domet Linux - Software 0 03-26-2006 08:25 PM
tracing ips endezeichen Linux - Networking 6 11-27-2003 07:38 AM
Tracing and debugging ravichella Programming 4 10-30-2003 03:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration