How to do core dump analysis | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

How to do core dump analysis

UNIX for Advanced & Expert Users


Tags
linux

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-01-2005
sip sip is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 18 January 2008, 12:01 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL How to do core dump analysis

Hi All,
I am new to unix environment.
Please tell me how to do coredump analysis. Please explain clearly with example. What are the details are available in the core.

Thanks in advance
Sponsored Links
    #2  
Old 06-02-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 19 April 2014, 8:15 AM EDT
Location: NM
Posts: 10,058
Thanks: 250
Thanked 756 Times in 711 Posts
You're asking a lot.

Basically, you use a debugger. Since you did not specify an OS I'll assume you have
gdb. You must have compiled the file
Code:
gcc -g -o myfile myfile.c

in order for symbols to be available. If you are analyzing a core dump of somebody else's code you are in trouble.

The core dump file is called core

Code:
gdb myfile core

This will show you a backtrace (stack dump) of the call tree that lead to the crash.
You will have to find using the stack dump where in the code (not in a C library) the crash occurred. In other words the last line of the program's code that actually led to the crash.

try man gdb
and
this tutorial site for gdb:

http://www.unknownroad.com/rtfm/gdbtut/gdbuse.html
Sponsored Links
    #3  
Old 06-03-2005
vijaysabari vijaysabari is offline
Registered User
 
Join Date: Jun 2004
Last Activity: 6 March 2007, 4:02 PM EST
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Dbx debugger to analysis coredumps ......

dbx debugger is used to analysis the coredumps ............. i will explain with anexample

cc -g first.c
dbx ./a.out


Reading a.out
Reading ld.so.1
Reading libc.so.1
Reading libdl.so.1
Reading libc_psr.so.1
(dbx 1) sif main
(2) stop infunction main
(dbx 2) run
Running: a.out
(process id 6156)
stopped in main at line 7 in file "first.c"
7 printf("%d\n",time(&t1));
(dbx 3) n
1117798709
stopped in main at line 8 in file "first.c"
8 for ( i=0 ; i<10; i++ ){
(dbx 4) n
stopped in main at line 9 in file "first.c"
9 printf("%d\n",rand());
(dbx 5) n
16838
stopped in main at line 8 in file "first.c"
8 for ( i=0 ; i<10; i++ ){
(dbx 6) exitbx 6)
    #4  
Old 06-17-2005
question question is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 20 June 2005, 11:10 AM EDT
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Cannot get backtrace command work "bt", cannot access memory?

Hi,
I think I have similar question, please bear me to put here.
I recently created a testing program containing only one thread to generate core file to analyze, but I couldn't use gdb to print stack trace, It says "cannot access memory ...".
Why? did I miss any command?
I did the test both on Linux and Solaris, same result.


tc11:/home/canzh/test> gcc -g devide.c

tc11:/home/canzh/test> ./a.out
Segmentation fault (core dumped)

tc11:/home/canzh/test> gdb a.out core
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `./a.out'.
Program terminated with signal 11, Segmentation fault.
Cannot access memory at address 0x40016bec
#0 0x400a68d6 in ?? ()
(gdb) bt
#0 0x400a68d6 in ?? ()
Cannot access memory at address 0xbffff8a8
(gdb) where
#0 0x400a68d6 in ?? ()
Cannot access memory at address 0xbffff8a8
(gdb) quit
tc11:/home/canzh/test> uname -a
Linux tc11 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
The Following User Says Thank You to question For This Useful Post:
sunil hiremath (07-12-2012)
Sponsored Links
    #5  
Old 06-17-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 19 April 2014, 8:15 AM EDT
Location: NM
Posts: 10,058
Thanks: 250
Thanked 756 Times in 711 Posts
try

Code:
gdb a.out
gdb> r

you mentioned threads, is your signal handler part of the thread you create?
Sponsored Links
    #6  
Old 06-20-2005
question question is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 20 June 2005, 11:10 AM EDT
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Thanks for yor reply.
Yes, that started the program. This is my testing program, but if I have a real program, I cannot reproduce the problem easily by simply re-run it because there could be thousands of inputs and I don't know where and how it can crash. The purpose of running gdb is to find the problem (postmortem analyze).
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
core dump analysis : __kernel_vsyscall () pawankkamboj Red Hat 0 01-01-2012 01:35 AM
How to do core dump analysis in AIX? Mythili AIX 2 07-21-2008 07:03 AM
Core Dump Analysis Using PStack and PMAP kimblebee UNIX for Advanced & Expert Users 3 07-30-2007 08:12 AM
any tool for core analysis on HP-UX? shriashishpatil UNIX for Advanced & Expert Users 0 10-18-2006 03:22 AM
help, what is the difference between core dump and panic dump? aileen UNIX for Dummies Questions & Answers 1 06-11-2001 08:08 PM



All times are GMT -4. The time now is 06:46 AM.