mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 11:43:39 +00:00
Add snap_set command (#7032)
This commit is contained in:
parent
bf5649a2e9
commit
863e3566d2
@ -584,6 +584,7 @@ static int cmd_debug_map_snapshot(RCore *core, const char *input) {
|
||||
"dms*", "", "list snapshots in r2 commands",
|
||||
"dms", " addr", "take snapshot with given id of map at address",
|
||||
"dms", "-id", "delete memory snapshot",
|
||||
"dmsA", " id", "apply memory snapshot",
|
||||
"dmsC", " id comment", "add comment for given snapshot",
|
||||
"dmsd", " id", "hexdiff given snapshot. See `ccc`.",
|
||||
"dmsw", "", "snapshot of the writable maps",
|
||||
@ -658,6 +659,9 @@ static int cmd_debug_map_snapshot(RCore *core, const char *input) {
|
||||
case ' ':
|
||||
r_debug_snap (core->dbg, r_num_math (core->num, input + 1));
|
||||
break;
|
||||
case 'A':
|
||||
r_debug_snap_set (core->dbg, atoi (input + 1));
|
||||
break;
|
||||
case 'C':
|
||||
r_debug_snap_comment (core->dbg, atoi (input + 1), strchr (input, ' '));
|
||||
break;
|
||||
|
@ -78,6 +78,23 @@ R_API RDebugSnap* r_debug_snap_get (RDebug *dbg, ut64 addr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API int r_debug_snap_set (RDebug *dbg, int idx) {
|
||||
RDebugSnap *snap;
|
||||
RListIter *iter;
|
||||
ut32 count = 0;
|
||||
if (!dbg || idx < 0)
|
||||
return 0;
|
||||
r_list_foreach (dbg->snaps, iter, snap) {
|
||||
if (count == idx) {
|
||||
eprintf ("Writing %d bytes to 0x%08"PFMT64x"...\n", snap->size, snap->addr);
|
||||
dbg->iob.write_at (dbg->iob.io, snap->addr, snap->data, snap->size);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int r_debug_snap_map (RDebug *dbg, RDebugMap *map) {
|
||||
RDebugSnap *snap;
|
||||
if (map->size<1) {
|
||||
|
@ -499,6 +499,7 @@ R_API int r_debug_snap(RDebug *dbg, ut64 addr);
|
||||
R_API int r_debug_snap_comment (RDebug *dbg, int idx, const char *msg);
|
||||
R_API int r_debug_snap_all(RDebug *dbg, int perms);
|
||||
R_API RDebugSnap* r_debug_snap_get (RDebug *dbg, ut64 addr);
|
||||
R_API int r_debug_snap_set (RDebug *dbg, int idx);
|
||||
|
||||
/* plugin pointers */
|
||||
extern RDebugPlugin r_debug_plugin_native;
|
||||
|
Loading…
Reference in New Issue
Block a user