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

Go to the source code of this file.

Functions

RZ_API RzDebugMaprz_debug_map_new (char *name, ut64 addr, ut64 addr_end, int perm, int user)
 
RZ_API RzListrz_debug_modules_list (RzDebug *dbg)
 
RZ_API bool rz_debug_map_sync (RzDebug *dbg)
 
RZ_API RzDebugMaprz_debug_map_alloc (RzDebug *dbg, ut64 addr, int size, bool thp)
 
RZ_API int rz_debug_map_dealloc (RzDebug *dbg, RzDebugMap *map)
 
RZ_API RzDebugMaprz_debug_map_get (RzDebug *dbg, ut64 addr)
 
RZ_API void rz_debug_map_free (RzDebugMap *map)
 
RZ_API RzListrz_debug_map_list_new (void)
 
RZ_API RZ_BORROW RzListrz_debug_map_list (RzDebug *dbg, bool user_map)
 Get RzList* of memory maps for the process currently being debugged. More...
 

Function Documentation

◆ rz_debug_map_alloc()

RZ_API RzDebugMap* rz_debug_map_alloc ( RzDebug dbg,
ut64  addr,
int  size,
bool  thp 
)

Definition at line 46 of file dmap.c.

46  {
47  RzDebugMap *map = NULL;
48  if (dbg && dbg->cur && dbg->cur->map_alloc) {
49  map = dbg->cur->map_alloc(dbg, addr, size, thp);
50  }
51  return map;
52 }
#define NULL
Definition: cris-opc.c:27
RzDebug * dbg
Definition: desil.c:30
size_t map(int syms, int left, int len)
Definition: enough.c:237
voidpf void uLong size
Definition: ioapi.h:138
RzDebugMap *(* map_alloc)(RzDebug *dbg, ut64 addr, int size, bool thp)
Definition: rz_debug.h:399
struct rz_debug_plugin_t * cur
Definition: rz_debug.h:295
static int addr
Definition: z80asm.c:58

References addr, rz_debug_t::cur, dbg, map(), rz_debug_plugin_t::map_alloc, and NULL.

Referenced by rz_cmd_debug_allocate_maps_handler(), and rz_cmd_debug_dmL_handler().

◆ rz_debug_map_dealloc()

RZ_API int rz_debug_map_dealloc ( RzDebug dbg,
RzDebugMap map 
)

Definition at line 54 of file dmap.c.

54  {
55  bool ret = false;
56  ut64 addr = map->addr;
57  if (dbg && dbg->cur && dbg->cur->map_dealloc) {
58  if (dbg->cur->map_dealloc(dbg, addr, map->size)) {
59  ret = true;
60  }
61  }
62  return (int)ret;
63 }
int(* map_dealloc)(RzDebug *dbg, ut64 addr, int size)
Definition: rz_debug.h:400
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

References addr, rz_debug_t::cur, dbg, map(), rz_debug_plugin_t::map_dealloc, and ut64().

Referenced by rz_cmd_debug_deallocate_map_handler().

◆ rz_debug_map_free()

RZ_API void rz_debug_map_free ( RzDebugMap map)

◆ rz_debug_map_get()

RZ_API RzDebugMap* rz_debug_map_get ( RzDebug dbg,
ut64  addr 
)

Definition at line 65 of file dmap.c.

65  {
66  RzDebugMap *map, *ret = NULL;
68  rz_list_foreach (dbg->maps, iter, map) {
69  if (addr >= map->addr && addr <= map->addr_end) {
70  ret = map;
71  break;
72  }
73  }
74  return ret;
75 }
RzList * maps
Definition: rz_debug.h:306

References addr, dbg, map(), rz_debug_t::maps, and NULL.

Referenced by asciiart_backtrace(), cmd_print_bars(), is_valid_xref(), rz_core_analysis_hasrefs_to_depth(), rz_core_analysis_refs(), rz_debug_thread_list(), w32_map_alloc(), and xnu_map_alloc().

◆ rz_debug_map_list()

RZ_API RZ_BORROW RzList* rz_debug_map_list ( RzDebug dbg,
bool  user_map 
)

Get RzList* of memory maps for the process currently being debugged.

Parameters
dbgRzDebug pointer
user_mapBoolean value, if true return memory maps belonging to user space else return memory maps belonging to kernel space
Returns

Definition at line 98 of file dmap.c.

98  {
99  return user_map ? dbg->maps_user : dbg->maps;
100 }
RzList * maps_user
Definition: rz_debug.h:307

References dbg, rz_debug_t::maps, and rz_debug_t::maps_user.

Referenced by rz_core_debug_map_print(), rz_core_debug_map_update_flags(), and rz_debug_map_list_visual().

◆ rz_debug_map_list_new()

RZ_API RzList* rz_debug_map_list_new ( void  )

Definition at line 83 of file dmap.c.

83  {
84  RzList *list = rz_list_new();
85  if (!list) {
86  return NULL;
87  }
89  return list;
90 }
RZ_API void rz_debug_map_free(RzDebugMap *map)
Definition: dmap.c:77
static void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11

References list(), NULL, rz_debug_map_free(), and rz_list_new().

Referenced by bsd_native_sysctl_map(), and rz_debug_new().

◆ rz_debug_map_new()

RZ_API RzDebugMap* rz_debug_map_new ( char *  name,
ut64  addr,
ut64  addr_end,
int  perm,
int  user 
)

Definition at line 7 of file dmap.c.

7  {
9  /* range could be 0k on OpenBSD, it's a honeypot */
10  if (!name || addr > addr_end) {
11  eprintf("rz_debug_map_new: error (\
12  %" PFMT64x ">%" PFMT64x ")\n",
13  addr, addr_end);
14  return NULL;
15  }
17  if (!map) {
18  return NULL;
19  }
20  map->name = strdup(name);
21  map->addr = addr;
22  map->addr_end = addr_end;
23  map->size = addr_end - addr;
24  map->perm = perm;
25  map->user = user;
26  return map;
27 }
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 eprintf(x, y...)
Definition: rlcc.c:7
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define PFMT64x
Definition: rz_types.h:393
Definition: z80asm.h:102

References addr, eprintf, map(), NULL, PFMT64x, RZ_NEW0, and strdup().

Referenced by __io_maps(), add_map(), bsd_native_sysctl_map(), rz_debug_gdb_map_get(), rz_debug_native_map_get(), rz_w32_dbg_modules(), windbg_map_get(), windbg_modules_get(), xnu_dbg_maps(), and xnu_dbg_modules().

◆ rz_debug_map_sync()

◆ rz_debug_modules_list()

RZ_API RzList* rz_debug_modules_list ( RzDebug dbg)