pstack file analysis


 
Thread Tools Search this Thread
Operating Systems Solaris pstack file analysis
# 1  
Old 08-05-2011
pstack file analysis

Hi ...
Can you please share how to analyse pstack file and various options for core dump analysis
# 2  
Old 08-10-2011
I usually use gdb bt or dbx where on core, after using file and strings to figure out what it was running. If optimized, expect inlined calls to disappear. I am more into distrusting inputs, good logging, debug messages, error handling, all-cases action and good structure, with an occasional side of truss/tusc/strace. I stopped stepping when I left hardware in the late 80's.

I used to run core dump hunters on my servers, where each core dump was stack traced and analyzed by script, saved compressed in a dir with 8th day purge, removed and reported by email. Many prod mysteries are core dumps. Some are not fixable, but you get to know their signatures.
# 3  
Old 09-16-2011
to: DGPickett

Hi DGPickett,

can you please send me your core dump analysis scripts that you mentioned(which runs continuously and analyzes core files and send report)

Thanks and Regards
Madhu
# 4  
Old 09-16-2011
This is a basic one. Adding gdb or dbx to it requires taking the find output and the $PATH expected or extracted from the core to find the executable. One nice trick with a core file is to run it through 'strings' or 'cat -v' and look for the environment, usually near the end and in ASCII: PATH=.... Using gdb for where (stack trace) solved licensing issues (dbx only ran on dev boxes).
Code:
$ cat bin/coremail
#!/usr/bin/ksh
if [ $# = 0 ]
then
 echo "Usage: ${0##*/} <email_addr_list>" >&2
 exit 1
fi
(
 touch ~/.core_mail.mark.new
 if [ -f ~/.core_mail.mark ]
 then
  find / -name core -type f -newer ~/.core_mail.mark
 else
  echo "No ~/.core_mail.mark, all core files included." >&2
  find / -name core -type f
 fi 2>/dev/null | while read l
 do
  date "+%Y-%m-%d %H:%M:%S ($$) Processing: $l"
  (
   echo "Core file found: $l"
   echo
   ls -l "$l"
   echo
   if [ -r "$l" -a -s "$l" ]
   then
    file "$l" | tee /dev/stderr |read zexe
    echo
    zexe="${zexe#*'}"
    zexe="${zexe%'*}"
    if [ "$zexe" != "" ]
    then
      echo ========== strings with $zexe in $l =========
      strings "$l" | fgrep "$zexe"
      echo
    fi
    export zsn=/tmp/core_found_$(date "+%Y-%m-%d_%H:%M:%S").gz
    echo "Saving gzip'd copy to: $zsn"
    echo
    (
     while [ "$(/usr/sbin/fuser "$l" 2>/dev/null)" != "" ]
     do
      sleep 1
     done
     umask 077
     gzip -7 <"$l" >$zsn
     )&
   fi
   ) 2>&1 |tee /dev/stderr|mailx -s core_mail.`date "+%Y-%m-%d_%H:%M:%S"` $@ &
  sleep 2
  date "+%Y-%m-%d %H:%M:%S ($$) Finished $l"
  echo
 done
 mv -f ~/.core_mail.mark.new ~/.core_mail.mark
 )>>/tmp/core_mail_$(date '+%Y%m%d').log 2>&1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

pstack missing from Ubuntu 10.10

Hi All I would like to use the tool "pstack" to get a sample of the stack trace for a process. As far as I understood It seems widely available in all Linux systems, but it is not in Ubuntu 10.10. I tried using apt-get as per some posts in few forum, but it cannot be found in the APT... (9 Replies)
Discussion started by: manustone
9 Replies

2. Solaris

analyse core file using pmap and pstack

Dear All, I am new to this forum. This is my first. I am facing customer issue. Customer has got core file while running the server. He had sent core file and details from pstack, pmap and pldd commands. I have to debug this application, please help me to fix this issue. I am using sparc 10... (4 Replies)
Discussion started by: KiranBangalore
4 Replies

3. UNIX for Advanced & Expert Users

analyse core file using pmap and pstack

Dear All, I am new to this forum. This is my first. I am facing customer issue. Customer has got core file while running the server. He had sent core file and details from pstack, pmap and pldd commands. I have to debug this application, please help me to fix this issue. I am using sparc... (1 Reply)
Discussion started by: KiranBangalore
1 Replies

4. Shell Programming and Scripting

Log File Analysis

Hi All, Given a list of date and time, how can i split them in intervals of 1 hour. The input file is listed as below f.e.: 16-OCT-2009 09:11:47 10.65.4.24. . . (1 Reply)
Discussion started by: x-plicit78
1 Replies

5. Solaris

Core file analysis

How can we analyze a core file and determine why it was generated on a solaris system? I know file core filename will tell us what program generated the file. But, what to do next to get more details? Thanks, (5 Replies)
Discussion started by: Pouchie1
5 Replies

6. Red Hat

pfiles and pstack and ptree

Can someone tell me the Linux equivalent for pstack and pfiles and ptree which are Solaris commands. (1 Reply)
Discussion started by: bdsffl
1 Replies

7. Shell Programming and Scripting

text file analysis

Hello, I have a text file containin 4 lines which are repeated along the file, ie the file looks like this: 16:20:12.060769 blablabla 40 16:20:12.093199 blablabla 640 16:20:12.209003 blablabla 640 16:20:12.273179 blablabla 216 16:20:27.217444 blablabla 40 16:20:27.235410 blablabla 640... (2 Replies)
Discussion started by: Celine19
2 Replies

8. Solaris

pstack usage on Solaris 9

Hello everyone, I have a 12-thread application running on Solaris 9. When I use the pstack command after a typical core dump, it prints the stack output of all 12 threads/lwps. This is the standard procedure as it is described in the Solaris MAN pages. Is there a way to filter out the... (1 Reply)
Discussion started by: gregb32
1 Replies

9. UNIX for Advanced & Expert Users

Core Dump Analysis Using PStack and PMAP

Hello, I'm new to the group and this is my first post. I'm hoping someone can help me out. I have a core dump that I need to analyze from a Unix box and I've never done this sort of thing before. I was told to run a pmap and pstack on the core file which provided two different output files. ... (3 Replies)
Discussion started by: kimblebee
3 Replies

10. UNIX for Dummies Questions & Answers

core file analysis

Hi folks, I'm hoping someone would be charitable enough to give me a quick explanation of adb usage for analyzing core files...or point me in the right direction. A search here revealed scant results and web searches are providing me with ambiguous information. Running Solaris. Thanks,... (1 Reply)
Discussion started by: kristy
1 Replies
Login or Register to Ask a Question