7 #define CMP_CNUM_REG(x, y) ((x) >= ((RzDebugChangeReg *)y)->cnum ? 1 : -1)
8 #define CMP_CNUM_MEM(x, y) ((x) >= ((RzDebugChangeMem *)y)->cnum ? 1 : -1)
9 #define CMP_CNUM_CHKPT(x, y) ((x) >= ((RzDebugCheckpoint *)y)->cnum ? 1 : -1)
15 ht_up_free(session->
memory);
74 if (!checkpoint.
snaps) {
105 if (
a &&
b &&
a->bytes &&
b->bytes) {
118 if (index > 0 && index <= vreg->
len) {
149 if (index > 0 && index <= vmem->
len) {
167 if (index > 0 && index <= session->checkpoints->len) {
223 eprintf(
"Error: creating a register vector.\n");
238 eprintf(
"Error: creating a memory vector.\n");
323 pj_ka(j,
"registers");
330 pj_ks(j,
"bytes", ebytes);
342 rz_list_foreach (chkpt->
snaps,
iter, snap) {
353 pj_ks(j,
"data", edata);
460 #define CHECK_TYPE(v, t) \
461 if (!v || v->type != t) \
480 eprintf(
"Error: failed to allocate RzVector vmem.\n");
488 for (child = reg_json->
children.first; child; child = child->
next) {
494 int cnum = baby->
num.s_value;
526 HtUP *registers = user;
529 eprintf(
"Error: failed to allocate RzVector vreg.\n");
537 for (child = reg_json->
children.first; child; child = child->
next) {
543 int cnum = baby->
num.s_value;
562 #define SNAPATTR(ATTR) sdb_fmt("snaps.a[%u]." ATTR, i)
563 #define REGATTR(ATTR) sdb_fmt("registers.%d." ATTR, i)
588 for (child = regs_json->
children.first; child; child = child->
next) {
592 int arena = baby->
num.s_value;
612 checkpoint.
arena[arena] =
a;
622 for (child = snaps_json->
children.first; child; child = child->
next) {
642 eprintf(
"Error: failed to allocate RzDebugSnap snap");
646 snap->
addr = addrj->
num.u_value;
648 snap->
size = sizej->
num.u_value;
650 snap->
perm = permj->
num.s_value;
651 snap->
user = userj->
num.s_value;
687 #define SDB_LOAD(fn, ns) \
689 filename = rz_str_newf("%s%s" fn ".sdb", path, RZ_SYS_DIR); \
690 if (!session_sdb_load_ns(db, ns, filename)) { \
700 SDB_LOAD(
"checkpoints",
"checkpoints");
712 #define DESERIALIZE(ns, func) \
714 subdb = sdb_ns(db, ns, false); \
716 eprintf("Error: missing " ns " namespace\n"); \
RZ_API RzRegArena * rz_reg_arena_new(size_t size)
RZ_API void rz_reg_arena_free(RzRegArena *ra)
RZ_API ut8 * sdb_decode(const char *in, int *len)
RZ_API char * sdb_encode(const ut8 *bin, int len)
static static fork const void static count static fd const char const char static newpath const char static path const char path
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 static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API bool rz_debug_map_sync(RzDebug *dbg)
RZ_API int rz_debug_reg_sync(RzDebug *dbg, int type, int write)
static bool session_sdb_load_ns(Sdb *db, const char *nspath, const char *filename)
static void deserialize_registers(Sdb *db, HtUP *registers)
RZ_API void _restore_registers(RzDebug *dbg, ut32 cnum)
RZ_API void rz_debug_session_free(RzDebugSession *session)
RZ_API bool rz_debug_add_checkpoint(RzDebug *dbg)
static void htup_vector_free(HtUPKv *kv)
static void _set_initial_memory(RzDebug *dbg)
RZ_API RzDebugSession * rz_debug_session_new(void)
RZ_API void rz_debug_session_deserialize(RzDebugSession *session, Sdb *db)
static void _restore_memory(RzDebug *dbg, ut32 cnum)
static bool deserialize_memory_cb(void *user, const char *addr, const char *v)
RZ_API bool rz_debug_session_add_reg_change(RzDebugSession *session, int arena, ut64 offset, ut64 data)
static bool session_sdb_save(Sdb *db, const char *path)
static bool serialize_memory_cb(void *db, const ut64 k, const void *v)
static void serialize_checkpoints(Sdb *db, RzVector *checkpoints)
#define DESERIALIZE(ns, func)
RZ_API void rz_debug_session_restore_reg_mem(RzDebug *dbg, ut32 cnum)
static bool deserialize_checkpoints_cb(void *user, const char *cnum, const char *v)
static void rz_debug_checkpoint_fini(void *element, void *user)
#define CMP_CNUM_MEM(x, y)
RZ_API bool rz_debug_session_save(RzDebugSession *session, const char *path)
static void _set_register(RzDebug *dbg, RzRegItem *ri, ut32 cnum)
static bool serialize_register_cb(void *db, const ut64 k, const void *v)
static void serialize_registers(Sdb *db, HtUP *registers)
#define CMP_CNUM_REG(x, y)
static void deserialize_checkpoints(Sdb *db, RzVector *checkpoints)
RZ_API void rz_debug_session_serialize(RzDebugSession *session, Sdb *db)
static void _set_initial_registers(RzDebug *dbg)
static void serialize_memory(Sdb *db, HtUP *memory)
RZ_API void rz_debug_session_list_memory(RzDebug *dbg)
static void deserialize_memory(Sdb *db, HtUP *memory)
static bool _restore_memory_cb(void *user, const ut64 key, const void *value)
static Sdb * session_sdb_load(const char *path)
#define CMP_CNUM_CHKPT(x, y)
RZ_API bool rz_debug_session_add_mem_change(RzDebugSession *session, ut64 addr, ut8 data)
static bool deserialize_registers_cb(void *user, const char *addr, const char *v)
RZ_API bool rz_debug_session_load(RzDebug *dbg, const char *path)
static RzDebugCheckpoint * _get_checkpoint_before(RzDebugSession *session, ut32 cnum)
size_t map(int syms, int left, int len)
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
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")
#define ls_foreach(list, it, pos)
RZ_API Sdb * sdb_ns_path(Sdb *s, const char *path, int create)
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
RZ_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas)
RZ_API ut64 sdb_num_get(Sdb *s, const char *key, ut32 *cas)
RZ_API RzRegItem * rz_reg_get(RzReg *reg, const char *name, int type)
RZ_API bool rz_reg_set_value(RzReg *reg, RzRegItem *item, ut64 value)
RZ_API ut64 rz_reg_get_value(RzReg *reg, RzRegItem *item)
#define rz_return_val_if_fail(expr, val)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API char * rz_hex_bin2strdup(const ut8 *in, int len)
RZ_API const RzJson * rz_json_get(const RzJson *json, const char *key)
RZ_API RzJson * rz_json_parse(char *text)
RZ_API void rz_json_free(RzJson *js)
void(* RzListFree)(void *ptr)
RZ_API void * rz_mem_copy(void *dest, size_t dmax, const void *src, size_t smax)
RZ_API PJ * pj_ka(PJ *j, const char *k)
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
RZ_API PJ * pj_kN(PJ *j, const char *k, st64 n)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
static void * rz_vector_index_ptr(RzVector *vec, size_t index)
#define rz_vector_upper_bound(vec, x, i, cmp)
RZ_API void * rz_vector_push(RzVector *vec, void *x)
#define rz_vector_foreach(vec, it)
RZ_API void rz_vector_free(RzVector *vec)
RZ_API RzVector * rz_vector_new(size_t elem_size, RzVectorFree free, void *free_user)
RZ_API void sdb_file(Sdb *s, const char *dir)
RZ_API int sdb_set(Sdb *s, const char *key, const char *val, ut32 cas)
RZ_API void sdb_close(Sdb *s)
RZ_API Sdb * sdb_new0(void)
RZ_API bool sdb_free(Sdb *s)
RZ_API void sdb_copy(Sdb *src, Sdb *dst)
RZ_API bool sdb_foreach(Sdb *s, SdbForeachCallback cb, void *user)
RZ_API int sdb_open(Sdb *s, const char *file)
RZ_API bool sdb_sync(Sdb *s)
RZ_API ut64 sdb_atoi(const char *s)
RZ_API RzDebugSnap * rz_debug_snap_map(RzDebug *dbg, RzDebugMap *map)
RZ_API ut8 * rz_debug_snap_get_hash(RzDebug *dbg, RzDebugSnap *snap, RzHashSize *size)
RZ_API void rz_debug_snap_free(RzDebugSnap *snap)
RzRegArena * arena[RZ_REG_TYPE_LAST]
RzDebugCheckpoint * cur_chkpt
struct rz_json_t::@304::@307 children
struct rz_json_t::@304::@306 num
int arena
In which arena is this reg living. Usually equals type.
int offset
Offset into register profile in bits.
RzRegSet regset[RZ_REG_TYPE_LAST]
char * name[RZ_REG_NAME_LAST]
void error(const char *msg)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()