Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

AIX Commands

C program to analyze core files by cspilman
Posted: 28 Mar 02

This is tried and tested on AIX 4.3 versions:

#include <stdio.h>
#include <sys/core.h>

void main(int argc, char *argv[])
        FILE *corefile;
        struct core_dumpx c_file;
        char command[256];

        if (argc != 2)  {
           fprintf(stderr, "Usage: %s <corefile>\n", *argv);

        if ((corefile = fopen(argv[1], "r")) == NULL)  {

        fread(&c_file, sizeof(c_file), 1, corefile);

        sprintf(command, "lquerypv -h %s 6E0 64 | head -1 | awk '{print $6}'", argv[1]);

        printf("Core created by: \n");


        printf("Signal number and cause of error number: %i\n", c_file.c_signo);
        printf("Core file type: %i\n", c_file.c_flag);
        printf("Number of core dump modules: %i\n", c_file.c_entries);
        printf("Core file format number: %i\n", c_file.c_version);
        printf("Thread identifier: %i\n", c_file.c_flt.th.ti_tid);
        printf("Process identifier: %i\n", c_file.c_flt.th.ti_pid);
        printf("Current effective priority: %i\n", c_file.c_flt.th.ti_pri);
        printf("Processor Usage: %i\n", c_file.c_flt.th.ti_cpu);
        printf("Processor bound to: cpu%i\n", c_file.c_flt.th.ti_cpuid);

/*      if (c_file.c_flt.th.ti_cpu > 1) printf("Last Processor: cpu%i\n", c_file.c_flt.th.ti_affinity);

Back to IBM: AIX FAQ Index
Back to IBM: AIX Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close