Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-20-2005, 04:19 AM   #1
LQ Newbie
Registered: Feb 2005
Posts: 2

Rep: Reputation: 0
Exclamation obtaining program execution trace?


I need to obtain address traces for specific applications (like gcc...or any other user specified application for that matter) . I'm working on a page replacement algorithm simulator. Need to get a sequence of addresses in Hex format and the modified bit value i.e. read/write, which i can use for my simulator, to test the algorithms.

i've tried looking up stuff on ptrace, strace, etc..not quite sure as to how I can use it. If there's anything else I can use or if you could point me to source codes for any of the above, would be great.

Is there any tool/software I can use on Windows?...again for tracing the addresses for an application.

Old 02-20-2005, 09:20 AM   #2
Senior Member
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 46
I assume you tried the man pages? It really couldn't be much easier ... strace <processname>.

I have no idea if there are similar utilities for Windows, though it would surprise me to find out there is not.
Old 02-20-2005, 10:17 AM   #3
LQ Newbie
Registered: Feb 2005
Posts: 2

Original Poster
Rep: Reputation: 0
re : strace

The problem I'm having with strace is that I get the sequence of system calls, but how do I get the hex addresses? some of the system calls have the addresses in either their arguments or in the return value, like stat64, old_mmap...but what about the others? Need the sequential address trace for all system calls.

for example...

Some of the lines obtained after using strace with echo..

open("/opt/gnome2/lib/", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/gnome2/lib", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
open("/etc/", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=65928, ...}) = 0
old_mmap(NULL, 65928, PROT_READ, MAP_PRIVATE, 3, 0) = 0xbf596000
close(3) = 0
open("/lib/tls/", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`ht\000"..., 512) = 512

What can I do with this?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
c++ redirect program execution blizunt7 Programming 6 09-13-2005 01:09 PM
paralell program execution vishamr2000 Programming 17 08-28-2005 10:15 AM
execution of one program inside of another microsoft/linux Programming 2 03-18-2005 11:24 AM
Key bindings program (custom pasting, program execution, etc.) jrdioko Linux - Software 2 02-05-2005 10:09 PM
program execution at startup DeeDub Linux - Software 2 09-11-2003 02:25 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 PM.

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