GDB (xrefs)
Classes | Macros | Typedefs | Enumerations | Functions | Variables
/tmp/gdb-7.10/gdb/linux-tdep.c File Reference
#include "defs.h"
#include "gdbtypes.h"
#include "linux-tdep.h"
#include "auxv.h"
#include "target.h"
#include "gdbthread.h"
#include "gdbcore.h"
#include "regcache.h"
#include "regset.h"
#include "elf/common.h"
#include "elf-bfd.h"
#include "inferior.h"
#include "cli/cli-utils.h"
#include "arch-utils.h"
#include "gdb_obstack.h"
#include "observer.h"
#include "objfiles.h"
#include "infcall.h"
#include "gdbcmd.h"
#include "gdb_regex.h"
#include <ctype.h>

Go to the source code of this file.

Classes

struct  smaps_vmflags
 
struct  linux_gdbarch_data
 
struct  linux_info
 
struct  linux_find_memory_regions_data
 
struct  linux_make_mappings_data
 
struct  linux_collect_regset_section_cb_data
 
struct  linux_corefile_thread_data
 

Macros

#define GDB_MMAP_MAP_PRIVATE   0x02 /* Changes are private. */
 
#define GDB_MMAP_MAP_ANONYMOUS   0x20 /* Don't use a file. */
 

Typedefs

typedef int linux_find_memory_region_ftype(ULONGEST vaddr, ULONGEST size, ULONGEST offset, ULONGEST inode, int read, int write, int exec, int modified, const char *filename, void *data)
 

Enumerations

enum  filterflags {
  COREFILTER_ANON_PRIVATE = 1 << 0, COREFILTER_ANON_SHARED = 1 << 1, COREFILTER_MAPPED_PRIVATE = 1 << 2, COREFILTER_MAPPED_SHARED = 1 << 3,
  COREFILTER_ELF_HEADERS = 1 << 4, COREFILTER_HUGETLB_PRIVATE = 1 << 5, COREFILTER_HUGETLB_SHARED = 1 << 6
}
 
enum  {
  LINUX_SIGHUP = 1, LINUX_SIGINT = 2, LINUX_SIGQUIT = 3, LINUX_SIGILL = 4,
  LINUX_SIGTRAP = 5, LINUX_SIGABRT = 6, LINUX_SIGIOT = 6, LINUX_SIGBUS = 7,
  LINUX_SIGFPE = 8, LINUX_SIGKILL = 9, LINUX_SIGUSR1 = 10, LINUX_SIGSEGV = 11,
  LINUX_SIGUSR2 = 12, LINUX_SIGPIPE = 13, LINUX_SIGALRM = 14, LINUX_SIGTERM = 15,
  LINUX_SIGSTKFLT = 16, LINUX_SIGCHLD = 17, LINUX_SIGCONT = 18, LINUX_SIGSTOP = 19,
  LINUX_SIGTSTP = 20, LINUX_SIGTTIN = 21, LINUX_SIGTTOU = 22, LINUX_SIGURG = 23,
  LINUX_SIGXCPU = 24, LINUX_SIGXFSZ = 25, LINUX_SIGVTALRM = 26, LINUX_SIGPROF = 27,
  LINUX_SIGWINCH = 28, LINUX_SIGIO = 29, LINUX_SIGPOLL = LINUX_SIGIO, LINUX_SIGPWR = 30,
  LINUX_SIGSYS = 31, LINUX_SIGUNUSED = 31, LINUX_SIGRTMIN = 32, LINUX_SIGRTMAX = 64
}
 

Functions

static void * init_linux_gdbarch_data (struct gdbarch *gdbarch)
 
static struct linux_gdbarch_dataget_linux_gdbarch_data (struct gdbarch *gdbarch)
 
static void invalidate_linux_cache_inf (struct inferior *inf)
 
static void linux_inferior_data_cleanup (struct inferior *inf, void *arg)
 
static struct linux_infoget_linux_inferior_data (void)
 
static struct typelinux_get_siginfo_type (struct gdbarch *gdbarch)
 
