GDB (xrefs)
Classes | Defines | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/i386-nat.c File Reference
#include "defs.h"
#include "i386-nat.h"
#include "breakpoint.h"
#include "command.h"
#include "gdbcmd.h"
#include "target.h"
#include "gdb_assert.h"
#include "inferior.h"

Go to the source code of this file.

Classes

struct  i386_process_info

Defines

#define TARGET_HAS_DR_LEN_8   (i386_dr_low.debug_register_length == 8)
#define DR_CONTROL_SHIFT   16
#define DR_CONTROL_SIZE   4
#define DR_RW_EXECUTE   (0x0) /* Break on instruction execution. */
#define DR_RW_WRITE   (0x1) /* Break on data writes. */
#define DR_RW_READ   (0x3) /* Break on data reads or writes. */
#define DR_RW_IORW   (0x2) /* Break on I/O reads or writes. */
#define DR_LEN_1   (0x0 << 2) /* 1-byte region watch or breakpoint. */
#define DR_LEN_2   (0x1 << 2) /* 2-byte region watch. */
#define DR_LEN_4   (0x3 << 2) /* 4-byte region watch. */
#define DR_LEN_8   (0x2 << 2) /* 8-byte region watch (AMD64). */
#define DR_LOCAL_ENABLE_SHIFT   0 /* Extra shift to the local enable bit. */
#define DR_GLOBAL_ENABLE_SHIFT   1 /* Extra shift to the global enable bit. */
#define DR_ENABLE_SIZE   2 /* Two enable bits per debug register. */
#define DR_LOCAL_SLOWDOWN   (0x100)
#define DR_GLOBAL_SLOWDOWN   (0x200)
#define DR_CONTROL_RESERVED   (0xFC00)
#define I386_DR_CONTROL_MASK   (~DR_CONTROL_RESERVED)
#define I386_DR_VACANT(state, i)   (((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
#define I386_DR_LOCAL_ENABLE(state, i)
#define I386_DR_GLOBAL_ENABLE(state, i)
#define I386_DR_DISABLE(state, i)
#define I386_DR_SET_RW_LEN(state, i, rwlen)
#define I386_DR_GET_RW_LEN(dr7, i)
#define I386_DR_WATCH_MASK(i)   (1 << (i))
#define I386_DR_WATCH_HIT(dr6, i)   ((dr6) & (1 << (i)))
#define ALL_DEBUG_REGISTERS(i)   for (i = 0; i < DR_NADDR; i++)

Enumerations

enum  i386_wp_op_t { WP_INSERT, WP_REMOVE, WP_COUNT }

Functions

static struct i386_process_infoi386_find_process_pid (pid_t pid)
static struct i386_process_infoi386_add_process (pid_t pid)
static struct i386_process_infoi386_process_info_get (pid_t pid)
struct i386_debug_reg_statei386_debug_reg_state (pid_t pid)
void i386_forget_process (pid_t pid)
static unsigned i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
static int i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state, CORE_ADDR addr, unsigned len_rw_bits)
static int i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state, CORE_ADDR addr, unsigned len_rw_bits)
static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, i386_wp_op_t what, CORE_ADDR addr, int len, enum target_hw_bp_type type)
void i386_cleanup_dregs (void)
static void i386_show_dr (struct i386_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type)
static void i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state)
static int i386_insert_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond)
static int i386_remove_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond)
static int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
static int i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
static int i386_stopped_by_watchpoint (void)
static int i386_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static int i386_remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static int i386_can_use_hw_breakpoint (int type, int cnt, int othertype)
static void add_show_debug_regs_command (void)
void i386_use_watchpoints (struct target_ops *t)
void i386_set_debug_register_length (int len)

Variables

struct i386_dr_low_type i386_dr_low
static struct i386_process_infoi386_process_list = NULL
static int maint_show_dr

Define Documentation

#define ALL_DEBUG_REGISTERS (   i)    for (i = 0; i < DR_NADDR; i++)
#define DR_CONTROL_RESERVED   (0xFC00)

Definition at line 100 of file i386-nat.c.

#define DR_CONTROL_SHIFT   16

Definition at line 49 of file i386-nat.c.

#define DR_CONTROL_SIZE   4

Definition at line 51 of file i386-nat.c.

#define DR_ENABLE_SIZE   2 /* Two enable bits per debug register. */

Definition at line 85 of file i386-nat.c.

#define DR_GLOBAL_ENABLE_SHIFT   1 /* Extra shift to the global enable bit. */

Definition at line 84 of file i386-nat.c.

#define DR_GLOBAL_SLOWDOWN   (0x200)

Definition at line 93 of file i386-nat.c.

#define DR_LEN_1   (0x0 << 2) /* 1-byte region watch or breakpoint. */

Definition at line 67 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_LEN_2   (0x1 << 2) /* 2-byte region watch. */

Definition at line 68 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_LEN_4   (0x3 << 2) /* 4-byte region watch. */

Definition at line 69 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_LEN_8   (0x2 << 2) /* 8-byte region watch (AMD64). */

Definition at line 70 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_LOCAL_ENABLE_SHIFT   0 /* Extra shift to the local enable bit. */

Definition at line 83 of file i386-nat.c.

#define DR_LOCAL_SLOWDOWN   (0x100)

Definition at line 92 of file i386-nat.c.

Referenced by i386_insert_aligned_watchpoint().

#define DR_RW_EXECUTE   (0x0) /* Break on instruction execution. */

