GDBserver
Defines | Enumerations | Functions
/home/stan/gdb/src/gdb/gdbserver/i386-low.c File Reference
#include "server.h"
#include "target.h"
#include "i386-low.h"
#include "break-common.h"

Go to the source code of this file.

Defines

#define TARGET_HAS_DR_LEN_8   (sizeof (void *) == 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_HIT(dr6, i)   ((dr6) & (1 << (i)))
#define ALL_DEBUG_REGISTERS(i)   for (i = 0; i < DR_NADDR; i++)
#define Z_PACKET_HW_BP   '1'
#define Z_PACKET_WRITE_WP   '2'
#define Z_PACKET_READ_WP   '3'
#define Z_PACKET_ACCESS_WP   '4'

Enumerations

enum  i386_wp_op_t { WP_INSERT, WP_REMOVE, WP_COUNT }

Functions

void i386_low_init_dregs (struct i386_debug_reg_state *state)
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 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)
static enum target_hw_bp_type Z_packet_to_hw_type (char type)
static void i386_update_inferior_debug_regs (struct i386_debug_reg_state *inf_state, struct i386_debug_reg_state *new_state)
int i386_low_insert_watchpoint (struct i386_debug_reg_state *state, char type_from_packet, CORE_ADDR addr, int len)
int i386_low_remove_watchpoint (struct i386_debug_reg_state *state, char type_from_packet, CORE_ADDR addr, int len)
int i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state, CORE_ADDR addr, int len)
int i386_low_stopped_data_address (struct i386_debug_reg_state *state, CORE_ADDR *addr_p)
int i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state)

Define Documentation

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

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

#define DR_CONTROL_SHIFT   16

Definition at line 34 of file i386-low.c.

#define DR_CONTROL_SIZE   4

Definition at line 36 of file i386-low.c.

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

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

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

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

#define DR_GLOBAL_SLOWDOWN   (0x200)

Definition at line 78 of file i386-low.c.

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

Definition at line 52 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

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

Definition at line 53 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

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

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

Referenced by i386_length_and_rw_bits().

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

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

Referenced by i386_length_and_rw_bits().

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

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

#define DR_LOCAL_SLOWDOWN   (0x100)

Definition at line 77 of file i386-low.c.

Referenced by i386_insert_aligned_watchpoint().

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

Definition at line 39 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

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

Definition at line 47 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

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

Definition at line 41 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

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

Definition at line 40 of file i386-low.c.

Referenced by i386_length_and_rw_bits().

Definition at line 90 of file i386-low.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 112 of file i386-low.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 128 of file i386-low.c.

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

#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 105 of file i386-low.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 98 of file i386-low.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 119 of file i386-low.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 133 of file i386-low.c.

Referenced by i386_low_stopped_data_address().

#define TARGET_HAS_DR_LEN_8   (sizeof (void *) == 8)
#define Z_PACKET_ACCESS_WP   '4'

Definition at line 409 of file i386-low.c.

Referenced by Z_packet_to_hw_type().

#define Z_PACKET_HW_BP   '1'

Definition at line 406 of file i386-low.c.

Referenced by Z_packet_to_hw_type().

#define Z_PACKET_READ_WP   '3'

Definition at line 408 of file i386-low.c.

Referenced by Z_packet_to_hw_type().

#define Z_PACKET_WRITE_WP   '2'

Definition at line 407 of file i386-low.c.

Referenced by Z_packet_to_hw_type().


Enumeration Type Documentation

Enumerator:
WP_INSERT 
WP_REMOVE 
WP_COUNT 

Definition at line 139 of file i386-low.c.


Function Documentation

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 unsigned i386_length_and_rw_bits ( int  len,
enum target_hw_bp_type  type 
) [static]
void i386_low_init_dregs ( struct i386_debug_reg_state state)
int i386_low_insert_watchpoint ( struct i386_debug_reg_state state,
char  type_from_packet,
CORE_ADDR  addr,
int  len 
)
int i386_low_region_ok_for_watchpoint ( struct i386_debug_reg_state state,
CORE_ADDR  addr,
int  len 
)

Definition at line 535 of file i386-low.c.

References DR_NADDR, hw_write, i386_handle_nonaligned_watchpoint(), and WP_COUNT.

int i386_low_remove_watchpoint ( struct i386_debug_reg_state state,
char  type_from_packet,
CORE_ADDR  addr,
int  len 
)

Definition at line 632 of file i386-low.c.

References i386_low_stopped_data_address().

Referenced by i386_stopped_by_watchpoint(), and x86_stopped_by_watchpoint().

int i386_low_stopped_data_address ( struct i386_debug_reg_state state,
CORE_ADDR addr_p 
)
static int i386_remove_aligned_watchpoint ( struct i386_debug_reg_state state,
CORE_ADDR  addr,
unsigned  len_rw_bits 
) [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 void i386_update_inferior_debug_regs ( struct i386_debug_reg_state inf_state,
struct i386_debug_reg_state new_state 
) [static]
static enum target_hw_bp_type Z_packet_to_hw_type ( char  type) [static]
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines