Operating System - HP-UX
1833877 Members
1793 Online
110063 Solutions
New Discussion

Re: Looking for c program that summarizes core dump files

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Looking for c program that summarizes core dump files

Looking for a c program that will summarize info in core files. I'm sure some of the experts have something that will be useful.

I want to avoid running strings or interactively examining the file.

jack...
10 REPLIES 10
Paula J Frazer-Campbell
Honored Contributor

Re: Looking for c program that summarizes core dump files

 
If you can spell SysAdmin then you is one - anon
Adam J Markiewicz
Trusted Contributor

Re: Looking for c program that summarizes core dump files

Hi

strings core gives a lot of garbage and sometimes a single usefull information.

What you're looking for is:

what core
file core

Mayby somebody knows more useful commands?

Good luck
Adam
I do everything perfectly, except from my mistakes
Jack C. Mahaffey
Super Advisor

Re: Looking for c program that summarizes core dump files

Paula, thanks...
Paula J Frazer-Campbell
Honored Contributor

Re: Looking for c program that summarizes core dump files

Jack

You are more than welcome.


Best wishes from London - and for our USA forumers that is England.

;^)


Paula
If you can spell SysAdmin then you is one - anon
Dario_1
Trusted Contributor
Solution

Re: Looking for c program that summarizes core dump files

Jack:

I agree with you, Paula's answer is great (of course the others too). You could also check the following, it was posted today. Here you will find a program posted by Paddy. I don't know if it will help you but take a look:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x8a1e9607df6ed711abdc0090277a778c,00.html

Regards,

DR
Paddy_1
Valued Contributor

Re: Looking for c program that summarizes core dump files

The following is a simple program to do so.There is still a detailed version too.let me know if you need that too.
---------------------------------
#include
#include
#include
#include
#include

struct corehead chead;
struct proc_exec pexec;
struct proc_info pinfo;

char *signames[] = {
"", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "IOT", "EMT", "FPE",
"KILL", "SEGV", "SYS", "PIPE", "ALRM", "TERM", "USR1", "USR2", "CHLD",
"CLD", "PWR", "VTALRM", "PROF", "IO", "POLL", "WINCH", "STOP", "TSTP",
"CONT", "TTIN", "TTOU", "URG", "LOST", "" "DIL"
};

char dummy[BUFSIZ];

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))

main(argc, argv)
int argc;
char **argv;
{
char *file;
int fd;
int len;

if (argc < 2)
file = "core";
else
file = argv[1];
if ((fd = open(file, O_RDONLY)) < 0) {
fprintf(stderr, "Cant't open core file.\n");
fprintf(stderr, "Usage: core [core_file]\n");
exit(1);
}

while(read(fd, &chead, sizeof(struct corehead))) {
switch(chead.type) {
case CORE_DATA:
len = chead.len;
printf("Core data length: %d\n", len);
while (len > 0) {
read(fd, dummy, min(len, BUFSIZ));
len -= min(len, BUFSIZ);
}
break;
case CORE_EXEC:
read(fd, &pexec, sizeof(struct proc_exec));
printf("Command: %s\n", pexec.cmd);
break;
case CORE_FORMAT:
read(fd, &len, sizeof(int));
printf("Format version: %d\n", len);
break;
case CORE_KERNEL:
read(fd, dummy, chead.len);
printf("Kernel: %s\n", dummy);
break;
case CORE_PROC:
len = chead.len;
read(fd, &pinfo, sizeof(struct proc_info));
printf("Died from signal %d (SIG%s), type %d\n",
pinfo.sig, signames[pinfo.sig], pinfo.trap_type);
break;
case CORE_STACK:
len = chead.len;
printf("Core stack length: %d\n", len);
while (len > 0) {
read(fd, dummy, min(len, BUFSIZ));
len -= min(len, BUFSIZ);
}
break;
default:
fprintf(stderr, "Unknown data object in core file!\n");
fprintf(stderr,
"Type = %d, Space = %d, Addr = %d, Length = %d\n",
chead.type, chead.space, chead.addr, chead.len);
exit(1);
}
} exit(0);
}
The sufficiency of my merit is to know that my merit is NOT sufficient
Jack C. Mahaffey
Super Advisor

Re: Looking for c program that summarizes core dump files

Paddy, Yes, I would like a copy of the more detailed program.


thankx

jack
Paddy_1
Valued Contributor

Re: Looking for c program that summarizes core dump files

 
The sufficiency of my merit is to know that my merit is NOT sufficient
Paddy_1
Valued Contributor

Re: Looking for c program that summarizes core dump files

 
The sufficiency of my merit is to know that my merit is NOT sufficient
Jack C. Mahaffey
Super Advisor

Re: Looking for c program that summarizes core dump files

Paddy, thanks... I like the one line format.

jack...