/usr/share/doc/papi-examples/ctests/exeinfo.c is in papi-examples 5.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /*
* File: exeinfo.c
* Author: Philip Mucci
* mucci@cs.utk.edu
* Mods: <your name here>
* <your email address>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "papi.h"
#include "papi_test.h"
int
main( int argc, char **argv )
{
int retval;
const PAPI_exe_info_t *exeinfo;
tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
if ( ( retval =
PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
if ( ( exeinfo = PAPI_get_executable_info( ) ) == NULL )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", retval );
if (!TESTS_QUIET) {
printf( "Path+Program: %s\n", exeinfo->fullname );
printf( "Program: %s\n", exeinfo->address_info.name );
printf( "Text start: %p, Text end: %p\n", exeinfo->address_info.text_start,
exeinfo->address_info.text_end );
printf( "Data start: %p, Data end: %p\n", exeinfo->address_info.data_start,
exeinfo->address_info.data_end );
printf( "Bss start: %p, Bss end: %p\n", exeinfo->address_info.bss_start,
exeinfo->address_info.bss_end );
}
if ( ( strlen( &(exeinfo->fullname[0]) ) == 0 ) )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
if ( ( strlen( &(exeinfo->address_info.name[0]) ) == 0 ) )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
if ( ( exeinfo->address_info.text_start == 0x0 ) ||
( exeinfo->address_info.text_end == 0x0 ) ||
( exeinfo->address_info.text_start >=
exeinfo->address_info.text_end ) )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
if ( ( exeinfo->address_info.data_start == 0x0 ) ||
( exeinfo->address_info.data_end == 0x0 ) ||
( exeinfo->address_info.data_start >=
exeinfo->address_info.data_end ) )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
/*
if ((exeinfo->address_info.bss_start == 0x0) || (exeinfo->address_info.bss_end == 0x0) ||
(exeinfo->address_info.bss_start >= exeinfo->address_info.bss_end))
test_fail(__FILE__, __LINE__, "PAPI_get_executable_info",1);
*/
sleep( 1 ); /* Needed for debugging, so you can ^Z and stop the process, inspect /proc to see if it's right */
test_pass( __FILE__ );
return 0;
}
|