Blame src/mpi/debugger/allcommdbg.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *
Packit Service c5cf8c
 *  (C) 2012 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
#include "mpi.h"
Packit Service c5cf8c
#include <stdio.h>
Packit Service c5cf8c
Packit Service c5cf8c
/* style: allow:printf:6 sig:0 */
Packit Service c5cf8c
Packit Service c5cf8c
/* This definition is almost the same as the MPIR_Comm_list in dbginit,
Packit Service c5cf8c
   except a void * is used instead of MPIR_Comm * for head; for the use
Packit Service c5cf8c
   here, void * is all that is needed */
Packit Service c5cf8c
typedef struct MPIR_Comm_list {
Packit Service c5cf8c
    int sequence_number;        /* Used to detect changes in the list */
Packit Service c5cf8c
    void *head;                 /* Head of the list */
Packit Service c5cf8c
} MPIR_Comm_list;
Packit Service c5cf8c
Packit Service c5cf8c
extern MPIR_Comm_list MPIR_All_communicators;
Packit Service c5cf8c
Packit Service c5cf8c
int main(int argc, char **argv)
Packit Service c5cf8c
{
Packit Service c5cf8c
    int errs = 0;
Packit Service c5cf8c
    MPI_Init(&argc, &argv);
Packit Service c5cf8c
Packit Service c5cf8c
    printf("sequence number for communicators is %d\n", MPIR_All_communicators.sequence_number);
Packit Service c5cf8c
    printf("head pointer is %p\n", MPIR_All_communicators.head);
Packit Service c5cf8c
Packit Service c5cf8c
    if (MPIR_All_communicators.head == (void *) 0) {
Packit Service c5cf8c
        printf("ERROR: The communicator list field has a null head pointer\n");
Packit Service c5cf8c
        printf("Either the debugger support is not enabled (--enable-debuginfo)\n\
Packit Service c5cf8c
or the necessary symbols, including the extern variable\n\
Packit Service c5cf8c
MPIR_All_communicators, are not properly exported to the main program\n");
Packit Service c5cf8c
        errs++;
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
    MPI_Finalize();
Packit Service c5cf8c
    if (errs) {
Packit Service c5cf8c
        printf(" Found %d errors\n", errs);
Packit Service c5cf8c
    } else {
Packit Service c5cf8c
        printf(" No Errors\n");
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
    return 0;
Packit Service c5cf8c
}