Sunday, July 4, 2010

inferior's auxiliary vector...


(gdb) info auxv
33 AT_SYSINFO_EHDR System-supplied DSO's ELF header 0x7fff7a9ff000
16 AT_HWCAP Machine-dependent CPU capability hints 0x78bfbff
6 AT_PAGESZ System page size 4096
17 AT_CLKTCK Frequency of times() 100
3 AT_PHDR Program headers for program 0x400040
4 AT_PHENT Size of program header entry 56
5 AT_PHNUM Number of program headers 8
7 AT_BASE Base address of interpreter 0x7f382489e000
8 AT_FLAGS Flags 0x0
9 AT_ENTRY Entry point of program 0x4028e0
11 AT_UID Real user ID 1000
12 AT_EUID Effective user ID 1000
13 AT_GID Real group ID 1000
14 AT_EGID Effective group ID 1000
23 AT_SECURE Boolean, was exec setuid-like? 0
25 AT_RANDOM Address of 16 random bytes 0x7fff7a9b5839
31 AT_EXECFN File name of executable 0x7fff7a9b7fea "/usr/bin/htop"
15 AT_PLATFORM String identifying platform 0x7fff7a9b5849 "x86_64"
0 AT_NULL End of vector 0x0
(gdb)



Display the inferior's auxiliary vector.
That means acting as a subsidiary and kind of one dimensional array.
typedef struct
{
long int a_type; /* Entry type */
union
{
long int a_val; /* Integer value */
void *a_ptr; /* Pointer value */
void (*a_fcn) (void); /* Function pointer value */
} a_un;
} auxv_t;






48: /proc/PID/auxv, which is a common method for native targets. */
49:
50: extern LONGEST procfs_xfer_auxv (struct target_ops *ops,

src/gdb/auxv.c
30: #include "auxv.h"
31: #include "elf/common.h"
37: /* This function handles access via /proc/PID/auxv, which is a common method
38: for native targets. */
50: pathname = xstrprintf ("/proc/%d/auxv", PIDGET (inferior_ptid));
51: fd = open (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY);
github.com/atgreen/moxiedev.git - GPL - C

Mesa/src/mesa/ppc/common_ppc.c - 56 identical
60: Elf64_auxv_t v;
61: #else
62: Elf32_auxv_t v;
65: sprintf( file_name, "/proc/%u/auxv", (unsigned) my_pid );
66: f = fopen( file_name, "rb" );
www.w3.org/Amaya/Distribution/amaya-lib-src-9.54.tgz - Unknown - C





$sudo hexdump /proc/1045/auxv
0000000 0021 0000 0000 0000 f000 e87f 7fff 0000
0000010 0010 0000 0000 0000 fbff 078b 0000 0000
0000020 0006 0000 0000 0000 1000 0000 0000 0000
0000030 0011 0000 0000 0000 0064 0000 0000 0000
0000040 0003 0000 0000 0000 0040 0040 0000 0000
0000050 0004 0000 0000 0000 0038 0000 0000 0000
0000060 0005 0000 0000 0000 0008 0000 0000 0000
0000070 0007 0000 0000 0000 2000 d5a6 7f94 0000
0000080 0008 0000 0000 0000 0000 0000 0000 0000
0000090 0009 0000 0000 0000 1c60 0040 0000 0000
00000a0 000b 0000 0000 0000 0000 0000 0000 0000
00000b0 000c 0000 0000 0000 0000 0000 0000 0000
00000c0 000d 0000 0000 0000 0000 0000 0000 0000
00000d0 000e 0000 0000 0000 0000 0000 0000 0000
00000e0 0017 0000 0000 0000 0000 0000 0000 0000
00000f0 0019 0000 0000 0000 b1d9 e87a 7fff 0000
0000100 001f 0000 0000 0000 bfe8 e87a 7fff 0000
0000110 000f 0000 0000 0000 b1e9 e87a 7fff 0000
0000120 0000 0000 0000 0000 0000 0000 0000 0000
0000130
$



The auxiliary vector is intended for passing information from the
operating system to a program interpreter, such as /lib/ld-lsb-ia64.so.1.

source :

Linux Standard Base Specification for the Itanium™ Architecture 1.3