int linux_is_uclinux (void)
 
static int linux_has_shared_address_space (struct gdbarch *gdbarch)
 
static char * linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 
static void read_mapping (const char *line, ULONGEST *addr, ULONGEST *endaddr, const char **permissions, size_t *permissions_len, ULONGEST *offset, const char **device, size_t *device_len, ULONGEST *inode, const char **filename)
 
static void decode_vmflags (char *p, struct smaps_vmflags *v)
 
static int mapping_is_anonymous_p (const char *filename)
 
static int dump_mapping_p (enum filterflags filterflags, const struct smaps_vmflags *v, int maybe_private_p, int mapping_anon_p, int mapping_file_p, const char *filename)
 
static void linux_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
 
static void linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
 
static void linux_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
 
static int linux_find_memory_regions_full (struct gdbarch *gdbarch, linux_find_memory_region_ftype *func, void *obfd)
 
static int linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size, ULONGEST offset, ULONGEST inode, int read, int write, int exec, int modified, const char *filename, void *arg)
 
static int linux_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *obfd)
 
static int find_signalled_thread (struct thread_info *info, void *data)
 
static enum gdb_signal find_stop_signal (void)
 
static char * linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
 
static int linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size, ULONGEST offset, ULONGEST inode, int read, int write, int exec, int modified, const char *filename, void *data)
 
static char * linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size)
 
static void linux_collect_regset_section_cb (const char *sect_name, int size, const struct regset *regset, const char *human_name, void *cb_data)
 
static char * linux_collect_thread_registers (const struct regcache *regcache, ptid_t ptid, bfd *obfd, char *note_data, int *note_size, enum gdb_signal stop_signal)
 
static gdb_bytelinux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
 
static int linux_corefile_thread_callback (struct thread_info *info, void *data)
 
static int linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
 
static char * linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
 
enum gdb_signal linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
 
int linux_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
 
static int find_mapping_size (CORE_ADDR vaddr, unsigned long size, int read, int write, int exec, int modified, void *data)
 
static int linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
 
static int linux_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
 
static CORE_ADDR linux_infcall_mmap (CORE_ADDR size, unsigned prot)
 
static void linux_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
 
CORE_ADDR linux_displaced_step_location (struct gdbarch *gdbarch)
 
