32 #include "elf/common.h"
60 && lseek (fd, (off_t) offset,
SEEK_SET) != (off_t) offset)
62 else if (readbuf != NULL)
63 l =
read (fd, readbuf, (
size_t) len);
65 l = write (fd, writebuf, (
size_t) len);
92 size_t auxv_pair_size = 2 * ptr_size;
93 gdb_byte *ptr_buf = alloca (ptr_size);
137 if (data_address == 0)
142 if (writebuf != NULL)
156 if (offset >= auxv_pair_size)
180 block &= -auxv_pair_size;
186 if (block <= auxv_pair_size)
189 block = auxv_pair_size;
193 data_address += block;
200 while (block >= auxv_pair_size)
202 retval += auxv_pair_size;
210 readbuf += auxv_pair_size;
211 block -= auxv_pair_size;
269 if (endptr - ptr < sizeof_auxv_field * 2)
273 ptr += sizeof_auxv_field;
275 ptr += sizeof_auxv_field;
429 const char *
name =
"???";
430 const char *description =
"";
431 enum { dec, hex, str } flavor = hex;
435 #define TAG(tag, text, kind) \
436 case tag: name = #tag; description = text; flavor = kind; break
437 TAG (AT_NULL,
_(
"End of vector"), hex);
438 TAG (AT_IGNORE,
_(
"Entry should be ignored"), hex);
439 TAG (AT_EXECFD,
_(
"File descriptor of program"), dec);
440 TAG (AT_PHDR,
_(
"Program headers for program"), hex);
441 TAG (AT_PHENT,
_(
"Size of program header entry"), dec);
442 TAG (AT_PHNUM,
_(
"Number of program headers"), dec);
443 TAG (AT_PAGESZ,
_(
"System page size"), dec);
444 TAG (AT_BASE,
_(
"Base address of interpreter"), hex);
445 TAG (AT_FLAGS,
_(
"Flags"), hex);
446 TAG (AT_ENTRY,
_(
"Entry point of program"), hex);
447 TAG (AT_NOTELF,
_(
"Program is not ELF"), dec);
448 TAG (AT_UID,
_(
"Real user ID"), dec);
449 TAG (AT_EUID,
_(
"Effective user ID"), dec);
450 TAG (AT_GID,
_(
"Real group ID"), dec);
451 TAG (AT_EGID,
_(
"Effective group ID"), dec);
452 TAG (AT_CLKTCK,
_(
"Frequency of times()"), dec);
453 TAG (AT_PLATFORM,
_(
"String identifying platform"), str);
454 TAG (AT_HWCAP,
_(
"Machine-dependent CPU capability hints"), hex);
455 TAG (AT_FPUCW,
_(
"Used FPU control word"), dec);
456 TAG (AT_DCACHEBSIZE,
_(
"Data cache block size"), dec);
457 TAG (AT_ICACHEBSIZE,
_(
"Instruction cache block size"), dec);
458 TAG (AT_UCACHEBSIZE,
_(
"Unified cache block size"), dec);
459 TAG (AT_IGNOREPPC,
_(
"Entry should be ignored"), dec);
460 TAG (AT_BASE_PLATFORM,
_(
"String identifying base platform"), str);
461 TAG (AT_RANDOM,
_(
"Address of 16 random bytes"), hex);
462 TAG (AT_HWCAP2,
_(
"Extension of AT_HWCAP"), hex);
463 TAG (AT_EXECFN,
_(
"File name of executable"), str);
464 TAG (AT_SECURE,
_(
"Boolean, was exec setuid-like?"), dec);
465 TAG (AT_SYSINFO,
_(
"Special system info/entry points"), hex);
466 TAG (AT_SYSINFO_EHDR,
_(
"System-supplied DSO's ELF header"), hex);
467 TAG (AT_L1I_CACHESHAPE,
_(
"L1 Instruction cache information"), hex);
468 TAG (AT_L1D_CACHESHAPE,
_(
"L1 Data cache information"), hex);
469 TAG (AT_L2_CACHESHAPE,
_(
"L2 cache information"), hex);
470 TAG (AT_L3_CACHESHAPE,
_(
"L3 cache information"), hex);
471 TAG (AT_SUN_UID,
_(
"Effective user ID"), dec);
472 TAG (AT_SUN_RUID,
_(
"Real user ID"), dec);
473 TAG (AT_SUN_GID,
_(
"Effective group ID"), dec);
474 TAG (AT_SUN_RGID,
_(
"Real group ID"), dec);
475 TAG (AT_SUN_LDELF,
_(
"Dynamic linker's ELF header"), hex);
476 TAG (AT_SUN_LDSHDR,
_(
"Dynamic linker's section headers"), hex);
477 TAG (AT_SUN_LDNAME,
_(
"String giving name of dynamic linker"), str);
478 TAG (AT_SUN_LPAGESZ,
_(
"Large pagesize"), dec);
479 TAG (AT_SUN_PLATFORM,
_(
"Platform name string"), str);
480 TAG (AT_SUN_HWCAP,
_(
"Machine-dependent CPU capability hints"), hex);
481 TAG (AT_SUN_IFLUSH,
_(
"Should flush icache?"), dec);
482 TAG (AT_SUN_CPU,
_(
"CPU name string"), str);
483 TAG (AT_SUN_EMUL_ENTRY,
_(
"COFF entry point address"), hex);
484 TAG (AT_SUN_EMUL_EXECFD,
_(
"COFF executable file descriptor"), dec);
485 TAG (AT_SUN_EXECNAME,
486 _(
"Canonicalized file name given to execve"), str);
487 TAG (AT_SUN_MMU,
_(
"String for name of MMU module"), str);
488 TAG (AT_SUN_LDDATA,
_(
"Dynamic linker's data segment address"), hex);
489 TAG (AT_SUN_AUXFLAGS,
490 _(
"AF_SUN_ flags passed from the kernel"), hex);
494 plongest (type), name, description);
511 NULL, val, -1, file, &opts);
528 error (
_(
"The program has no auxiliary information now."));
534 error (
_(
"No auxiliary vector found, or failed reading it."));
536 error (
_(
"Auxiliary vector is empty."));
547 _(
"Display the inferior's auxiliary vector.\n\
548 This is information provided by the operating system at program startup."));
struct gdbarch * target_gdbarch(void)
ssize_t read(int fd, void *buf, size_t count)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
int target_write_memory(CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
static enum target_xfer_status procfs_xfer_auxv(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
char * plongest(LONGEST l)
LONGEST target_read_alloc(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte **buf_p)
struct ui_file * gdb_stdout
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct observer * observer_attach_executable_changed(observer_executable_changed_ftype *f)
int fprint_target_auxv(struct ui_file *file, struct target_ops *ops)
struct observer * observer_attach_inferior_exit(observer_inferior_exit_ftype *f)
static void invalidate_auxv_cache(void)
int gdbarch_auxv_parse(struct gdbarch *gdbarch, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
initialize_file_ftype _initialize_auxv
int default_auxv_parse(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
int gdbarch_auxv_parse_p(struct gdbarch *gdbarch)
struct target_ops current_target
void initialize_file_ftype(void)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static const struct inferior_data * auxv_inferior_data
int target_auxv_search(struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
static struct auxv_info * get_auxv_inferior_data(struct target_ops *ops)
#define MSYMBOL_SIZE(msymbol)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
#define TAG(tag, text, kind)
struct cmd_list_element * add_info(const char *name, cmd_cfunc_ftype *fun, const char *doc)
static void invalidate_auxv_cache_inf(struct inferior *inf)
int target_auxv_parse(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
char * xstrprintf(const char *format,...)
struct observer * observer_attach_inferior_appeared(observer_inferior_appeared_ftype *f)
int ptid_get_pid(ptid_t ptid)
int(* to_auxv_parse)(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) TARGET_DEFAULT_FUNC(default_auxv_parse)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
struct type * builtin_data_ptr
struct minimal_symbol * minsym
void get_user_print_options(struct value_print_options *opts)
static void info_auxv_command(char *cmd, int from_tty)
int gdb_open_cloexec(const char *filename, int flags, unsigned long mode)
static enum target_xfer_status ld_so_xfer_auxv(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
struct inferior * current_inferior(void)
unsigned long long ULONGEST
enum target_xfer_status memory_xfer_auxv(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
static void auxv_inferior_data_cleanup(struct inferior *inf, void *arg)
#define TYPE_LENGTH(thistype)
int val_print_string(struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
void error(const char *fmt,...)
const ULONGEST const LONGEST len