GDBserver
Classes | Macros | Enumerations | Functions | Variables
mem-break.c File Reference
#include "server.h"
#include "regcache.h"
#include "ax.h"

Go to the source code of this file.

Classes

struct  raw_breakpoint
 
struct  point_cond_list
 
struct  point_command_list
 
struct  breakpoint
 
struct  fast_tracepoint_jump
 

Macros

#define MAX_BREAKPOINT_LEN   8
 
#define APPEND_TO_LIST(listpp, itemp, tailp)
 
#define fast_tracepoint_jump_insn(fp)   ((fp)->insn_and_shadow + 0)
 
#define fast_tracepoint_jump_shadow(fp)   ((fp)->insn_and_shadow + (fp)->length)
 

Enumerations

enum  bkpt_type {
  gdb_breakpoint_Z0, gdb_breakpoint_Z1, gdb_breakpoint_Z2, gdb_breakpoint_Z3,
  gdb_breakpoint_Z4, reinsert_breakpoint, other_breakpoint
}
 

Functions

enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type (enum raw_bkpt_type raw_type)
 
static enum bkpt_type Z_packet_to_bkpt_type (char z_type)
 
enum raw_bkpt_type Z_packet_to_raw_bkpt_type (char z_type)
 
int any_persistent_commands ()
 
static struct raw_breakpointfind_enabled_raw_code_breakpoint_at (CORE_ADDR addr, enum raw_bkpt_type type)
 
static struct raw_breakpointfind_raw_breakpoint_at (CORE_ADDR addr, enum raw_bkpt_type type, int size)
 
int insert_memory_breakpoint (struct raw_breakpoint *bp)
 
int remove_memory_breakpoint (struct raw_breakpoint *bp)
 
static struct raw_breakpointset_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int size, int *err)
 
static struct fast_tracepoint_jumpfind_fast_tracepoint_jump_at (CORE_ADDR where)
 
int fast_tracepoint_jump_here (CORE_ADDR where)
 
int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
 
void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp)
 
struct fast_tracepoint_jumpset_fast_tracepoint_jump (CORE_ADDR where, unsigned char *insn, ULONGEST length)
 
void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
 
void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
 
static struct breakpointset_breakpoint (enum bkpt_type type, enum raw_bkpt_type raw_type, CORE_ADDR where, int size, int(*handler)(CORE_ADDR), int *err)
 
struct breakpointset_breakpoint_at (CORE_ADDR where, int(*handler)(CORE_ADDR))
 
static int delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel)
 
static int release_breakpoint (struct process_info *proc, struct breakpoint *bp)
 
static int delete_breakpoint_1 (struct process_info *proc, struct breakpoint *todel)
 
int delete_breakpoint (struct breakpoint *todel)
 
static struct breakpointfind_gdb_breakpoint (char z_type, CORE_ADDR addr, int size)
 
static int z_type_supported (char z_type)
 
static struct breakpointset_gdb_breakpoint_1 (char z_type, CORE_ADDR addr, int size, int *err)
 
static int check_gdb_bp_preconditions (char z_type, int *err)
 
struct breakpointset_gdb_breakpoint (char z_type, CORE_ADDR addr, int size, int *err)
 
static int delete_gdb_breakpoint_1 (char z_type, CORE_ADDR addr, int size)
 
int delete_gdb_breakpoint (char z_type, CORE_ADDR addr, int size)
 
static void clear_breakpoint_conditions (struct breakpoint *bp)
 
static void clear_breakpoint_commands (struct breakpoint *bp)
 
void clear_breakpoint_conditions_and_commands (struct breakpoint *bp)
 
static void add_condition_to_breakpoint (struct breakpoint *bp, struct agent_expr *condition)
 
int add_breakpoint_condition (struct breakpoint *bp, char **condition)
 
static int gdb_condition_true_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
 
int gdb_condition_true_at_breakpoint (CORE_ADDR where)
 
void add_commands_to_breakpoint (struct breakpoint *bp, struct agent_expr *commands, int persist)
 