static void show_use_coredump_filter (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
void _initialize_linux_tdep (void)
 

Variables

static int use_coredump_filter = 1
 
static struct gdbarch_datalinux_gdbarch_data_handle
 
static const struct inferior_data * linux_inferior_data
 
static linux_find_memory_region_ftype linux_make_mappings_callback
 
initialize_file_ftype _initialize_linux_tdep
 

Macro Definition Documentation

#define GDB_MMAP_MAP_ANONYMOUS   0x20 /* Don't use a file. */

Definition at line 2309 of file linux-tdep.c.

Referenced by linux_infcall_mmap().

#define GDB_MMAP_MAP_PRIVATE   0x02 /* Changes are private. */

Definition at line 2308 of file linux-tdep.c.

Referenced by linux_infcall_mmap().

Typedef Documentation

typedef int linux_find_memory_region_ftype(ULONGEST vaddr, ULONGEST size, ULONGEST offset, ULONGEST inode, int read, int write, int exec, int modified, const char *filename, void *data)

Definition at line 1101 of file linux-tdep.c.

Enumeration Type Documentation

anonymous enum
Enumerator
LINUX_SIGHUP 
LINUX_SIGINT 
LINUX_SIGQUIT 
LINUX_SIGILL 
LINUX_SIGTRAP 
LINUX_SIGABRT 
LINUX_SIGIOT 
LINUX_SIGBUS 
LINUX_SIGFPE 
LINUX_SIGKILL 
LINUX_SIGUSR1 
LINUX_SIGSEGV 
LINUX_SIGUSR2 
LINUX_SIGPIPE 
LINUX_SIGALRM 
LINUX_SIGTERM 
LINUX_SIGSTKFLT 
LINUX_SIGCHLD 
LINUX_SIGCONT 
LINUX_SIGSTOP 
LINUX_SIGTSTP 
LINUX_SIGTTIN 
LINUX_SIGTTOU 
LINUX_SIGURG 
LINUX_SIGXCPU 
LINUX_SIGXFSZ 
LINUX_SIGVTALRM 
LINUX_SIGPROF 
LINUX_SIGWINCH 
LINUX_SIGIO 
LINUX_SIGPOLL 
LINUX_SIGPWR 
LINUX_SIGSYS 
LINUX_SIGUNUSED 
LINUX_SIGRTMIN 
LINUX_SIGRTMAX 

Definition at line 117 of file linux-tdep.c.

Enumerator
COREFILTER_ANON_PRIVATE 
COREFILTER_ANON_SHARED 
COREFILTER_MAPPED_PRIVATE 
COREFILTER_MAPPED_SHARED 
COREFILTER_ELF_HEADERS 
COREFILTER_HUGETLB_PRIVATE 
COREFILTER_HUGETLB_SHARED 

Definition at line 49 of file linux-tdep.c.

Function Documentation

void _initialize_linux_tdep ( void  )
static void decode_vmflags ( char *  p,
struct smaps_vmflags v 
)
static
static int dump_mapping_p ( enum filterflags  filterflags,
const struct smaps_vmflags v,
int  maybe_private_p,
int  mapping_anon_p,
int  mapping_file_p,
const char *  filename 
)
static
static int find_mapping_size ( CORE_ADDR  vaddr,
unsigned long  size,
int  read,
int  write,
int  exec,
int  modified,
void *  data 
)
static

Definition at line 2251 of file linux-tdep.c.

References mem_range::length, size, and mem_range::start.

Referenced by linux_vsyscall_range_raw().

static int find_signalled_thread ( struct thread_info info,
void *  data 
)
static
static enum gdb_signal find_stop_signal ( void  )
static
static struct linux_gdbarch_data* get_linux_gdbarch_data ( struct gdbarch gdbarch)
static

Definition at line 172 of file linux-tdep.c.

References gdbarch_data().

Referenced by linux_get_siginfo_type().

static struct linux_info* get_linux_inferior_data ( void  )
static

Definition at line 228 of file linux-tdep.c.

References current_inferior(), and linux_inferior_data.

Referenced by linux_vsyscall_range().

static void* init_linux_gdbarch_data ( struct gdbarch gdbarch)
static

Definition at line 166 of file linux-tdep.c.

References GDBARCH_OBSTACK_ZALLOC.

Referenced by _initialize_linux_tdep().

static void invalidate_linux_cache_inf ( struct inferior inf)
static

Definition at line 202 of file linux-tdep.c.

References linux_inferior_data, and xfree().

Referenced by _initialize_linux_tdep(), and linux_inferior_data_cleanup().

static void linux_collect_regset_section_cb ( const char *  sect_name,
int  size,
const struct regset regset,
const char *  human_name,
void *  cb_data 
)
static
static char* linux_collect_thread_registers ( const struct regcache regcache,
ptid_t  ptid,
bfd *  obfd,
char *  note_data,
int note_size,
enum gdb_signal  stop_signal 
)
static
static void linux_core_info_proc ( struct gdbarch gdbarch,
const char *  args,
enum info_proc_what  what 
)
static
static void linux_core_info_proc_mappings ( struct gdbarch gdbarch,
const char *  args 
)
static
static char* linux_core_pid_to_str ( struct gdbarch gdbarch,
ptid_t  ptid 
)
static

Definition at line 385 of file linux-tdep.c.

References normal_pid_to_str(), and ptid_get_lwp().

Referenced by linux_init_abi().

static int linux_corefile_thread_callback ( struct thread_info info,
void *  data 
)
static
CORE_ADDR linux_displaced_step_location ( struct gdbarch gdbarch)
static int linux_fill_prpsinfo ( struct elf_internal_linux_prpsinfo *  p)
static
static int linux_find_memory_regions ( struct gdbarch gdbarch,
find_memory_region_ftype  func,
void *  obfd 
)
static
static int linux_find_memory_regions_full ( struct gdbarch gdbarch,
linux_find_memory_region_ftype func,
void *  obfd 
)
static
static int linux_find_memory_regions_thunk ( ULONGEST  vaddr,
ULONGEST  size,
ULONGEST  offset,
ULONGEST  inode,
int  read,
int  write,
int  exec,
int  modified,
const char *  filename,
void *  arg 
)
static
enum gdb_signal linux_gdb_signal_from_target ( struct gdbarch gdbarch,
int  signal 
)
int linux_gdb_signal_to_target ( struct gdbarch gdbarch,
enum gdb_signal  signal 
)
static gdb_byte* linux_get_siginfo_data ( struct gdbarch gdbarch,
LONGEST size 
)
static
static struct type* linux_get_siginfo_type ( struct gdbarch gdbarch)
static
static int linux_has_shared_address_space ( struct gdbarch gdbarch)
static

Definition at line 377 of file linux-tdep.c.

References linux_is_uclinux().

Referenced by linux_init_abi().

static CORE_ADDR linux_infcall_mmap ( CORE_ADDR  size,
unsigned  prot 
)
static
static void linux_infcall_munmap ( CORE_ADDR  addr,
CORE_ADDR  size 
)
static
static void linux_inferior_data_cleanup ( struct inferior inf,
void *  arg 
)
static

Definition at line 219 of file linux-tdep.c.

References invalidate_linux_cache_inf().

Referenced by _initialize_linux_tdep().

static void linux_info_proc ( struct gdbarch gdbarch,
const char *  args,
enum info_proc_what  what 
)
static
void linux_init_abi ( struct gdbarch_info  info,
struct gdbarch gdbarch 
)
int linux_is_uclinux ( void  )
static char* linux_make_corefile_notes ( struct gdbarch gdbarch,
bfd *  obfd,
int note_size 
)
static
static int linux_make_mappings_callback ( ULONGEST  vaddr,
ULONGEST  size,
ULONGEST  offset,
ULONGEST  inode,
int  read,
int  write,
int  exec,
int  modified,
const char *  filename,
void *  data 
)
static
static char* linux_make_mappings_corefile_notes ( struct gdbarch gdbarch,
bfd *  obfd,
char *  note_data,
int note_size 
)
static
static char* linux_spu_make_corefile_notes ( bfd *  obfd,
char *  note_data,
int note_size 
)
static
static int linux_vsyscall_range ( struct gdbarch gdbarch,
struct mem_range range 
)
static
static int linux_vsyscall_range_raw ( struct gdbarch gdbarch,
struct mem_range range 
)
static
static int mapping_is_anonymous_p ( const char *  filename)
static
static void read_mapping ( const char *  line,
ULONGEST addr,
ULONGEST endaddr,
const char **  permissions,
size_t *  permissions_len,
ULONGEST offset,
const char **  device,
size_t *  device_len,
ULONGEST inode,
const char **  filename 
)
static

Definition at line 401 of file linux-tdep.c.

References line, skip_spaces_const(), and strtoulst().

Referenced by linux_find_memory_regions_full(), and linux_info_proc().

static void show_use_coredump_filter ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 2416 of file linux-tdep.c.

References _, and fprintf_filtered().

Referenced by _initialize_linux_tdep().

Variable Documentation

initialize_file_ftype _initialize_linux_tdep
struct gdbarch_data* linux_gdbarch_data_handle
static

Definition at line 158 of file linux-tdep.c.

const struct inferior_data* linux_inferior_data
static
linux_find_memory_region_ftype linux_make_mappings_callback
static

Definition at line 1446 of file linux-tdep.c.

Referenced by linux_make_mappings_corefile_notes().

int use_coredump_filter = 1
static

Definition at line 91 of file linux-tdep.c.

Referenced by _initialize_linux_tdep(), and linux_find_memory_regions_full().