Rizin
unix-like reverse engineering framework and cli tools
desil.c File Reference
#include <rz_debug.h>

Go to the source code of this file.

Classes

struct  EsilBreak
 

Macros

#define EWPS   esil_watchpoints
 
#define ESIL   dbg->analysis->esil
 
#define CURVAL
 

Functions

static int exprmatch (RzDebug *dbg, ut64 addr, const char *expr)
 
static int esilbreak_check_pc (RzDebug *dbg, ut64 pc)
 
static int esilbreak_mem_read (RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
 
static int esilbreak_mem_write (RzAnalysisEsil *esil, ut64 addr, const ut8 *buf, int len)
 
static int esilbreak_reg_read (RzAnalysisEsil *esil, const char *regname, ut64 *num, int *size)
 
static int exprtoken (RzDebug *dbg, char *s, const char *sep, char **o)
 
static int exprmatchreg (RzDebug *dbg, const char *regname, const char *expr)
 
static int esilbreak_reg_write (RzAnalysisEsil *esil, const char *regname, ut64 *num)
 
RZ_API void rz_debug_esil_prestep (RzDebug *d, int p)
 
RZ_API int rz_debug_esil_stepi (RzDebug *d)
 
RZ_API ut64 rz_debug_esil_step (RzDebug *dbg, ut32 count)
 
RZ_API ut64 rz_debug_esil_continue (RzDebug *dbg)
 
static void ewps_free (EsilBreak *ew)
 
RZ_API int rz_debug_esil_watch_empty (RzDebug *dbg)
 
RZ_API void rz_debug_esil_watch (RzDebug *dbg, int rwx, int dev, const char *expr)
 
RZ_API void rz_debug_esil_watch_reset (RzDebug *dbg)
 
RZ_API void rz_debug_esil_watch_list (RzDebug *dbg)
 

Variables

RzDebugdbg = NULL
 
static int has_match = 0
 
static int prestep = 1
 
static ut64 opc = 0
 
RzListesil_watchpoints = NULL
 

Macro Definition Documentation

◆ CURVAL

#define CURVAL
Value:
0){} \
rz_str_trim(s);if (!strcmp(regname,s) && regval
static RzSocket * s
Definition: rtr.c:28
static char * regname(int reg)
Definition: dis.c:71

◆ ESIL

#define ESIL   dbg->analysis->esil

Definition at line 36 of file desil.c.

◆ EWPS

#define EWPS   esil_watchpoints

Definition at line 35 of file desil.c.

Function Documentation

◆ esilbreak_check_pc()

static int esilbreak_check_pc ( RzDebug dbg,
ut64  pc 
)
static

Definition at line 71 of file desil.c.

71  {
72  EsilBreak *ew;
74  if (!pc) {
76  }
77  rz_list_foreach (EWPS, iter, ew) {
78  if (ew->rwx & RZ_PERM_X) {
79  if (exprmatch(dbg, pc, ew->expr)) {
80  return 1;
81  }
82  }
83  }
84  return 0;
85 }
RzDebug * dbg
Definition: desil.c:30
static int exprmatch(RzDebug *dbg, ut64 addr, const char *expr)
Definition: desil.c:38
#define EWPS
Definition: desil.c:35
RZ_API ut64 rz_debug_reg_get(RzDebug *dbg, const char *name)
Definition: dreg.c:99
@ RZ_REG_NAME_PC
Definition: rz_reg.h:43
#define RZ_PERM_X
Definition: rz_types.h:95
int rwx
Definition: desil.c:24
char * expr
Definition: desil.c:26
RzReg * reg
Definition: rz_debug.h:286
char * name[RZ_REG_NAME_LAST]
Definition: rz_reg.h:149

References dbg, EWPS, EsilBreak::expr, exprmatch(), rz_reg_t::name, pc, rz_debug_t::reg, EsilBreak::rwx, rz_debug_reg_get(), RZ_PERM_X, and RZ_REG_NAME_PC.

Referenced by rz_debug_esil_stepi().

◆ esilbreak_mem_read()

static int esilbreak_mem_read ( RzAnalysisEsil esil,
ut64  addr,
ut8 buf,
int  len 
)
static

Definition at line 87 of file desil.c.

87  {
88  EsilBreak *ew;
90  eprintf(Color_GREEN "MEM READ 0x%" PFMT64x "\n" Color_RESET, addr);
91  rz_list_foreach (EWPS, iter, ew) {
92  if (ew->rwx & RZ_PERM_R && ew->dev == 'm') {
93  if (exprmatch(dbg, addr, ew->expr)) {
94  has_match = 1;
95  return 1;
96  }
97  }
98  }
99  return 0; // fallback
100 }
static int has_match
Definition: desil.c:31
#define eprintf(x, y...)
Definition: rlcc.c:7
#define Color_RESET
Definition: rz_cons.h:617
#define Color_GREEN
Definition: rz_cons.h:627
#define RZ_PERM_R
Definition: rz_types.h:93
#define PFMT64x
Definition: rz_types.h:393
int dev
Definition: desil.c:25
static int addr
Definition: z80asm.c:58

References addr, Color_GREEN, Color_RESET, dbg, EsilBreak::dev, eprintf, EWPS, EsilBreak::expr, exprmatch(), has_match, PFMT64x, EsilBreak::rwx, and RZ_PERM_R.

Referenced by rz_debug_esil_stepi().

◆ esilbreak_mem_write()

static int esilbreak_mem_write ( RzAnalysisEsil esil,
ut64  addr,
const ut8 buf,
int  len 
)
static

Definition at line 102 of file desil.c.

102  {
103  EsilBreak *ew;
104  RzListIter *iter;
105  eprintf(Color_RED "MEM WRTE 0x%" PFMT64x "\n" Color_RESET, addr);
106  rz_list_foreach (EWPS, iter, ew) {
107  if (ew->rwx & RZ_PERM_W && ew->dev == 'm') {
108  if (exprmatch(dbg, addr, ew->expr)) {
109  has_match = 1;
110  return 1;
111  }
112  }
113  }
114  return 1; // fallback
115 }
#define Color_RED
Definition: rz_cons.h:623
#define RZ_PERM_W
Definition: rz_types.h:94

References addr, Color_RED, Color_RESET, dbg, EsilBreak::dev, eprintf, EWPS, EsilBreak::expr, exprmatch(), has_match, PFMT64x, EsilBreak::rwx, and RZ_PERM_W.

Referenced by rz_debug_esil_stepi().

◆ esilbreak_reg_read()

static int esilbreak_reg_read ( RzAnalysisEsil esil,
const char *  regname,
ut64 num,
int size 
)
static

Definition at line 117 of file desil.c.

117  {
118  EsilBreak *ew;
119  RzListIter *iter;
120  if (regname[0] >= '0' && regname[0] <= '9') {
121  // eprintf (Color_CYAN"IMM READ %s\n"Color_RESET, regname);
122  return 0;
123  }
124  eprintf(Color_YELLOW "REG READ %s\n" Color_RESET, regname);
125  rz_list_foreach (EWPS, iter, ew) {
126  if (ew->rwx & RZ_PERM_R && ew->dev == 'r') {
127  // XXX: support array of regs in expr
128  if (!strcmp(regname, ew->expr)) {
129  has_match = 1;
130  return 1;
131  }
132  }
133  }
134  return 0; // fallback
135 }
#define Color_YELLOW
Definition: rz_cons.h:631

References Color_RESET, Color_YELLOW, EsilBreak::dev, eprintf, EWPS, EsilBreak::expr, has_match, regname(), EsilBreak::rwx, and RZ_PERM_R.

Referenced by rz_debug_esil_stepi().

◆ esilbreak_reg_write()

static int esilbreak_reg_write ( RzAnalysisEsil esil,
const char *  regname,
ut64 num 
)
static

Definition at line 193 of file desil.c.

193  {
194  EsilBreak *ew;
195  RzListIter *iter;
196  if (regname[0] >= '0' && regname[0] <= '9') {
197  // this should never happen
198  // eprintf (Color_BLUE"IMM WRTE %s\n"Color_RESET, regname);
199  return 0;
200  }
201  eprintf(Color_MAGENTA "REG WRTE %s 0x%" PFMT64x "\n" Color_RESET, regname, *num);
202  rz_list_foreach (EWPS, iter, ew) {
203  if ((ew->rwx & RZ_PERM_W) && (ew->dev == 'r')) {
204  // XXX: support array of regs in expr
205  if (exprmatchreg(dbg, regname, ew->expr)) {
206  has_match = 1;
207  return 1;
208  }
209  }
210  }
211  return 1; // fallback
212 }
static int exprmatchreg(RzDebug *dbg, const char *regname, const char *expr)
Definition: desil.c:149
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
#define Color_MAGENTA
Definition: rz_cons.h:629

References Color_MAGENTA, Color_RESET, dbg, EsilBreak::dev, eprintf, EWPS, EsilBreak::expr, exprmatchreg(), has_match, num, PFMT64x, regname(), EsilBreak::rwx, and RZ_PERM_W.

Referenced by rz_debug_esil_stepi().

◆ ewps_free()

static void ewps_free ( EsilBreak ew)
static

Definition at line 308 of file desil.c.

308  {
309  RZ_FREE(ew->expr);
310  free(ew);
311 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
#define RZ_FREE(x)
Definition: rz_types.h:369

References EsilBreak::expr, free(), and RZ_FREE.

Referenced by rz_debug_esil_watch().

◆ exprmatch()

static int exprmatch ( RzDebug dbg,
ut64  addr,
const char *  expr 
)
static

Definition at line 38 of file desil.c.

38  {
39  char *e = strdup(expr);
40  if (!e) {
41  return 0;
42  }
43  char *p = strstr(e, "..");
44  ut64 a, b;
45  int ret = 0;
46  if (p) {
47  *p = 0;
48  p += 2;
49  a = rz_num_math(dbg->num, e);
50  b = rz_num_math(dbg->num, p);
51  if (a < b) {
52  if (addr >= a && addr <= b) {
53  ret = 1;
54  }
55  } else {
56  if (addr >= b && addr <= a) {
57  ret = 1;
58  }
59  }
60  } else {
61  a = rz_num_math(dbg->num, e);
62  if (addr == a) {
63  ret = 1;
64  }
65  }
66  has_match = ret;
67  free(e);
68  return ret;
69 }
#define e(frag)
static RzNumCalcValue expr(RzNum *, RzNumCalc *, int)
Definition: calc.c:167
void * p
Definition: libc.cpp:67
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
RzNum * num
Definition: rz_debug.h:317
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

References a, addr, b, dbg, e, expr(), free(), has_match, rz_debug_t::num, p, rz_num_math(), strdup(), and ut64().

Referenced by esilbreak_check_pc(), esilbreak_mem_read(), esilbreak_mem_write(), and exprmatchreg().

◆ exprmatchreg()

static int exprmatchreg ( RzDebug dbg,
const char *  regname,
const char *  expr 
)
static

Definition at line 149 of file desil.c.

149  {
150  int ret = 0;
151  char *p;
152  char *s = strdup(expr);
153  if (!s) {
154  return 0;
155  }
156  if (!strcmp(regname, s)) {
157  ret = 1;
158  } else {
159 #define CURVAL 0){} \
160  rz_str_trim(s);if (!strcmp(regname,s) && regval
161  ut64 regval = rz_debug_reg_get(dbg, regname);
162  if (exprtoken(dbg, s, ">=", &p)) {
163  if (CURVAL >= rz_num_math(dbg->num, p))
164  ret = 1;
165  } else if (exprtoken(dbg, s, "<=", &p)) {
166  if (CURVAL <= rz_num_math(dbg->num, p))
167  ret = 1;
168  } else if (exprtoken(dbg, s, "==", &p)) {
169  if (CURVAL <= rz_num_math(dbg->num, p))
170  ret = 1;
171  } else if (exprtoken(dbg, s, "<", &p)) {
172  if (CURVAL < rz_num_math(dbg->num, p))
173  ret = 1;
174  } else if (exprtoken(dbg, s, ">", &p)) {
175  if (CURVAL > rz_num_math(dbg->num, p))
176  ret = 1;
177  } else if (exprtoken(dbg, s, " ", &p)) {
178  rz_str_trim(s);
179  if (!strcmp(regname, s)) {
180  ut64 num = rz_num_math(dbg->num, p);
181  ret = exprmatch(dbg, num, s);
182  }
183  } else {
184  if (!strcmp(regname, s)) {
185  ret = 1;
186  }
187  }
188  }
189  free(s);
190  return ret;
191 }
#define CURVAL
static int exprtoken(RzDebug *dbg, char *s, const char *sep, char **o)
Definition: desil.c:137
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
Definition: str_trim.c:190

References CURVAL, dbg, expr(), exprmatch(), exprtoken(), free(), rz_debug_t::num, num, p, regname(), rz_debug_reg_get(), rz_num_math(), rz_str_trim(), s, strdup(), and ut64().

Referenced by esilbreak_reg_write().

◆ exprtoken()

static int exprtoken ( RzDebug dbg,
char *  s,
const char *  sep,
char **  o 
)
static

Definition at line 137 of file desil.c.

137  {
138  char *p = strstr(s, sep);
139  if (p) {
140  *p = 0;
141  p += strlen(sep);
142  *o = p;
143  return 1;
144  }
145  *o = NULL;
146  return 0;
147 }
#define NULL
Definition: cris-opc.c:27

References NULL, p, and s.

Referenced by exprmatchreg().

◆ rz_debug_esil_continue()

RZ_API ut64 rz_debug_esil_continue ( RzDebug dbg)

Definition at line 304 of file desil.c.

304  {
306 }
RZ_API ut64 rz_debug_esil_step(RzDebug *dbg, ut32 count)
Definition: desil.c:280
#define UT32_MAX
Definition: rz_types_base.h:99

References dbg, rz_debug_esil_step(), and UT32_MAX.

Referenced by rz_core_debug_esil().

◆ rz_debug_esil_prestep()

RZ_API void rz_debug_esil_prestep ( RzDebug d,
int  p 
)

Definition at line 214 of file desil.c.

214  {
215  prestep = p;
216 }
static int prestep
Definition: desil.c:32

References p, and prestep.

Referenced by rz_core_debug_esil().

◆ rz_debug_esil_step()

RZ_API ut64 rz_debug_esil_step ( RzDebug dbg,
ut32  count 
)

Definition at line 280 of file desil.c.

280  {
281  count++;
282  has_match = 0;
284  do {
285  if (rz_cons_is_breaked()) {
286  break;
287  }
288  if (has_match) {
289  eprintf("EsilBreak match at 0x%08" PFMT64x "\n", opc);
290  break;
291  }
292  if (count > 0) {
293  count--;
294  if (!count) {
295  // eprintf ("Limit reached\n");
296  break;
297  }
298  }
299  } while (rz_debug_esil_stepi(dbg));
301  return opc;
302 }
RZ_API void rz_cons_break_pop(void)
Definition: cons.c:361
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
Definition: cons.c:357
RZ_API bool rz_cons_is_breaked(void)
Definition: cons.c:373
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
static ut64 opc
Definition: desil.c:33
RZ_API int rz_debug_esil_stepi(RzDebug *d)
Definition: desil.c:218

References count, dbg, eprintf, has_match, NULL, opc, PFMT64x, rz_cons_break_pop(), rz_cons_break_push(), rz_cons_is_breaked(), and rz_debug_esil_stepi().

Referenced by rz_core_debug_esil(), and rz_debug_esil_continue().

◆ rz_debug_esil_stepi()

RZ_API int rz_debug_esil_stepi ( RzDebug d)

Definition at line 218 of file desil.c.

218  {
220  ut8 obuf[64];
221  int ret = 1;
222  dbg = d;
223  if (!ESIL) {
224  ESIL = rz_analysis_esil_new(32, true, 64);
225  // TODO setup something?
226  if (!ESIL) {
227  return 0;
228  }
229  }
230 
233  dbg->iob.read_at(dbg->iob.io, opc, obuf, sizeof(obuf));
234 
235  // dbg->iob.read_at (dbg->iob.io, npc, buf, sizeof (buf));
236 
237  // dbg->analysis->reg = dbg->reg; // hack
238  ESIL->cb.hook_mem_read = &esilbreak_mem_read;
239  ESIL->cb.hook_mem_write = &esilbreak_mem_write;
240  ESIL->cb.hook_reg_read = &esilbreak_reg_read;
241  ESIL->cb.hook_reg_write = &esilbreak_reg_write;
242 
243  if (prestep) {
244  // required when a exxpression is like <= == ..
245  // otherwise it will stop at the next instruction
246  if (rz_debug_step(dbg, 1) < 1) {
247  eprintf("Step failed\n");
248  return 0;
249  }
251  // npc = rz_debug_reg_get (dbg, dbg->reg->name[RZ_REG_NAME_PC]);
252  }
253 
255  if (esilbreak_check_pc(dbg, opc)) {
256  eprintf("STOP AT 0x%08" PFMT64x "\n", opc);
257  ret = 0;
258  } else {
260  eprintf("0x%08" PFMT64x " %s\n", opc, RZ_STRBUF_SAFEGET(&op.esil));
262  // rz_analysis_esil_dumpstack (ESIL);
264  ret = 1;
265  }
266  }
267  if (!prestep) {
268  if (ret && !has_match) {
269  if (rz_debug_step(dbg, 1) < 1) {
270  eprintf("Step failed\n");
271  return 0;
272  }
274  // npc = rz_debug_reg_get (dbg, dbg->reg->name[RZ_REG_NAME_PC]);
275  }
276  }
277  return ret;
278 }
ut8 op
Definition: 6502dis.c:13
static int esilbreak_mem_write(RzAnalysisEsil *esil, ut64 addr, const ut8 *buf, int len)
Definition: desil.c:102
static int esilbreak_reg_write(RzAnalysisEsil *esil, const char *regname, ut64 *num)
Definition: desil.c:193
static int esilbreak_mem_read(RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
Definition: desil.c:87
static int esilbreak_reg_read(RzAnalysisEsil *esil, const char *regname, ut64 *num, int *size)
Definition: desil.c:117
#define ESIL
Definition: desil.c:36
static int esilbreak_check_pc(RzDebug *dbg, ut64 pc)
Definition: desil.c:71
RZ_API int rz_debug_reg_sync(RzDebug *dbg, int type, int write)
Definition: dreg.c:9
RZ_API void rz_analysis_esil_stack_free(RzAnalysisEsil *esil)
Definition: esil.c:3103
RZ_API RzAnalysisEsil * rz_analysis_esil_new(int stacksize, int iotrap, unsigned int addrsize)
Definition: esil.c:85
RZ_API bool rz_analysis_esil_set_pc(RzAnalysisEsil *esil, ut64 addr)
Definition: esil.c:155
RZ_API bool rz_analysis_esil_parse(RzAnalysisEsil *esil, const char *str)
Definition: esil.c:2998
uint8_t ut8
Definition: lh5801.h:11
RZ_API int rz_debug_step(RzDebug *dbg, int steps)
Definition: debug.c:962
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
Definition: op.c:96
@ RZ_ANALYSIS_OP_MASK_ESIL
Definition: rz_analysis.h:441
@ RZ_REG_TYPE_GPR
Definition: rz_reg.h:21
#define RZ_STRBUF_SAFEGET(sb)
Definition: rz_strbuf.h:18
#define d(i)
Definition: sha256.c:44
RzAnalysis * analysis
Definition: rz_debug.h:305
RzIOBind iob
Definition: rz_debug.h:293
RzIOReadAt read_at
Definition: rz_io.h:240
RzIO * io
Definition: rz_io.h:232
Definition: dis.c:32
static unsigned char * obuf
Definition: z80asm.c:36

References rz_debug_t::analysis, d, dbg, eprintf, ESIL, esilbreak_check_pc(), esilbreak_mem_read(), esilbreak_mem_write(), esilbreak_reg_read(), esilbreak_reg_write(), has_match, rz_io_bind_t::io, rz_debug_t::iob, rz_reg_t::name, obuf, op, opc, PFMT64x, prestep, rz_io_bind_t::read_at, rz_debug_t::reg, rz_analysis_esil_new(), rz_analysis_esil_parse(), rz_analysis_esil_set_pc(), rz_analysis_esil_stack_free(), rz_analysis_op(), RZ_ANALYSIS_OP_MASK_ESIL, rz_debug_reg_get(), rz_debug_reg_sync(), rz_debug_step(), RZ_REG_NAME_PC, RZ_REG_TYPE_GPR, and RZ_STRBUF_SAFEGET.

Referenced by rz_debug_esil_step().

◆ rz_debug_esil_watch()

RZ_API void rz_debug_esil_watch ( RzDebug dbg,
int  rwx,
int  dev,
const char *  expr 
)

Definition at line 317 of file desil.c.

317  {
318  if (!EWPS) {
319  EWPS = rz_list_new();
320  if (!EWPS) {
321  return;
322  }
323  EWPS->free = (RzListFree)ewps_free;
324  }
325  EsilBreak *ew = RZ_NEW0(EsilBreak);
326  if (!ew) {
327  RZ_FREE(EWPS);
328  return;
329  }
330  ew->rwx = rwx;
331  ew->dev = dev;
332  ew->expr = strdup(expr);
333  rz_list_append(EWPS, ew);
334 }
static void ewps_free(EsilBreak *ew)
Definition: desil.c:308
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask dev
Definition: sflib.h:88
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
#define RZ_NEW0(x)
Definition: rz_types.h:284

References EsilBreak::dev, dev, EWPS, ewps_free(), EsilBreak::expr, expr(), EsilBreak::rwx, RZ_FREE, rz_list_append(), rz_list_new(), RZ_NEW0, and strdup().

Referenced by rz_core_debug_esil().

◆ rz_debug_esil_watch_empty()

RZ_API int rz_debug_esil_watch_empty ( RzDebug dbg)

Definition at line 313 of file desil.c.

313  {
314  return rz_list_empty(EWPS);
315 }

References EWPS.

Referenced by rz_core_debug_esil().

◆ rz_debug_esil_watch_list()

RZ_API void rz_debug_esil_watch_list ( RzDebug dbg)

Definition at line 341 of file desil.c.

341  {
342  EsilBreak *ew;
343  RzListIter *iter;
344  rz_list_foreach (EWPS, iter, ew) {
345  dbg->cb_printf("de %s %c %s\n", rz_str_rwx_i(ew->rwx), ew->dev, ew->expr);
346  }
347 }
RZ_API const char * rz_str_rwx_i(int rwx)
Definition: str.c:332
PrintfCallback cb_printf
Definition: rz_debug.h:292

References rz_debug_t::cb_printf, dbg, EsilBreak::dev, EWPS, EsilBreak::expr, EsilBreak::rwx, and rz_str_rwx_i().

Referenced by rz_core_debug_esil().

◆ rz_debug_esil_watch_reset()

RZ_API void rz_debug_esil_watch_reset ( RzDebug dbg)

Definition at line 336 of file desil.c.

336  {
338  EWPS = NULL;
339 }
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137

References EWPS, NULL, and rz_list_free().

Referenced by rz_core_debug_esil().

Variable Documentation

◆ dbg

RzDebug* dbg = NULL

Definition at line 30 of file desil.c.

Referenced by __esil_attach(), __esil_init(), __esil_reg_profile(), __esil_step(), __io_continue(), __io_kill(), __io_maps(), __io_reg_profile(), __io_step(), __io_step_over(), __rap_attach(), __rap_continue(), __rap_reg_profile(), __rap_reg_read(), __rap_step(), __read(), __reg_read(), _restore_memory(), _restore_memory_cb(), _restore_registers(), _set_initial_memory(), _set_initial_registers(), _set_register(), add_thread(), backtrace_fuzzy(), backtrace_generic(), backtrace_windows(), backtrace_windows_x64(), backtrace_x86_32(), backtrace_x86_32_analysis(), backtrace_x86_64(), backtrace_x86_64_analysis(), break_debugger(), bsd_generate_corefile(), bsd_handle_signals(), bsd_info(), bsd_native_sysctl_map(), bsd_reg_write(), check_connection(), cur_dbg_plugin_is_windbg(), DecodeHeapEntry(), DecodeLFHEntry(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_debug_trace_calls(), drx_add(), drx_del(), esilbreak_check_pc(), esilbreak_mem_read(), esilbreak_mem_write(), esilbreak_reg_write(), exprmatch(), exprmatchreg(), find_thread(), get_current_process_and_thread(), get_dispatchmessage_offset(), get_pid_thread_list(), get_thread_handle_from_tid(), get_windows(), GetHeapBlocks(), GetHeapGlobalsOffset(), GetLFHKey(), GetListOfHeaps(), GetSingleBlock(), GetSingleSegmentBlock(), handle_dead_notify(), handle_exception_message(), InitHeapInfo(), is_io_bf(), is_thread_alive(), is_x86_call(), is_x86_ret(), isBochs(), iscallret(), linux_add_new_thread(), linux_attach(), linux_attach_new_process(), linux_attach_single_pid(), linux_dbg_wait(), linux_dbg_wait_break(), linux_dbg_wait_break_main(), linux_detach_all(), linux_handle_new_task(), linux_handle_signals(), linux_info(), linux_reg_profile(), linux_reg_read(), linux_reg_write(), linux_remove_fork_bps(), linux_remove_thread(), linux_select(), linux_set_options(), linux_step(), linux_stop_thread(), linux_stop_threads(), linux_thread_list(), prepend_current_pc(), print_debug_map_line(), print_debug_maps_ascii_art(), print_windows(), read_ptr(), read_register(), rz_core_cmd_foreach3(), rz_core_debug_map_print(), rz_core_debug_plugin_print(), rz_core_debug_plugins_print(), rz_core_debug_process_close(), rz_core_static_debug_stop(), rz_debug_add_checkpoint(), rz_debug_attach(), rz_debug_bf_attach(), rz_debug_bf_continue(), rz_debug_bf_continue_syscall(), rz_debug_bf_kill(), rz_debug_bf_reg_read(), rz_debug_bf_reg_write(), rz_debug_bf_step(), rz_debug_bf_step_over(), rz_debug_bf_stop(), rz_debug_bochs_attach(), rz_debug_bochs_map_get(), rz_debug_bochs_reg_profile(), rz_debug_bochs_reg_read(), rz_debug_bochs_step(), rz_debug_bochs_wait(), rz_debug_bp_add(), rz_debug_bp_hit(), rz_debug_bp_rebase(), rz_debug_bp_update(), rz_debug_bps_enable(), rz_debug_can_kill(), rz_debug_continue(), rz_debug_continue_back(), rz_debug_continue_kill(), rz_debug_continue_pass_exception(), rz_debug_continue_syscall(), rz_debug_continue_syscalls(), rz_debug_continue_until(), rz_debug_continue_until_internal(), rz_debug_continue_until_nonblock(), rz_debug_continue_until_optype(), rz_debug_desc_close(), rz_debug_desc_dup(), rz_debug_desc_list(), rz_debug_desc_open(), rz_debug_desc_read(), rz_debug_desc_seek(), rz_debug_desc_write(), rz_debug_detach(), rz_debug_dmp_attach(), rz_debug_dmp_frames(), rz_debug_dmp_init(), rz_debug_dmp_maps(), rz_debug_dmp_modules(), rz_debug_dmp_pids(), rz_debug_dmp_reg_profile(), rz_debug_dmp_reg_read(), rz_debug_dmp_select(), rz_debug_dmp_threads(), rz_debug_drx_at(), rz_debug_drx_list(), rz_debug_drx_set(), rz_debug_drx_unset(), rz_debug_esil_continue(), rz_debug_esil_step(), rz_debug_esil_stepi(), rz_debug_esil_watch_list(), rz_debug_execute(), rz_debug_frames(), rz_debug_free(), rz_debug_gdb_attach(), rz_debug_gdb_breakpoint(), rz_debug_gdb_continue(), rz_debug_gdb_detach(), rz_debug_gdb_frames(), rz_debug_gdb_info(), rz_debug_gdb_kill(), rz_debug_gdb_map_get(), rz_debug_gdb_modules_get(), rz_debug_gdb_pids(), rz_debug_gdb_reg_profile(), rz_debug_gdb_reg_read(), rz_debug_gdb_reg_write(), rz_debug_gdb_select(), rz_debug_gdb_set_reg_profile(), rz_debug_gdb_step(), rz_debug_gdb_threads(), rz_debug_gdb_wait(), rz_debug_get_baddr(), rz_debug_goto_cnum(), rz_debug_info(), rz_debug_is_dead(), rz_debug_kill(), rz_debug_kill_list(), rz_debug_kill_setup(), rz_debug_map_alloc(), rz_debug_map_dealloc(), rz_debug_map_get(), rz_debug_map_list(), rz_debug_map_list_visual(), rz_debug_map_protect(), rz_debug_map_sync(), rz_debug_modules_list(), rz_debug_native_frames(), rz_debug_native_map_get(), rz_debug_new(), rz_debug_num_callback(), rz_debug_pid_list(), rz_debug_pids(), rz_debug_plugin_add(), rz_debug_plugin_init(), rz_debug_plugin_set_reg_profile(), rz_debug_qnx_attach(), rz_debug_qnx_reg_profile(), rz_debug_qnx_reg_read(), rz_debug_qnx_reg_write(), rz_debug_qnx_wait(), rz_debug_recoil(), rz_debug_reg_get(), rz_debug_reg_profile_sync(), rz_debug_reg_set(), rz_debug_reg_sync(), rz_debug_select(), rz_debug_session_list_memory(), rz_debug_session_load(), rz_debug_session_restore_reg_mem(), rz_debug_set_arch(), rz_debug_signal_list(), rz_debug_signal_send(), rz_debug_snap_get_hash(), rz_debug_snap_is_equal(), rz_debug_snap_map(), rz_debug_step(), rz_debug_step_back(), rz_debug_step_cnum(), rz_debug_step_hard(), rz_debug_step_over(), rz_debug_step_soft(), rz_debug_stop(), rz_debug_stop_reason(), rz_debug_syscall(), rz_debug_thread_list(), rz_debug_trace_add(), rz_debug_trace_at(), rz_debug_trace_get(), rz_debug_trace_ins_after(), rz_debug_trace_ins_before(), rz_debug_trace_is_traceable(), rz_debug_trace_op(), rz_debug_trace_pc(), rz_debug_trace_print(), rz_debug_trace_reset(), rz_debug_trace_tag(), rz_debug_tracenodes_reset(), rz_debug_traces_ascii(), rz_debug_traces_info(), rz_debug_use(), rz_debug_wait(), rz_debug_winkd_attach(), rz_debug_winkd_frames(), rz_debug_winkd_reg_profile(), rz_debug_winkd_reg_write(), rz_debug_winkd_wait(), rz_serialize_debug_load(), rz_serialize_debug_save(), rz_w32_add_winmsg_breakpoint(), rz_w32_dbg_maps(), rz_w32_dbg_modules(), rz_w32_print_windows(), rz_xnu_get_cur_thread(), rz_xnu_get_thread(), rz_xnu_thread_get_drx(), rz_xnu_thread_get_gpr(), rz_xnu_thread_set_drx(), rz_xnu_thread_set_gpr(), rz_xnu_update_thread_list(), show_syscall(), siglistcb(), unwind_function(), validate_mach_message(), w32_attach(), w32_attach_new_process(), w32_break_process(), w32_continue(), w32_dbg_wait(), w32_detach(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), w32_info(), w32_info_exe(), w32_info_user(), w32_init(), w32_kill(), w32_map_alloc(), w32_map_dealloc(), w32_map_protect(), w32_pid_list(), w32_reg_read(), w32_reg_write(), w32_select(), w32_thread_list(), windbg_attach(), windbg_breakpoint(), windbg_continue(), windbg_detach(), windbg_frames(), windbg_gcore(), windbg_info(), windbg_init(), windbg_kill(), windbg_map_get(), windbg_modules_get(), windbg_pids(), windbg_reg_profile(), windbg_reg_read(), windbg_reg_write(), windbg_select(), windbg_step(), windbg_step_over(), windbg_stop(), windbg_threads(), windbg_wait(), xnu_attach(), xnu_clear_trace_bit(), xnu_continue(), xnu_create_exception_thread(), xnu_dbg_maps(), xnu_dbg_modules(), xnu_detach(), xnu_fill_info_thread(), xnu_generate_corefile(), xnu_get_thread_with_info(), xnu_info(), xnu_map_alloc(), xnu_map_dealloc(), xnu_map_protect(), xnu_reg_profile(), xnu_reg_read(), xnu_reg_write(), xnu_set_trace_bit(), xnu_step(), xnu_thread_list(), xnu_update_thread_info(), xnu_wait(), and xnu_wait_for_exception().

◆ esil_watchpoints

RzList* esil_watchpoints = NULL

Definition at line 34 of file desil.c.

◆ has_match

◆ opc

◆ prestep

int prestep = 1
static

Definition at line 32 of file desil.c.

Referenced by rz_debug_esil_prestep(), and rz_debug_esil_stepi().