LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-05-2011, 04:43 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
Monitor an Applications System Calls


I want a log or live data that discloses the system calls an application makes. I have used strace but can't find a guide for it that is decent. I'm interested in knowing the calls made after user intervention like opening a menu and so on. If you run (strace application_name) it is static. What good is this? When does strace make this file? When is this log produced?

Thanks in advance!
 
Old 04-06-2011, 07:09 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Not sure what you mean by 'static'.

If you use strace you will get continuous output to stderr of all the system calls being made, eg from a terminal:
Code:
strace gimp
Alternatively you can run strace in the background and redirect the output to a file:
Code:
strace -o strace.out gimp &
and you can then watch the file updates whenever you want using tail.

Can you give an example of the type of application you are trying to trace?
 
1 members found this post helpful.
Old 04-08-2011, 08:53 PM   #3
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
Thanks for the Reply!

"Static" -monitors the application opening and then exits. I'm doubt I'm using the correct option.I have noticed that Strace opens up the command or application when you use the Strace command. If I do (strace -f gedit) I can witness strace still working but if I do it in most other applications it exits. Right now I primarily want to witness gnome-sessions scroll through the locations that the mouse cursor is pointing to on the desktop. If I run (strace -f gnome-sessions it logs for maybe 3 seconds and crashed the desktop, (reboot). I'm going in the direction of investaging Linux through feedback so I'm attempting to learn some of the basics and straight-forward ways to do this.


Other than adding an option after a hyphen I don't know how to redirect output to a different file.
Any links or advise on how to do this would be great.
Thanks again!

Last edited by theKbStockpiler; 04-08-2011 at 09:04 PM.
 
Old 04-08-2011, 10:15 PM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Are you starting gnome-session from a terminal (ie, before the display manager starts), or are you already inside the gnome desktop and are starting it again? Note that by default strace starts a new process, doesn't attach to an existing one; and you don't want to be running two copies of gnome-session.

If you just want to attach to an existing process id and trace it, you can use the '-p' flag (you will need to use ps to find the id).

You may have some issues trying to view the output in real time on the same screen as gnome-session is using. You should redirect the output (using the '-o' flag is the easiest, though you can use '2>'), since tracing gnome-session may interfere with normal X output (and your strace will be trying to update the screen with the trace data). If you really need to see it in real time, I would suggest using ssh to log in from a second machine, so that you can view the trace on the second machine and leave the main machine to do its thing in peace.

Also, you may want to log child processes of gnome-session using the '-f' flag (I think you are already doing that).

strace will work easily on most application level processes like gedit, it just gets a bit more complicated when you are tracing the code that you are running strace under!

Last edited by neonsignal; 04-08-2011 at 10:18 PM.
 
1 members found this post helpful.
Old 04-09-2011, 01:33 AM   #5
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
Thanks for the info

I found a decent website that has info on how to put in arguments but I had to use a site that would not use my non-windows browser for something else, so I'll have to get back to it later. Thanks for the info on running two gnome-sessions . That makes sense. I think I read to use the P option but I can't remember off the top of my head. The ssh thing is out of my league at this point but maybe sometime down the line.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how does java calls the system calls which are written in c babu198649 Linux - General 3 12-05-2011 03:40 AM
How do I use my system calls in other applications? kdeveloper Linux - Newbie 1 05-03-2009 01:16 PM
system calls with C khodeir Programming 4 03-12-2009 08:26 PM
system calls arispipis Programming 2 03-19-2008 06:59 PM
how do you use system calls? slinky2004 General 1 12-22-2005 09:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:10 AM.

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