int add_breakpoint_commands (struct breakpoint *bp, char **command, int persist)
 
static int gdb_no_commands_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
 
int gdb_no_commands_at_breakpoint (CORE_ADDR where)
 
static int run_breakpoint_commands_z_type (char z_type, CORE_ADDR addr)
 
void run_breakpoint_commands (CORE_ADDR where)
 
int gdb_breakpoint_here (CORE_ADDR where)
 
void set_reinsert_breakpoint (CORE_ADDR stop_at)
 
void delete_reinsert_breakpoints (void)
 
static void uninsert_raw_breakpoint (struct raw_breakpoint *bp)
 
void uninsert_breakpoints_at (CORE_ADDR pc)
 
void uninsert_all_breakpoints (void)
 
static void reinsert_raw_breakpoint (struct raw_breakpoint *bp)
 
void reinsert_breakpoints_at (CORE_ADDR pc)
 
void reinsert_all_breakpoints (void)
 
void check_breakpoints (CORE_ADDR stop_pc)
 
void set_breakpoint_data (const unsigned char *bp_data, int bp_len)
 
int breakpoint_here (CORE_ADDR addr)
 
int breakpoint_inserted_here (CORE_ADDR addr)
 
int software_breakpoint_inserted_here (CORE_ADDR addr)
 
int hardware_breakpoint_inserted_here (CORE_ADDR addr)
 
static int validate_inserted_breakpoint (struct raw_breakpoint *bp)
 
static void delete_disabled_breakpoints (void)
 
void validate_breakpoints (void)
 
void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
 
void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, const unsigned char *myaddr, int mem_len)
 
void delete_all_breakpoints (void)
 
void mark_breakpoints_out (struct process_info *proc)
 
void free_all_breakpoints (struct process_info *proc)
 
static struct agent_exprclone_agent_expr (const struct agent_expr *src_ax)
 
static struct breakpointclone_one_breakpoint (const struct breakpoint *src)
 
void clone_all_breakpoints (struct breakpoint **new_list, struct raw_breakpoint **new_raw_list, const struct breakpoint *src_list)
 

Variables

const unsigned char * breakpoint_data
 
int breakpoint_len
 

Macro Definition Documentation

#define APPEND_TO_LIST (   listpp,
  itemp,
  tailp 
)
Value:
do \
{ \
if ((tailp) == NULL) \
*(listpp) = (itemp); \
else \
(tailp)->next = (itemp); \
(tailp) = (itemp); \
} \
while (0)

Definition at line 36 of file mem-break.c.

Referenced by clone_all_breakpoints(), and clone_one_breakpoint().

#define fast_tracepoint_jump_insn (   fp)    ((fp)->insn_and_shadow + 0)

Definition at line 468 of file mem-break.c.

Referenced by check_mem_write(), and set_fast_tracepoint_jump().

#define fast_tracepoint_jump_shadow (   fp)    ((fp)->insn_and_shadow + (fp)->length)
#define MAX_BREAKPOINT_LEN   8

Enumeration Type Documentation

enum bkpt_type
Enumerator
gdb_breakpoint_Z0 
gdb_breakpoint_Z1 
gdb_breakpoint_Z2 
gdb_breakpoint_Z3 
gdb_breakpoint_Z4 
reinsert_breakpoint 
other_breakpoint 

Definition at line 116 of file mem-break.c.

Function Documentation

int add_breakpoint_commands ( struct breakpoint bp,
char **  command,
int  persist 
)

Definition at line 1282 of file mem-break.c.

References add_commands_to_breakpoint(), and gdb_parse_agent_expr().

Referenced by process_point_options().

int add_breakpoint_condition ( struct breakpoint bp,
char **  condition 
)

Definition at line 1183 of file mem-break.c.

References add_condition_to_breakpoint(), and gdb_parse_agent_expr().

Referenced by process_point_options().