Definition at line 54 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_RW_IORW   (0x2) /* Break on I/O reads or writes. */

Definition at line 62 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_RW_READ   (0x3) /* Break on data reads or writes. */

Definition at line 56 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

#define DR_RW_WRITE   (0x1) /* Break on data writes. */

Definition at line 55 of file i386-nat.c.

Referenced by i386_length_and_rw_bits().

Definition at line 105 of file i386-nat.c.

Referenced by i386_insert_aligned_watchpoint().

#define I386_DR_DISABLE (   state,
 
)
Value:
do { \
    (state)->dr_control_mirror &= \
      ~(3 << (DR_ENABLE_SIZE * (i))); \
  } while (0)

Definition at line 127 of file i386-nat.c.

Referenced by i386_remove_aligned_watchpoint().

#define I386_DR_GET_RW_LEN (   dr7,
 
)
Value:
(((dr7) \
    >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)

Definition at line 143 of file i386-nat.c.

Referenced by i386_insert_aligned_watchpoint(), i386_remove_aligned_watchpoint(), and i386_stopped_data_address().

#define I386_DR_GLOBAL_ENABLE (   state,
 
)
Value:
do { \
    (state)->dr_control_mirror |= \
      (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
  } while (0)

Definition at line 120 of file i386-nat.c.

#define I386_DR_LOCAL_ENABLE (   state,
 
)
Value:
do { \
    (state)->dr_control_mirror |= \
      (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
  } while (0)

Definition at line 113 of file i386-nat.c.

Referenced by i386_insert_aligned_watchpoint().

#define I386_DR_SET_RW_LEN (   state,
  i,
  rwlen 
)
Value:
do { \
    (state)->dr_control_mirror &= \
      ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
    (state)->dr_control_mirror |= \
      ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
  } while (0)

Definition at line 134 of file i386-nat.c.

Referenced by i386_insert_aligned_watchpoint().

#define I386_DR_VACANT (   state,
 
)    (((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
#define I386_DR_WATCH_HIT (   dr6,
 
)    ((dr6) & (1 << (i)))

Definition at line 151 of file i386-nat.c.

Referenced by i386_stopped_data_address().

#define I386_DR_WATCH_MASK (   i)    (1 << (i))

Definition at line 148 of file i386-nat.c.

#define TARGET_HAS_DR_LEN_8   (i386_dr_low.debug_register_length == 8)

Enumeration Type Documentation

Enumerator:
WP_INSERT 
WP_REMOVE 
WP_COUNT 

Definition at line 258 of file i386-nat.c.


Function Documentation

static void add_show_debug_regs_command ( void  ) [static]
static struct i386_process_info* i386_add_process ( pid_t  pid) [static, read]
static int i386_can_use_hw_breakpoint ( int  type,
int  cnt,
int  othertype 
) [static]

Definition at line 834 of file i386-nat.c.

Referenced by i386_use_watchpoints().

void i386_cleanup_dregs ( void  )
struct i386_debug_reg_state* i386_debug_reg_state ( pid_t  pid) [read]
static struct i386_process_info* i386_find_process_pid ( pid_t  pid) [static, read]

Definition at line 178 of file i386-nat.c.

References i386_process_info::next, and i386_process_info::pid.

Referenced by i386_process_info_get().

void i386_forget_process ( pid_t  pid)
static int i386_handle_nonaligned_watchpoint ( struct i386_debug_reg_state state,
i386_wp_op_t  what,
CORE_ADDR  addr,
int  len,
enum target_hw_bp_type  type 
) [static]
static int i386_insert_aligned_watchpoint ( struct i386_debug_reg_state state,
CORE_ADDR  addr,
unsigned  len_rw_bits 
) [static]
static int i386_insert_hw_breakpoint ( struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
) [static]
static int i386_insert_watchpoint ( CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
) [static]
static unsigned i386_length_and_rw_bits ( int  len,
enum target_hw_bp_type  type 
) [static]
static struct i386_process_info* i386_process_info_get ( pid_t  pid) [static, read]

Definition at line 210 of file i386-nat.c.

References i386_add_process(), and i386_find_process_pid().

Referenced by i386_debug_reg_state().

static int i386_region_ok_for_watchpoint ( CORE_ADDR  addr,
int  len 
) [static]
static int i386_remove_aligned_watchpoint ( struct i386_debug_reg_state state,
CORE_ADDR  addr,
unsigned  len_rw_bits 
) [static]
static int i386_remove_hw_breakpoint ( struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
) [static]
static int i386_remove_watchpoint ( CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
) [static]
static void i386_show_dr ( struct i386_debug_reg_state state,
const char *  func,
CORE_ADDR  addr,
int  len,
enum target_hw_bp_type  type 
) [static]
static int i386_stopped_by_watchpoint ( void  ) [static]

Definition at line 759 of file i386-nat.c.

References current_target, and i386_stopped_data_address().

Referenced by i386_use_watchpoints().

static int i386_stopped_data_address ( struct target_ops ops,
CORE_ADDR addr_p 
) [static]
static void i386_update_inferior_debug_regs ( struct i386_debug_reg_state new_state) [static]
void i386_use_watchpoints ( struct target_ops t)

Variable Documentation

struct i386_process_info* i386_process_list = NULL [static]

Definition at line 173 of file i386-nat.c.

Referenced by i386_add_process(), and i386_forget_process().

int maint_show_dr [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines