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

Go to the source code of this file.

Functions

RZ_API RzDebugDescrz_debug_desc_new (int fd, char *path, int perm, int type, int off)
 
RZ_API void rz_debug_desc_free (RzDebugDesc *p)
 
RZ_API int rz_debug_desc_open (RzDebug *dbg, const char *path)
 
RZ_API int rz_debug_desc_close (RzDebug *dbg, int fd)
 
RZ_API int rz_debug_desc_dup (RzDebug *dbg, int fd, int newfd)
 
RZ_API int rz_debug_desc_read (RzDebug *dbg, int fd, ut64 addr, int len)
 
RZ_API int rz_debug_desc_seek (RzDebug *dbg, int fd, ut64 addr)
 
RZ_API int rz_debug_desc_write (RzDebug *dbg, int fd, ut64 addr, int len)
 
RZ_API int rz_debug_desc_list (RzDebug *dbg, int rad)
 

Function Documentation

◆ rz_debug_desc_close()

RZ_API int rz_debug_desc_close ( RzDebug dbg,
int  fd 
)

Definition at line 36 of file ddesc.c.

36  {
37  if (dbg && dbg->cur && dbg->cur->desc.close) {
38  return dbg->cur->desc.close(fd);
39  }
40  return false;
41 }
RzDebug * dbg
Definition: desil.c:30
int(* close)(int fd)
Definition: rz_debug.h:328
RzDebugDescPlugin desc
Definition: rz_debug.h:403
struct rz_debug_plugin_t * cur
Definition: rz_debug.h:295
static const z80_opcode fd[]
Definition: z80_tab.h:997

References rz_debug_desc_plugin_t::close, rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, and fd.

◆ rz_debug_desc_dup()

RZ_API int rz_debug_desc_dup ( RzDebug dbg,
int  fd,
int  newfd 
)

Definition at line 43 of file ddesc.c.

43  {
44  if (dbg && dbg->cur && dbg->cur->desc.dup) {
45  return dbg->cur->desc.dup(fd, newfd);
46  }
47  return false;
48 }
int(* dup)(int fd, int newfd)
Definition: rz_debug.h:332

References rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, rz_debug_desc_plugin_t::dup, and fd.

Referenced by rz_cmd_debug().

◆ rz_debug_desc_free()

RZ_API void rz_debug_desc_free ( RzDebugDesc p)

Definition at line 20 of file ddesc.c.

20  {
21  if (p) {
22  if (p->path) {
23  free(p->path);
24  }
25  free(p);
26  }
27 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
void * p
Definition: libc.cpp:67

References free(), and p.

Referenced by bsd_desc_list(), linux_desc_list(), and w32_desc_list().

◆ rz_debug_desc_list()

RZ_API int rz_debug_desc_list ( RzDebug dbg,
int  rad 
)

Definition at line 71 of file ddesc.c.

71  {
72  int count = 0;
73  RzList *list;
75  RzDebugDesc *p;
76 
77  if (rad) {
78  if (dbg && dbg->cb_printf) {
79  dbg->cb_printf("TODO \n");
80  }
81  } else {
82  if (dbg && dbg->cur && dbg->cur->desc.list) {
83  list = dbg->cur->desc.list(dbg->pid);
84  rz_list_foreach (list, iter, p) {
85  dbg->cb_printf("%i 0x%" PFMT64x " %c%c%c %s\n", p->fd, p->off,
86  (p->perm & RZ_PERM_R) ? 'r' : '-',
87  (p->perm & RZ_PERM_W) ? 'w' : '-',
88  p->type, p->path);
89  }
91  free(list);
92  }
93  }
94  return count;
95 }
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 void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API void rz_list_purge(RZ_NONNULL RzList *list)
Empties the list without freeing the list pointer.
Definition: list.c:120
#define RZ_PERM_R
Definition: rz_types.h:93
#define RZ_PERM_W
Definition: rz_types.h:94
#define PFMT64x
Definition: rz_types.h:393
RzList *(* list)(int pid)
Definition: rz_debug.h:333
PrintfCallback cb_printf
Definition: rz_debug.h:292

References rz_debug_t::cb_printf, count, rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, free(), list(), rz_debug_desc_plugin_t::list, p, PFMT64x, rz_debug_t::pid, rz_list_purge(), RZ_PERM_R, and RZ_PERM_W.

Referenced by rz_cmd_debug().

◆ rz_debug_desc_new()

RZ_API RzDebugDesc* rz_debug_desc_new ( int  fd,
char *  path,
int  perm,
int  type,
int  off 
)

Definition at line 8 of file ddesc.c.

8  {
10  if (desc) {
11  desc->fd = fd;
12  desc->path = strdup(path);
13  desc->perm = perm;
14  desc->type = type;
15  desc->off = off;
16  }
17  return desc;
18 }
const char * desc
Definition: bin_vsf.c:19
static static fork const void static count static fd const char const char static newpath const char static path const char path
Definition: sflib.h:35
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")
int type
Definition: mipsasm.c:17
int off
Definition: pal.c:13
#define RZ_NEW(x)
Definition: rz_types.h:285

References desc, fd, off, path, RZ_NEW, strdup(), and type.

Referenced by bsd_desc_list(), linux_desc_list(), and w32_desc_list().

◆ rz_debug_desc_open()

RZ_API int rz_debug_desc_open ( RzDebug dbg,
const char *  path 
)

Definition at line 29 of file ddesc.c.

29  {
30  if (dbg && dbg->cur && dbg->cur->desc.open) {
31  return dbg->cur->desc.open(path);
32  }
33  return false;
34 }
int(* open)(const char *path)
Definition: rz_debug.h:327

References rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, rz_debug_desc_plugin_t::open, and path.

◆ rz_debug_desc_read()

RZ_API int rz_debug_desc_read ( RzDebug dbg,
int  fd,
ut64  addr,
int  len 
)

Definition at line 50 of file ddesc.c.

50  {
51  if (dbg && dbg->cur && dbg->cur->desc.read) {
52  return dbg->cur->desc.read(fd, addr, len);
53  }
54  return false;
55 }
size_t len
Definition: 6502dis.c:15
int(* read)(int fd, ut64 addr, int len)
Definition: rz_debug.h:329
static int addr
Definition: z80asm.c:58

References addr, rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, fd, len, and rz_debug_desc_plugin_t::read.

Referenced by rz_cmd_debug().

◆ rz_debug_desc_seek()

RZ_API int rz_debug_desc_seek ( RzDebug dbg,
int  fd,
ut64  addr 
)

Definition at line 57 of file ddesc.c.

57  {
58  if (dbg && dbg->cur && dbg->cur->desc.seek) {
59  return dbg->cur->desc.seek(fd, addr);
60  }
61  return false;
62 }
int(* seek)(int fd, ut64 addr)
Definition: rz_debug.h:331

References addr, rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, fd, and rz_debug_desc_plugin_t::seek.

Referenced by rz_cmd_debug().

◆ rz_debug_desc_write()

RZ_API int rz_debug_desc_write ( RzDebug dbg,
int  fd,
ut64  addr,
int  len 
)

Definition at line 64 of file ddesc.c.

64  {
65  if (dbg && dbg->cur && dbg->cur->desc.write) {
66  return dbg->cur->desc.write(fd, addr, len);
67  }
68  return false;
69 }
int(* write)(int fd, ut64 addr, int len)
Definition: rz_debug.h:330

References addr, rz_debug_t::cur, dbg, rz_debug_plugin_t::desc, fd, len, and rz_debug_desc_plugin_t::write.

Referenced by rz_cmd_debug().