GDBserver
Classes | Macros | Enumerations | Functions | Variables
ax.c File Reference
#include "server.h"
#include "ax.h"
#include "format.h"
#include "tracepoint.h"
#include "rsp-low.h"
#include "ax.def"

Go to the source code of this file.

Classes

struct  bytecode_address
 

Macros

#define ax_debug_1(level, fmt, args...)
 
#define ax_debug(FMT, args...)   ax_debug_1 (1, FMT, ##args)
 
#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)   gdb_agent_op_ ## NAME = VALUE,
 
#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)   , # NAME
 
#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)   , SIZE
 
#define UNHANDLED
 
#define STACK_MAX   100
 

Enumerations

enum  gdb_agent_op { gdb_agent_op_last }
 

Functions

static void ax_vdebug (const char *,...)
 
static const char * gdb_agent_op_name (int op)
 
struct agent_exprgdb_parse_agent_expr (char **actparm)
 
void gdb_free_agent_expr (struct agent_expr *aexpr)
 
char * gdb_unparse_agent_expr (struct agent_expr *aexpr)
 
void emit_prologue (void)
 
void emit_epilogue (void)
 
static void emit_add (void)
 
static void emit_sub (void)
 
static void emit_mul (void)
 
static void emit_lsh (void)
 
static void emit_rsh_signed (void)
 
static void emit_rsh_unsigned (void)
 
static void emit_ext (int arg)
 
static void emit_log_not (void)
 
static void emit_bit_and (void)
 
static void emit_bit_or (void)
 
static void emit_bit_xor (void)
 
static void emit_bit_not (void)
 
static void emit_equal (void)
 
static void emit_less_signed (void)
 
static void emit_less_unsigned (void)
 
static void emit_ref (int size)
 
static void emit_if_goto (int *offset_p, int *size_p)
 
static void emit_goto (int *offset_p, int *size_p)
 
static void write_goto_address (CORE_ADDR from, CORE_ADDR to, int size)
 
static void emit_const (LONGEST num)
 
static void emit_reg (int reg)
 
static void emit_pop (void)
 
static void emit_stack_flush (void)
 
static void emit_zero_ext (int arg)
 
static void emit_swap (void)
 
static void emit_stack_adjust (int n)
 
static void emit_int_call_1 (CORE_ADDR fn, int arg1)
 
static void emit_void_call_2 (CORE_ADDR fn, int arg1)
 
static void emit_eq_goto (int *offset_p, int *size_p)
 
static void emit_ne_goto (int *offset_p, int *size_p)
 
static void emit_lt_goto (int *offset_p, int *size_p)
 
static void emit_ge_goto (int *offset_p, int *size_p)
 
static void emit_gt_goto (int *offset_p, int *size_p)
 
static void emit_le_goto (int *offset_p, int *size_p)
 
int is_goto_target (struct agent_expr *aexpr, int pc)
 
enum eval_result_type compile_bytecodes (struct agent_expr *aexpr)
 
static void ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format, int nargs, ULONGEST *args)
 
enum eval_result_type gdb_eval_agent_expr (struct eval_agent_expr_context *ctx, struct agent_expr *aexpr, ULONGEST *rslt)
 

Variables

static const char * gdb_agent_op_names [gdb_agent_op_last]
 
static const unsigned char gdb_agent_op_sizes [gdb_agent_op_last]
 
CORE_ADDR current_insn_ptr
 
int emit_error
 
struct bytecode_addressbytecode_address_table
 

Macro Definition Documentation

#define ax_debug (   FMT,
  args... 
)    ax_debug_1 (1, FMT, ##args)

Definition at line 49 of file ax.c.

Referenced by ax_printf(), compile_bytecodes(), and gdb_eval_agent_expr().

#define ax_debug_1 (   level,
  fmt,
  args... 
)
Value:
do { \
if (level <= debug_threads) \
ax_vdebug ((fmt), ##args); \
} while (0)
int debug_threads
Definition: debug.c:24

Definition at line 43 of file ax.c.

#define DEFOP (   NAME,
  SIZE,
  DATA_SIZE,
  CONSUMED,
  PRODUCED,
  VALUE 
)    gdb_agent_op_ ## NAME = VALUE,

Definition at line 57 of file ax.c.

#define DEFOP (   NAME,
  SIZE,
  DATA_SIZE,
  CONSUMED,
  PRODUCED,
  VALUE 
)    , # NAME

Definition at line 57 of file ax.c.

#define DEFOP (   NAME,
  SIZE,
  DATA_SIZE,
  CONSUMED,
  PRODUCED,
  VALUE 
)    , SIZE

Definition at line 57 of file ax.c.

#define STACK_MAX   100

Referenced by gdb_eval_agent_expr().

#define UNHANDLED
Value:
do \
{ \
ax_debug ("Cannot compile op 0x%x\n", op); \
} while (0)

Referenced by compile_bytecodes().

Enumeration Type Documentation

Enumerator
gdb_agent_op_last 

Definition at line 55 of file ax.c.

Function Documentation

static void ax_printf ( CORE_ADDR  fn,
CORE_ADDR  chan,
const char *  format,
int  nargs,
ULONGEST args 
)
static
static void ax_vdebug ( const char *  ,
  ... 
)
static

Definition at line 25 of file ax.c.

References PROG.

enum eval_result_type compile_bytecodes ( struct agent_expr aexpr)
static void emit_add ( void  )
static

Definition at line 166 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_bit_and ( void  )
static

Definition at line 214 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_bit_not ( void  )
static

Definition at line 232 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_bit_or ( void  )
static

Definition at line 220 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_bit_xor ( void  )
static

Definition at line 226 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_const ( LONGEST  num)
static

Definition at line 280 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

void emit_epilogue ( void  )

Definition at line 160 of file ax.c.

References target_emit_ops.

Referenced by compile_tracepoint_condition().

static void emit_eq_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 338 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_equal ( void  )
static

Definition at line 238 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_ext ( int  arg)
static

Definition at line 202 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_ge_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 356 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 268 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_gt_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 362 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_if_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 262 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_int_call_1 ( CORE_ADDR  fn,
int  arg1 
)
static

Definition at line 324 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_le_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 368 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_less_signed ( void  )
static

Definition at line 244 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_less_unsigned ( void  )
static

Definition at line 250 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_log_not ( void  )
static

Definition at line 208 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_lsh ( void  )
static

Definition at line 184 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_lt_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 350 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_mul ( void  )
static

Definition at line 178 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_ne_goto ( int *  offset_p,
int *  size_p 
)
static

Definition at line 344 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_pop ( void  )
static

Definition at line 292 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

void emit_prologue ( void  )

Definition at line 154 of file ax.c.

References target_emit_ops.

Referenced by compile_tracepoint_condition().

static void emit_ref ( int  size)
static

Definition at line 256 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_reg ( int  reg)
static

Definition at line 286 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_rsh_signed ( void  )
static

Definition at line 190 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_rsh_unsigned ( void  )
static

Definition at line 196 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_stack_adjust ( int  n)
static

Definition at line 316 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_stack_flush ( void  )
static

Definition at line 298 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_sub ( void  )
static

Definition at line 172 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_swap ( void  )
static

Definition at line 310 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_void_call_2 ( CORE_ADDR  fn,
int  arg1 
)
static

Definition at line 332 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static void emit_zero_ext ( int  arg)
static

Definition at line 304 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

static const char* gdb_agent_op_name ( int  op)
static

Definition at line 83 of file ax.c.

References gdb_agent_op_last.

Referenced by compile_bytecodes(), and gdb_eval_agent_expr().

enum eval_result_type gdb_eval_agent_expr ( struct eval_agent_expr_context ctx,
struct agent_expr aexpr,
ULONGEST rslt 
)
void gdb_free_agent_expr ( struct agent_expr aexpr)

Definition at line 114 of file ax.c.

References agent_expr::bytes.

Referenced by clear_breakpoint_commands(), and clear_breakpoint_conditions().

struct agent_expr* gdb_parse_agent_expr ( char **  actparm)
char* gdb_unparse_agent_expr ( struct agent_expr aexpr)

Definition at line 128 of file ax.c.

References bin2hex(), agent_expr::bytes, agent_expr::length, and xmalloc().

Referenced by response_tracepoint().

int is_goto_target ( struct agent_expr aexpr,
int  pc 
)

Definition at line 377 of file ax.c.

References agent_expr::bytes, and agent_expr::length.

Referenced by compile_bytecodes().

static void write_goto_address ( CORE_ADDR  from,
CORE_ADDR  to,
int  size 
)
static

Definition at line 274 of file ax.c.

References target_emit_ops.

Referenced by compile_bytecodes().

Variable Documentation

struct bytecode_address * bytecode_address_table

Referenced by compile_bytecodes().

CORE_ADDR current_insn_ptr
int emit_error
const char* gdb_agent_op_names[gdb_agent_op_last]
static

Definition at line 64 of file ax.c.

const unsigned char gdb_agent_op_sizes[gdb_agent_op_last]
static

Definition at line 72 of file ax.c.