void add_commands_to_breakpoint ( struct breakpoint bp,
struct agent_expr commands,
int  persist 
)
static void add_condition_to_breakpoint ( struct breakpoint bp,
struct agent_expr condition 
)
static
int any_persistent_commands ( void  )
int breakpoint_here ( CORE_ADDR  addr)
int breakpoint_inserted_here ( CORE_ADDR  addr)
void check_breakpoints ( CORE_ADDR  stop_pc)
static int check_gdb_bp_preconditions ( char  z_type,
int *  err 
)
static

Definition at line 1000 of file mem-break.c.

References current_thread, and z_type_supported().

Referenced by delete_gdb_breakpoint(), and set_gdb_breakpoint().

void check_mem_read ( CORE_ADDR  mem_addr,
unsigned char *  buf,
int  mem_len 
)
void check_mem_write ( CORE_ADDR  mem_addr,
unsigned char *  buf,
const unsigned char *  myaddr,
int  mem_len 
)
static void clear_breakpoint_commands ( struct breakpoint bp)
static
static void clear_breakpoint_conditions ( struct breakpoint bp)
static
void clear_breakpoint_conditions_and_commands ( struct breakpoint bp)
static struct agent_expr* clone_agent_expr ( const struct agent_expr src_ax)
static

Definition at line 1936 of file mem-break.c.

References agent_expr::bytes, agent_expr::length, and xcalloc().

Referenced by clone_one_breakpoint().

void clone_all_breakpoints ( struct breakpoint **  new_list,
struct raw_breakpoint **  new_raw_list,
const struct breakpoint src_list 
)

Definition at line 2003 of file mem-break.c.

References APPEND_TO_LIST, clone_one_breakpoint(), breakpoint::next, and breakpoint::raw.

Referenced by handle_extended_wait().

static struct breakpoint* clone_one_breakpoint ( const struct breakpoint src)
static
void delete_all_breakpoints ( void  )

Definition at line 1898 of file mem-break.c.

References process_info::breakpoints, current_process(), and delete_breakpoint_1().

int delete_breakpoint ( struct breakpoint todel)
static int delete_breakpoint_1 ( struct process_info proc,
struct breakpoint todel 
)
static
static void delete_disabled_breakpoints ( void  )
static
int delete_fast_tracepoint_jump ( struct fast_tracepoint_jump todel)
int delete_gdb_breakpoint ( char  z_type,
CORE_ADDR  addr,
int  size 
)
static int delete_gdb_breakpoint_1 ( char  z_type,
CORE_ADDR  addr,
int  size 
)
static
static int delete_raw_breakpoint ( struct process_info proc,
struct raw_breakpoint todel 
)
static
void delete_reinsert_breakpoints ( void  )
int fast_tracepoint_jump_here ( CORE_ADDR  where)

Definition at line 492 of file mem-break.c.

References find_fast_tracepoint_jump_at().

Referenced by need_step_over_p().

static struct raw_breakpoint* find_enabled_raw_code_breakpoint_at ( CORE_ADDR  addr,
enum raw_bkpt_type  type 
)
static
static struct fast_tracepoint_jump* find_fast_tracepoint_jump_at ( CORE_ADDR  where)
static
static struct breakpoint* find_gdb_breakpoint ( char  z_type,
CORE_ADDR  addr,
int  size 
)
static
static struct raw_breakpoint* find_raw_breakpoint_at ( CORE_ADDR  addr,
enum raw_bkpt_type  type,
int  size 
)
static
void free_all_breakpoints ( struct process_info proc)

Definition at line 1921 of file mem-break.c.

References process_info::breakpoints, delete_breakpoint_1(), and mark_breakpoints_out().

Referenced by remove_process().

int gdb_breakpoint_here ( CORE_ADDR  where)
int gdb_condition_true_at_breakpoint ( CORE_ADDR  where)
static int gdb_condition_true_at_breakpoint_z_type ( char  z_type,
CORE_ADDR  addr 
)
static
int gdb_no_commands_at_breakpoint ( CORE_ADDR  where)
static int gdb_no_commands_at_breakpoint_z_type ( char  z_type,
CORE_ADDR  addr 
)
static
int hardware_breakpoint_inserted_here ( CORE_ADDR  addr)
void inc_ref_fast_tracepoint_jump ( struct fast_tracepoint_jump jp)

