LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-26-2008, 12:38 PM   #1
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Rep: Reputation: 31
What is the best way to trace down a program ?


Hi

Ive been using strace, pstree, top and ps (as well as l/var/log/messages, /var/log/syslog) to track down programs that are misbehaving.. and i can see quite easily whats taking up CPU... but i cant really see what the problem is, what the program is actually doing or what is wrong with the program if there would be something wrong with it. Now, strace is tracing all system calls, but i guess that is just the calls to the linux kernel and its often very hard to understand ..for example this output: "read(,"

Yes i can see that the program is trying to read something and that the "read" function is used.. but i cant tell what the program is trying to read or what it is waiting for.. and that again doesnt make it easy to solve the problem if there were a problem and its not easy at all to just figure out what the program is doing in detail.

Would someone please comment on this?
 
Old 04-26-2008, 01:00 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,559

Rep: Reputation: 182Reputation: 182
You are getting down to the level of detail that you will probably need to use gdb.

http://node1.yo-linux.com/cgi-bin/ma...gi_command=gdb

gdb is a debugging tool that you can use to examine what a program is doing to any level of detail that you want. You need to get the program's source code, compile it with gcc and then run the program under gdb.

--------------------
Steve Stites
 
Old 04-26-2008, 01:26 PM   #3
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Original Poster
Rep: Reputation: 31
Ok, thanks.. but usually you dont have the source code to the programs you want to troubleshoot, but its a nice tool to remember if im going to create some C (and maybe even c++?) programs.

If you for example need to troubleshoot an application server (tomcat for example), what would be the best way to do that? I guess checking the catalina.out logfile as well as other log files..but you cant really see whats causing the server to crash. If i see a bunch of java exceptions in the log files for example..then im not sure if its the application that needs to be fixed or if its something else that is causing tomcat to crash.

Edit: I actually now found a tool that was named "jdb" and it seems to work like gdb which is nice. But when i try to troubleshoot why an application server has crashed i dont have the source code to the application running under the application server and that makes it difficult to determine if the server crashed due to code errors within the application which is running inside the application server or if it was something else that caused the crash. It would be nice to get additional comments or tips on how people usually troubleshoot this, but i will search the net more and learn more how to use logs to filter out valuable information.

Last edited by exceed1; 04-26-2008 at 04:06 PM.
 
Old 04-26-2008, 08:31 PM   #4
marquardl
Member
 
Registered: Apr 2008
Posts: 100

Rep: Reputation: 15
If the problem is in the source code itself (even buffer overflow from misbehaving data input belongs to this category) then you need the source code. Nothing prevents you from building Tomcat from your own set of source code.

Also have a look at http://valgrind.org/

I'm not sure you will be able to solve the situation by simply reading logfiles.

Linux

Last edited by marquardl; 05-01-2008 at 04:21 AM.
 
  


Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] need to trace a hacker procfs Linux - Security 5 05-17-2008 08:04 AM
"killed" Message - how to trace/back trace ebinjose Linux - Kernel 1 01-29-2008 06:12 AM
Call Trace: azpaul Linux - Security 2 10-25-2006 12:20 AM
obtaining program execution trace? arjunsub Programming 2 02-20-2005 09:17 AM
Stack trace ust Linux - General 0 02-27-2004 02:30 AM


All times are GMT -5. The time now is 02:13 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration