C/C++ Programming - Solaris Core Dump Analysis
Solaris is best platforms to trace out the crash issues. They have a bunch of tools to help us instead of screaming in the office during nights :).While analyzing the core dumps i follow few steps given below most of the time which has helped me in most of the scenarios.
- Observe the complete stack trace esp multi-threaded programs.
$>pstack core|c++filt
- Deploy sample programs to test the possible operation that is causing issue rather than trying to debug the complete operation.
- Use dtrace to find out the program trace just before when the issue happens
$dtrace -n 'pid$target:a.out::entry { ustack() }' -p PID - Use DBX to figure out the variable dump, will have to use debug build
$> dbx program core
(dbx) threads
(dbx) thread t@3900
(dbx) dump
- Use stubs for the suspected list of functions
- Include log messages so as to print out the input and output data values
- Monitor the process resource closely during the test eg. mem, cpu usage
- Run the program within DBX enabled with checking of memory access, leaks, or usage
(dbx)>check -all
- Use coreadm to manage core file dumps. This will help you from analyzing the previous coredumps as well if configured to dump using pid as one of the file name.
Posted by - at 11:20 pm | 0 comments read on
Debugging - Core Dump Management on the Solaris OS
Really cool article on how to manage core files under solaris. Sun has a very nice list of tools like coreadm, pstack and dumpadm.enjoy debugging!
Posted by - at 2:09 am | 0 comments read on
C C++ Programming - Useful Tracing and Profiling Tools
I have been searching for few tracing and profiling tools these days. Tracing tools are my fav because we will be able to debug it while it is running and can get an overview of what is happening inside a.out. esp while learning the flow of a prog.I found the given below tools and links very useful...
- Linux
- gprof
- callgrind
- ltrace/strace/mtrace
- These are low level system calls, library calls and memory tracers
- Overview
- Systemtap
- Solaris
- dtrace - my fav
- DTrace Review - Really Cool Video - A must see one!
- IBM - AIX
- truss/trace
- i haven't personally used these, still has to do some more research on these
- Probevue
- HPUX
- if lucky you will find some here
Labels: AIX, C, C++, HP-UX, Linux, Solaris, Unix
Posted by - at 12:02 am | 1 comments read on
Shell Script - Memory Watch for UNIX Platforms
Simple memory profile script for UNIX/LINUX platforms.
#!bin/sh
PROCCHECKDELAY=1
RUNCHECKDELAY=2
PAGEROWS=80
PROCNAME=$1
PROCID=
if [ $# -ne 1 ]
then
echo give program name to watch;
exit 1;
fi
stat_process()
{
PROCID=
_mypid=
while [ true ]
do
_mypid=`ps -e 2>/dev/null|grep $1|head -n1|awk '{ print $1 }'`;
if [ -z "$_mypid" ]
then
echo "$1 is not running"
else
break;
fi
echo "recheck after $RUNCHECKDELAY seconds";
sleep $RUNCHECKDELAY;
done
PROCID=$_mypid;
}
i=$PAGEROWS;
while true;
do
stat_process $PROCNAME;
if [ $i -eq $PAGEROWS ] ;
then
i=0;
UNIX95= ps -p $PROCID -o vsz,pid,ruser,args 2>/dev/null
else
UNIX95= ps -p $PROCID -o vsz,pid,ruser,args 2>/dev/null|tail +2
fi
if [ ! -z "$PROCID" ]
then
i=`expr $i + 1`;
fi
sleep $PROCCHECKDELAY;
done;
please post your valuable comments and suggestions.
Labels: AIX, HP-UX, Linux, Script, Solaris, Unix
Posted by - at 3:17 pm | 0 comments read on