Rizin
unix-like reverse engineering framework and cli tools
serialize_debug.c File Reference
#include <rz_debug.h>
#include <rz_bp.h>
#include <rz_util/rz_serialize.h>

Go to the source code of this file.

Macros

#define SUB(ns, call)   RZ_SERIALIZE_SUB_DO(db, subdb, res, ns, call, goto heaven;)
 

Functions

RZ_API void rz_serialize_debug_save (RZ_NONNULL Sdb *db, RZ_NONNULL RzDebug *dbg)
 Serialize debug state (RzDebug) and save to a sdb. More...
 
RZ_API bool rz_serialize_debug_load (RZ_NONNULL Sdb *db, RZ_NONNULL RzDebug *dbg, RZ_NULLABLE RzSerializeResultInfo *res)
 Load a serialized debug state to a RzDebug instance. More...
 

Macro Definition Documentation

◆ SUB

#define SUB (   ns,
  call 
)    RZ_SERIALIZE_SUB_DO(db, subdb, res, ns, call, goto heaven;)

Function Documentation

◆ rz_serialize_debug_load()

RZ_API bool rz_serialize_debug_load ( RZ_NONNULL Sdb db,
RZ_NONNULL RzDebug dbg,
RZ_NULLABLE RzSerializeResultInfo res 
)

Load a serialized debug state to a RzDebug instance.

Parameters
dbsdb storing the serialized debug state
dbgRzDebug instance to load the state into
resRzSerializeResultInfo to store info/errors/warnings
Returns
true if successful, false otherwise

Definition at line 27 of file serialize_debug.c.

27  {
28  rz_return_val_if_fail(db && dbg, false);
29  bool ret = false;
30 #define SUB(ns, call) RZ_SERIALIZE_SUB_DO(db, subdb, res, ns, call, goto heaven;)
31 
32  Sdb *subdb;
33  SUB("breakpoints", rz_serialize_bp_load(subdb, dbg->bp, res));
34 
35  ret = true;
36 heaven:
37  return ret;
38 }
RzDebug * dbg
Definition: desil.c:30
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
RZ_API bool rz_serialize_bp_load(RZ_NONNULL Sdb *db, RZ_NONNULL RzBreakpoint *bp, RZ_NULLABLE RzSerializeResultInfo *res)
Load a serialized breakpoints to a RzBreakpoint instance.
Definition: serialize_bp.c:302
#define SUB(ns, call)
RzBreakpoint * bp
Definition: rz_debug.h:288
Definition: sdb.h:63

References rz_debug_t::bp, dbg, rz_return_val_if_fail, rz_serialize_bp_load(), and SUB.

Referenced by rz_serialize_core_load().

◆ rz_serialize_debug_save()

RZ_API void rz_serialize_debug_save ( RZ_NONNULL Sdb db,
RZ_NONNULL RzDebug dbg 
)

Serialize debug state (RzDebug) and save to a sdb.

Parameters
dbsdb to save the state
dbgRzDebug instance to save

Definition at line 14 of file serialize_debug.c.

14  {
15  rz_return_if_fail(db && dbg);
16  rz_serialize_bp_save(sdb_ns(db, "breakpoints", true), dbg->bp);
17 }
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
Definition: ns.c:186
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
RZ_API void rz_serialize_bp_save(RZ_NONNULL Sdb *db, RZ_NONNULL RzBreakpoint *bp)
serialize and save the breakpoints in a sdb
Definition: serialize_bp.c:13

References rz_debug_t::bp, dbg, rz_return_if_fail, rz_serialize_bp_save(), and sdb_ns().

Referenced by rz_serialize_core_save().