Rizin
unix-like reverse engineering framework and cli tools
io_mach.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2017 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_userconf.h>
5 
6 #include <rz_io.h>
7 #include <rz_lib.h>
8 #include <rz_cons.h>
9 
10 #if __APPLE__ && DEBUGGER
11 
12 static int __get_pid(RzIODesc *desc);
13 #define EXCEPTION_PORT 0
14 
15 // NOTE: mach/mach_vm is not available for iOS
16 #include <mach/exception_types.h>
17 #include <mach/mach_host.h>
18 #include <mach/host_priv.h>
19 #include <mach/mach_init.h>
20 #include <mach/mach_port.h>
21 #include <mach/mach_traps.h>
22 #include <mach/processor_set.h>
23 #include <mach/mach_error.h>
24 #include <mach/task.h>
25 #include <mach/task_info.h>
26 #include <mach/thread_act.h>
27 #include <mach/thread_info.h>
28 #include <mach/vm_map.h>
29 #include <mach-o/loader.h>
30 #include <mach-o/nlist.h>
31 #include <sys/ptrace.h>
32 #include <sys/types.h>
33 #include <sys/types.h>
34 #include <sys/wait.h>
35 #include <sys/wait.h>
36 #include <errno.h>
37 
38 #define MACH_ERROR_STRING(ret) \
39  (mach_error_string(ret) ? mach_error_string(ret) : "(unknown)")
40 
41 #define RZ_MACH_MAGIC rz_str_djb2_hash("mach")
42 
43 typedef struct {
44  task_t task;
45 } RzIOMach;
46 /*
47 #define RzIOMACH_PID(x) (x ? ((RzIOMach*)(x))->pid : -1)
48 #define RzIOMACH_TASK(x) (x ? ((RzIOMach*)(x))->task : -1)
49 */
50 
51 int RzIOMACH_TASK(RzIODescData *x) {
52  // TODO
53  return -1;
54 }
55 
56 #undef RZ_IO_NFDS
57 #define RZ_IO_NFDS 2
58 extern int errno;
59 
60 static task_t task_for_pid_workaround(int pid) {
61  host_t myhost = mach_host_self();
62  mach_port_t psDefault = 0;
63  mach_port_t psDefault_control = 0;
64  task_array_t tasks = NULL;
65  mach_msg_type_number_t numTasks = 0;
66  kern_return_t kr = -1;
67  int i;
68 
69  if (pid == -1) {
70  return MACH_PORT_NULL;
71  }
72  kr = processor_set_default(myhost, &psDefault);
73  if (kr != KERN_SUCCESS) {
74  return MACH_PORT_NULL;
75  }
76  kr = host_processor_set_priv(myhost, psDefault, &psDefault_control);
77  if (kr != KERN_SUCCESS) {
78  // eprintf ("host_processor_set_priv failed with error 0x%x\n", kr);
79  // mach_error ("host_processor_set_priv",kr);
80  return MACH_PORT_NULL;
81  }
82  numTasks = 0;
83  kr = processor_set_tasks(psDefault_control, &tasks, &numTasks);
84  if (kr != KERN_SUCCESS) {
85  // eprintf ("processor_set_tasks failed with error %x\n", kr);
86  return MACH_PORT_NULL;
87  }
88  if (pid == 0) {
89  /* kernel task */
90  return tasks[0];
91  }
92  for (i = 0; i < numTasks; i++) {
93  int pid2 = -1;
94  pid_for_task(i, &pid2);
95  if (pid == pid2) {
96  return tasks[i];
97  }
98  }
99  return MACH_PORT_NULL;
100 }
101 
102 static task_t task_for_pid_ios9pangu(int pid) {
103  task_t task = MACH_PORT_NULL;
104  host_get_special_port(mach_host_self(), HOST_LOCAL_NODE, 4, &task);
105  return task;
106 }
107 
108 static task_t pid_to_task(RzIODesc *fd, int pid) {
109  task_t task = 0;
110  static task_t old_task = 0;
111  static int old_pid = -1;
112  kern_return_t kr;
113 
114  RzIODescData *iodd = fd ? (RzIODescData *)fd->data : NULL;
115  RzIOMach *riom = NULL;
116  if (iodd) {
117  riom = iodd->data;
118  if (riom && riom->task) {
119  old_task = riom->task;
120  riom->task = 0;
121  old_pid = iodd->pid;
122  }
123  }
124  if (old_task != 0) {
125  if (old_pid == pid) {
126  return old_task;
127  }
128  // we changed the process pid so deallocate a ref from the old_task
129  // since we are going to get a new task
130  kr = mach_port_deallocate(mach_task_self(), old_task);
131  if (kr != KERN_SUCCESS) {
132  eprintf("pid_to_task: fail to deallocate port\n");
133  return 0;
134  }
135  }
136  int err = task_for_pid(mach_task_self(), (pid_t)pid, &task);
137  if ((err != KERN_SUCCESS) || !MACH_PORT_VALID(task)) {
139  if (task == MACH_PORT_NULL) {
140  task = task_for_pid_ios9pangu(pid);
141  if (task != MACH_PORT_NULL) {
142  // eprintf ("Failed to get task %d for pid %d.\n", (int)task, (int)pid);
143  // eprintf ("Missing priviledges? 0x%x: %s\n", err, MACH_ERROR_STRING (err));
144  return -1;
145  }
146  }
147  }
148  old_task = task;
149  old_pid = pid;
150  return task;
151 }
152 
153 static bool task_is_dead(RzIODesc *fd, int pid) {
154  unsigned int count = 0;
155  kern_return_t kr = mach_port_get_refs(mach_task_self(),
156  pid_to_task(fd, pid), MACH_PORT_RIGHT_SEND, &count);
157  return (kr != KERN_SUCCESS || !count);
158 }
159 
160 static ut64 the_lower = UT64_MAX;
161 
162 static ut64 getNextValid(RzIO *io, RzIODesc *fd, ut64 addr) {
163  struct vm_region_submap_info_64 info;
164  vm_address_t address = MACH_VM_MIN_ADDRESS;
165  vm_size_t size = (vm_size_t)0;
166  vm_size_t osize = (vm_size_t)0;
167  natural_t depth = 0;
168  kern_return_t kr;
169  int tid = __get_pid(fd);
170  task_t task = pid_to_task(fd, tid);
171  ut64 lower = addr;
172 #if __arm64__ || __aarch64__
173  size = osize = 16384; // acording to frida
174 #else
175  size = osize = 4096;
176 #endif
177  if (the_lower != UT64_MAX) {
178  return RZ_MAX(addr, the_lower);
179  }
180 
181  for (;;) {
182  mach_msg_type_number_t info_count;
183  info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
184  memset(&info, 0, sizeof(info));
185  kr = vm_region_recurse_64(task, &address, &size,
186  &depth, (vm_region_recurse_info_t)&info, &info_count);
187  if (kr != KERN_SUCCESS) {
188  break;
189  }
190  if (lower == addr) {
191  lower = address;
192  }
193  if (info.is_submap) {
194  depth++;
195  continue;
196  }
197  if (addr >= address && addr < address + size) {
198  return addr;
199  }
200  if (address < lower) {
201  lower = address;
202  }
203  if (size < 1) {
204  size = osize;
205  }
206  address += size;
207  size = 0;
208  }
209  the_lower = lower;
210  return lower;
211 }
212 
213 static int __read(RzIO *io, RzIODesc *desc, ut8 *buf, int len) {
214  vm_size_t size = 0;
215  int blen, err, copied = 0;
216  int blocksize = 32;
217  RzIODescData *dd = (RzIODescData *)desc->data;
218  if (!io || !desc || !buf || !dd) {
219  return -1;
220  }
221  if (dd->magic != rz_str_djb2_hash("mach")) {
222  return -1;
223  }
224  memset(buf, 0xff, len);
225  int pid = __get_pid(desc);
226  task_t task = pid_to_task(desc, pid);
227  if (task_is_dead(desc, pid)) {
228  return -1;
229  }
230  if (pid == 0) {
231  if (io->off < 4096) {
232  return len;
233  }
234  }
235  copied = getNextValid(io, desc, io->off) - io->off;
236  if (copied < 0) {
237  copied = 0;
238  }
239  while (copied < len) {
240  blen = RZ_MIN((len - copied), blocksize);
241  // blen = len;
242  err = vm_read_overwrite(task,
243  (ut64)io->off + copied, blen,
244  (pointer_t)buf + copied, &size);
245  switch (err) {
246  case KERN_PROTECTION_FAILURE:
247  // eprintf ("rz_io_mach_read: kern protection failure.\n");
248  break;
249  case KERN_INVALID_ADDRESS:
250  if (blocksize == 1) {
251  memset(buf + copied, 0xff, len - copied);
252  return size + copied;
253  }
254  blocksize = 1;
255  blen = 1;
256  buf[copied] = 0xff;
257  break;
258  }
259  if (err == -1 || size < 1) {
260  return -1;
261  }
262  if (size == 0) {
263  if (blocksize == 1) {
264  memset(buf + copied, 0xff, len - copied);
265  return len;
266  }
267  blocksize = 1;
268  blen = 1;
269  buf[copied] = 0xff;
270  }
271  copied += blen;
272  }
273  return len;
274 }
275 
276 static int tsk_getperm(RzIO *io, task_t task, vm_address_t addr) {
277  kern_return_t kr;
278  mach_port_t object;
279  vm_size_t vmsize;
280  mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT_64;
281  vm_region_flavor_t flavor = VM_REGION_BASIC_INFO_64;
282  vm_region_basic_info_data_64_t info;
283  kr = vm_region_64(task, &addr, &vmsize, flavor, (vm_region_info_t)&info, &info_count, &object);
284  return (kr != KERN_SUCCESS ? 0 : info.protection);
285 }
286 
287 static int tsk_pagesize(RzIODesc *desc) {
288  int tid = __get_pid(desc);
289  task_t task = pid_to_task(desc, tid);
290  static vm_size_t pagesize = 0;
291  return pagesize
292  ? pagesize
293  : (host_page_size(task, &pagesize) == KERN_SUCCESS)
294  ? pagesize
295  : 4096;
296 }
297 
298 static vm_address_t tsk_getpagebase(RzIODesc *desc, ut64 addr) {
299  vm_address_t pagesize = tsk_pagesize(desc);
300  return (addr & ~(pagesize - 1));
301 }
302 
303 static bool tsk_setperm(RzIO *io, task_t task, vm_address_t addr, int len, int perm) {
304  kern_return_t kr;
305  kr = vm_protect(task, addr, len, 0, perm);
306  if (kr != KERN_SUCCESS) {
307  perror("tsk_setperm");
308  return false;
309  }
310  return true;
311 }
312 
313 static bool tsk_write(task_t task, vm_address_t addr, const ut8 *buf, int len) {
314  kern_return_t kr = vm_write(task, addr, (vm_offset_t)buf, (mach_msg_type_number_t)len);
315  if (kr != KERN_SUCCESS) {
316  return false;
317  }
318  return true;
319 }
320 
321 static int mach_write_at(RzIO *io, RzIODesc *desc, const void *buf, int len, ut64 addr) {
322  vm_address_t vaddr = addr;
323  vm_address_t pageaddr;
324  vm_size_t pagesize;
325  vm_size_t total_size;
326  int operms = 0;
327  int pid = __get_pid(desc);
328  if (!desc || pid < 0) {
329  return 0;
330  }
331  task_t task = pid_to_task(desc, pid);
332 
333  if (len < 1 || task_is_dead(desc, task)) {
334  return 0;
335  }
336  pageaddr = tsk_getpagebase(desc, addr);
337  pagesize = tsk_pagesize(desc);
338  total_size = (len > pagesize)
339  ? pagesize * (1 + (len / pagesize))
340  : pagesize;
341  if (tsk_write(task, vaddr, buf, len)) {
342  return len;
343  }
344  operms = tsk_getperm(io, task, pageaddr);
345  if (!tsk_setperm(io, task, pageaddr, total_size, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY)) {
346  eprintf("io.mach: Cannot set page perms for %d byte(s) at 0x%08" PFMT64x "\n", (int)pagesize, (ut64)pageaddr);
347  return -1;
348  }
349  if (!tsk_write(task, vaddr, buf, len)) {
350  eprintf("io.mach: Cannot write on memory\n");
351  len = -1;
352  }
353  if (operms) {
354  if (!tsk_setperm(io, task, pageaddr, total_size, operms)) {
355  eprintf("io.mach: Cannot restore page perms\n");
356  return -1;
357  }
358  }
359  return len;
360 }
361 
362 static int __write(RzIO *io, RzIODesc *fd, const ut8 *buf, int len) {
363  return mach_write_at(io, fd, buf, len, io->off);
364 }
365 
366 static bool __plugin_open(RzIO *io, const char *file, bool many) {
367  return (!strncmp(file, "attach://", 9) || !strncmp(file, "mach://", 7));
368 }
369 
370 static RzIODesc *__open(RzIO *io, const char *file, int rw, int mode) {
371  RzIODesc *ret = NULL;
372  RzIOMach *riom = NULL;
373  const char *pidfile;
374  char *pidpath, *endptr;
375  int pid;
376  task_t task;
377  if (!__plugin_open(io, file, false) && !__plugin_open(io, (const char *)&file[1], false)) {
378  return NULL;
379  }
380  pidfile = file + (file[0] == 'a' ? 9 : (file[0] == 's' ? 8 : 7));
381  pid = (int)strtol(pidfile, &endptr, 10);
382  if (endptr == pidfile || pid < 0) {
383  return NULL;
384  }
385  task = pid_to_task(NULL, pid);
386  if (task == -1) {
387  return NULL;
388  }
389  if (!task) {
390  if (pid > 0 && !strncmp(file, "smach://", 8)) {
391  kill(pid, SIGKILL);
392  eprintf("Child killed\n");
393  }
394  switch (errno) {
395  case EPERM:
396  eprintf("Operation not permitted\n");
397  break;
398  case EINVAL:
399  perror("ptrace: Cannot attach");
400  eprintf("\n\nPlease ensure your rizin binary is signed and it has the right entitlements to make debugger work. ");
401  eprintf("Be aware that binaries signed by Apple cannot be debugged due to the Apple System Integrity Protection (SIP).\n");
402  eprintf("\nFor more info look at: https://book.rizin.re/debugger/apple.html#sign-rizin-binary\n\n");
403  eprintf("ERRNO: %d (EINVAL)\n", errno);
404  break;
405  default:
406  eprintf("unknown error in debug_attach\n");
407  break;
408  }
409  return NULL;
410  }
412  if (iodd) {
413  iodd->pid = pid;
414  iodd->tid = pid;
415  iodd->data = NULL;
416  }
417  riom = RZ_NEW0(RzIOMach);
418  if (!riom) {
419  RZ_FREE(iodd);
420  return NULL;
421  }
422  riom->task = task;
423  iodd->magic = rz_str_djb2_hash("mach");
424  iodd->data = riom;
425  // sleep 1s to get proper path (program name instead of ls) (racy)
426  pidpath = pid
428  : strdup("kernel");
429  if (!strncmp(file, "smach://", 8)) {
430  ret = rz_io_desc_new(io, &rz_io_plugin_mach, &file[1],
431  rw | RZ_PERM_X, mode, iodd);
432  } else {
434  rw | RZ_PERM_X, mode, iodd);
435  }
436  ret->name = pidpath;
437  return ret;
438 }
439 
440 static ut64 __lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence) {
441  switch (whence) {
442  case RZ_IO_SEEK_SET:
443  io->off = offset;
444  break;
445  case RZ_IO_SEEK_CUR:
446  io->off += offset;
447  break;
448  case RZ_IO_SEEK_END:
449  io->off = ST64_MAX;
450  }
451  return io->off;
452 }
453 
454 static int __close(RzIODesc *fd) {
455  if (!fd) {
456  return false;
457  }
458  RzIODescData *iodd = fd->data;
459  kern_return_t kr;
460  if (!iodd) {
461  return false;
462  }
463  if (iodd->magic != RZ_MACH_MAGIC) {
464  return false;
465  }
466  task_t task = pid_to_task(fd, iodd->pid);
467  kr = mach_port_deallocate(mach_task_self(), task);
468  if (kr != KERN_SUCCESS) {
469  perror("__close io_mach");
470  }
471  RZ_FREE(fd->data);
472  return kr == KERN_SUCCESS;
473 }
474 
475 static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
476  if (!io || !fd || !cmd || !fd->data) {
477  return NULL;
478  }
479  RzIODescData *iodd = fd->data;
480  if (iodd->magic != RZ_MACH_MAGIC) {
481  return NULL;
482  }
483 
484  task_t task = pid_to_task(fd, iodd->tid);
485  /* XXX ugly hack for testing purposes */
486  if (!strcmp(cmd, "")) {
487  return NULL;
488  }
489  if (!strncmp(cmd, "perm", 4)) {
490  int perm = rz_str_rwx(cmd + 4);
491  if (perm) {
492  int pagesize = tsk_pagesize(fd);
493  tsk_setperm(io, task, io->off, pagesize, perm);
494  } else {
495  eprintf("Usage: R!perm [rwx]\n");
496  }
497  return NULL;
498  }
499  if (!strncmp(cmd, "pid", 3)) {
500  RzIODescData *iodd = fd->data;
501  RzIOMach *riom = iodd->data;
502  const char *pidstr = cmd + 3;
503  int pid = -1;
504  if (*pidstr) {
505  pid = __get_pid(fd);
506  // return NULL;
507  } else {
508  eprintf("%d\n", iodd->pid);
509  return NULL;
510  }
511  if (!strcmp(pidstr, "0")) {
512  pid = 0;
513  } else {
514  pid = atoi(pidstr);
515  if (!pid) {
516  pid = -1;
517  }
518  }
519  if (pid != -1) {
520  task_t task = pid_to_task(fd, pid);
521  if (task != -1) {
522  riom->task = task;
523  iodd->pid = pid;
524  iodd->tid = pid;
525  return NULL;
526  }
527  }
528  eprintf("io_mach_system: Invalid pid %d\n", pid);
529  } else {
530  eprintf("Try: 'R!pid' or 'R!perm'\n");
531  }
532  return NULL;
533 }
534 
535 static int __get_pid(RzIODesc *desc) {
536  // dupe for ? rz_io_desc_get_pid (desc);
537  if (!desc || !desc->data) {
538  return -1;
539  }
540  RzIODescData *iodd = desc->data;
541  if (iodd) {
542  if (iodd->magic != RZ_MACH_MAGIC) {
543  return -1;
544  }
545  return iodd->pid;
546  }
547  return -1;
548 }
549 
550 // TODO: rename ptrace to io_mach .. err io.ptrace ??
552  .name = "mach",
553  .desc = "Attach to mach debugger instance",
554  .license = "LGPL",
555  .uris = "attach://,mach://,smach://",
556  .open = __open,
557  .close = __close,
558  .read = __read,
559  .getpid = __get_pid,
560  .gettid = __get_pid,
561  .check = __plugin_open,
562  .lseek = __lseek,
563  .system = __system,
564  .write = __write,
565  .isdbg = true
566 };
567 
568 #else
570  .name = "mach",
571  .desc = "mach debug io (unsupported in this platform)",
572  .license = "LGPL"
573 };
574 #endif
575 
576 #ifndef RZ_PLUGIN_INCORE
578  .type = RZ_LIB_TYPE_IO,
579  .data = &rz_io_plugin_mach,
581 };
582 #endif
size_t len
Definition: 6502dis.c:15
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
RzBinInfo * info(RzBinFile *bf)
Definition: bin_ne.c:86
const char * desc
Definition: bin_vsf.c:19
#define SIGKILL
#define RZ_API
#define NULL
Definition: cris-opc.c:27
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 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 cmd
Definition: sflib.h:79
static int __read(RzIO *io, RzIODesc *fd, ut8 *buf, int count)
Definition: io_bfdbg.c:84
static bool __plugin_open(RzIO *io, const char *pathname, bool many)
Definition: io_bfdbg.c:151
static RzIODesc * __open(RzIO *io, const char *pathname, int rw, int mode)
Definition: io_bfdbg.c:159
static int __write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
Definition: io_bfdbg.c:38
static ut64 __lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence)
Definition: io_bfdbg.c:142
static int __close(RzIODesc *fd)
Definition: io_bfdbg.c:130
static char * __system(RzIO *io, RzIODesc *fd, const char *cmd)
Definition: io_bochs.c:90
RZ_API RzLibStruct rizin_plugin
Definition: io_mach.c:577
RzIOPlugin rz_io_plugin_mach
Definition: io_mach.c:569
voidpf void uLong size
Definition: ioapi.h:138
voidpf uLong offset
Definition: ioapi.h:144
const char int mode
Definition: ioapi.h:137
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
return memset(p, 0, total)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc kill
Definition: sflib.h:64
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
Definition: sflib.h:64
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")
@ VM_PROT_WRITE
@ VM_PROT_READ
int x
Definition: mipsasm.c:20
#define eprintf(x, y...)
Definition: rlcc.c:7
#define RZ_IO_SEEK_CUR
Definition: rz_io.h:16
RZ_API RzIODesc * rz_io_desc_new(RzIO *io, RzIOPlugin *plugin, const char *uri, int flags, int mode, void *data)
Definition: io_desc.c:11
#define RZ_IO_SEEK_SET
Definition: rz_io.h:15
#define RZ_IO_SEEK_END
Definition: rz_io.h:17
@ RZ_LIB_TYPE_IO
Definition: rz_lib.h:69
RZ_API ut64 rz_str_djb2_hash(const char *str)
Definition: str.c:383
RZ_API int rz_str_rwx(const char *str)
Definition: str.c:318
RZ_API char * rz_sys_pid_to_path(int pid)
Definition: sys.c:920
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define RZ_PERM_X
Definition: rz_types.h:95
#define RZ_FREE(x)
Definition: rz_types.h:369
#define PFMT64x
Definition: rz_types.h:393
#define RZ_MIN(x, y)
#define RZ_MAX(x, y)
#define UT64_MAX
Definition: rz_types_base.h:86
#define ST64_MAX
Definition: rz_types_base.h:84
#define RZ_VERSION
Definition: rz_version.h:8
static int
Definition: sfsocketcall.h:114
#define EINVAL
Definition: sftypes.h:132
int pid_t
Definition: sftypes.h:38
#define EPERM
Definition: sftypes.h:111
int pid
Definition: rz_io.h:109
ut64 magic
Definition: rz_io.h:108
int tid
Definition: rz_io.h:110
void * data
Definition: rz_io.h:111
Definition: gzappend.c:170
char * name
Definition: rz_io.h:99
const char * name
Definition: rz_io.h:115
const char * version
Definition: rz_io.h:117
Definition: rz_io.h:59
ut64 off
Definition: rz_io.h:61
static int blocksize
Definition: visual.c:15
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static task_t task_for_pid_workaround(int Pid)
Definition: xnu_debug.c:57
static task_t task_for_pid_ios9pangu(int pid)
Definition: xnu_debug.c:102
task_t pid_to_task(int pid)
Definition: xnu_debug.c:498
static const z80_opcode fd[]
Definition: z80_tab.h:997
static const z80_opcode dd[]
Definition: z80_tab.h:844
static int addr
Definition: z80asm.c:58