Definition at line 562 of file mem-break.c.

References fast_tracepoint_jump::refcount.

Referenced by clone_fast_tracepoint().

int insert_memory_breakpoint ( struct raw_breakpoint bp)
void mark_breakpoints_out ( struct process_info proc)
enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type ( enum raw_bkpt_type  raw_type)
void reinsert_all_breakpoints ( void  )
void reinsert_breakpoints_at ( CORE_ADDR  pc)
void reinsert_fast_tracepoint_jumps_at ( CORE_ADDR  where)
static void reinsert_raw_breakpoint ( struct raw_breakpoint bp)
static
static int release_breakpoint ( struct process_info proc,
struct breakpoint bp 
)
static
int remove_memory_breakpoint ( struct raw_breakpoint bp)
void run_breakpoint_commands ( CORE_ADDR  where)

Definition at line 1374 of file mem-break.c.

References run_breakpoint_commands_z_type(), Z_PACKET_HW_BP, and Z_PACKET_SW_BP.

Referenced by linux_wait_1().

static int run_breakpoint_commands_z_type ( char  z_type,
CORE_ADDR  addr 
)
static
static struct breakpoint* set_breakpoint ( enum bkpt_type  type,
enum raw_bkpt_type  raw_type,
CORE_ADDR  where,
int  size,
int(*)(CORE_ADDR handler,
int *  err 
)
static
struct breakpoint* set_breakpoint_at ( CORE_ADDR  where,
int(*)(CORE_ADDR handler 
)
void set_breakpoint_data ( const unsigned char *  bp_data,
int  bp_len 
)

Definition at line 1592 of file mem-break.c.

References breakpoint_data, and breakpoint_len.

Referenced by initialize_low().

struct fast_tracepoint_jump* set_fast_tracepoint_jump ( CORE_ADDR  where,
unsigned char *  insn,
ULONGEST  length 
)
struct breakpoint* set_gdb_breakpoint ( char  z_type,
CORE_ADDR  addr,
int  size,
int *  err 
)
static struct breakpoint* set_gdb_breakpoint_1 ( char  z_type,
CORE_ADDR  addr,
int  size,
int *  err 
)
static
static struct raw_breakpoint* set_raw_breakpoint_at ( enum raw_bkpt_type  type,
CORE_ADDR  where,
int  size,
int *  err 
)
static
void set_reinsert_breakpoint ( CORE_ADDR  stop_at)

Definition at line 1393 of file mem-break.c.

References reinsert_breakpoint, set_breakpoint_at(), and breakpoint::type.

Referenced by start_step_over().

int software_breakpoint_inserted_here ( CORE_ADDR  addr)
void uninsert_all_breakpoints ( void  )
void uninsert_breakpoints_at ( CORE_ADDR  pc)
void uninsert_fast_tracepoint_jumps_at ( CORE_ADDR  pc)
static void uninsert_raw_breakpoint ( struct raw_breakpoint bp)
static
void validate_breakpoints ( void  )
static int validate_inserted_breakpoint ( struct raw_breakpoint bp)
static
static enum bkpt_type Z_packet_to_bkpt_type ( char  z_type)
static

Definition at line 216 of file mem-break.c.

References gdb_assert, and gdb_breakpoint_Z0.

Referenced by find_gdb_breakpoint(), and set_gdb_breakpoint_1().

enum raw_bkpt_type Z_packet_to_raw_bkpt_type ( char  z_type)
static int z_type_supported ( char  z_type)
static

Definition at line 914 of file mem-break.c.

References target_ops::supports_z_point_type, and the_target.

Referenced by check_gdb_bp_preconditions().

Variable Documentation

const unsigned char* breakpoint_data
int breakpoint_len