Rizin
unix-like reverse engineering framework and cli tools
io_debug.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2007-2020 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <errno.h>
5 #include <rz_io.h>
6 #include <rz_lib.h>
7 #include <rz_util.h>
8 #include <rz_cons.h>
9 #include <rz_core.h>
10 #include <rz_socket.h>
11 #include <rz_debug.h> /* only used for BSD PTRACE redefinitions */
12 #include <string.h>
13 
14 #define USE_RARUN 0
15 
16 #if __linux__ || __APPLE__ || __WINDOWS__ || __NetBSD__ || __KFBSD__ || __OpenBSD__
17 #define DEBUGGER_SUPPORTED 1
18 #else
19 #define DEBUGGER_SUPPORTED 0
20 #endif
21 
22 #if DEBUGGER && DEBUGGER_SUPPORTED
23 #define MAGIC_EXIT 123
24 
25 #include <signal.h>
26 #if __UNIX__
27 #include <sys/ptrace.h>
28 #include <sys/types.h>
29 #include <sys/wait.h>
30 #endif
31 
32 #if __APPLE__
33 #if !__POWERPC__
34 #include <spawn.h>
35 #endif
36 #include <sys/types.h>
37 #include <sys/wait.h>
38 #include <mach/exception_types.h>
39 #include <mach/mach_init.h>
40 #include <mach/mach_port.h>
41 #include <mach/mach_traps.h>
42 #include <mach/task.h>
43 #include <mach/task_info.h>
44 #include <mach/thread_act.h>
45 #include <mach/thread_info.h>
46 #include <mach/vm_map.h>
47 #include <mach-o/loader.h>
48 #include <mach-o/nlist.h>
49 #endif
50 
51 #if __WINDOWS__
52 #include <rz_windows.h>
53 #include <w32dbg_wrap.h>
54 #endif
55 
56 /*
57  * Creates a new process and returns the result:
58  * -1 : error
59  * 0 : ok
60  */
61 
62 #if __WINDOWS__
63 typedef struct {
64  HANDLE hnd;
65  ut64 winbase;
66 } RzIOW32;
67 
68 static int setup_tokens(void) {
69  HANDLE tok = NULL;
70  TOKEN_PRIVILEGES tp;
71  DWORD err = -1;
72 
73  if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &tok)) {
74  goto err_enable;
75  }
76  tp.PrivilegeCount = 1;
77  if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid)) {
78  goto err_enable;
79  }
80  // tp.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
81  tp.Privileges[0].Attributes = 0; // SE_PRIVILEGE_ENABLED;
82  if (!AdjustTokenPrivileges(tok, 0, &tp, sizeof(tp), NULL, NULL)) {
83  goto err_enable;
84  }
85  err = 0;
86 err_enable:
87  if (tok) {
88  CloseHandle(tok);
89  }
90  if (err) {
91  rz_sys_perror("setup_tokens");
92  }
93  return err;
94 }
95 
96 struct __createprocess_params {
97  LPCTSTR appname;
98  LPTSTR cmdline;
99  PROCESS_INFORMATION *pi;
100  DWORD flags;
101 };
102 
103 static int __createprocess_wrap(void *params) {
104  STARTUPINFO si = { 0 };
105  // TODO: Add DEBUG_PROCESS to support child process debugging
106  struct __createprocess_params *p = params;
107  return CreateProcess(p->appname, p->cmdline, NULL, NULL, FALSE,
108  p->flags, NULL, NULL, &si, p->pi);
109 }
110 
111 static int fork_and_ptraceme(RzIO *io, int bits, const char *cmd) {
112  RzCore *core = io->corebind.core;
113  PROCESS_INFORMATION pi;
114  STARTUPINFO si = { 0 };
115  si.cb = sizeof(si);
116  int pid, tid;
117  if (!*cmd) {
118  return -1;
119  }
120  setup_tokens();
121  char *_cmd = io->args ? rz_str_appendf(strdup(cmd), " %s", io->args) : strdup(cmd);
122  char **argv = rz_str_argv(_cmd, NULL);
123  char *cmdline = NULL;
124  // We need to build a command line with quoted argument and escaped quotes
125  int i = 0;
126  while (argv[i]) {
128  cmdline = rz_str_appendf(cmdline, "\"%s\" ", argv[i]);
129  i++;
130  }
131 
132  LPTSTR appname_ = rz_sys_conv_utf8_to_win(argv[0]);
133  LPTSTR cmdline_ = rz_sys_conv_utf8_to_win(cmdline);
134  DWORD flags = DEBUG_ONLY_THIS_PROCESS;
135  flags |= core->dbg->create_new_console ? CREATE_NEW_CONSOLE : 0;
136  free(cmdline);
137  struct __createprocess_params p = { appname_, cmdline_, &pi, flags };
138  W32DbgWInst *wrap = (W32DbgWInst *)rz_io_get_w32dbg_wrap(io);
139  wrap->params.type = W32_CALL_FUNC;
140  wrap->params.func.func = __createprocess_wrap;
141  wrap->params.func.user = &p;
142  w32dbg_wrap_wait_ret(wrap);
143  if (!w32dbgw_ret(wrap)) {
144  w32dbgw_err(wrap);
145  rz_sys_perror("fork_and_ptraceme/CreateProcess");
146  free(appname_);
147  free(cmdline_);
148  return -1;
149  }
150  CloseHandle(pi.hThread);
151  free(appname_);
152  free(cmdline_);
154 
155  /* get process id and thread id */
156  pid = pi.dwProcessId;
157  tid = pi.dwThreadId;
158 
159  eprintf("Spawned new process with pid %d, tid = %d\n", pid, tid);
160 
161  RzCore *c = io->corebind.core;
162  c->dbg->plugin_data = wrap;
163  /* catch create process event */
164  int ret = c->dbg->cur->wait(c->dbg, pi.dwProcessId);
165  /* check if is a create process debug event */
166  if (ret != RZ_DEBUG_REASON_NEW_PID) {
167  TerminateProcess(pi.hProcess, 1);
168  core->dbg->cur->detach(core->dbg, wrap->pi.dwProcessId);
169  CloseHandle(pi.hProcess);
170  return -1;
171  }
172  CloseHandle(pi.hProcess);
173  return pid;
174 }
175 #else // windows
176 
177 #if (__APPLE__ && __POWERPC__) || !__APPLE__
178 
179 #if __APPLE__ || __BSD__
180 static void inferior_abort_handler(int pid) {
181  eprintf("Inferior received signal SIGABRT. Executing BKPT.\n");
182 }
183 #endif
184 
185 static void trace_me(void) {
186 #if __APPLE__
187  rz_sys_signal(SIGTRAP, SIG_IGN); // NEED BY STEP
188 #endif
189 #if __APPLE__ || __BSD__
190  /* we can probably remove this #if..as long as PT_TRACE_ME is redefined for OSX in rz_debug.h */
191  rz_sys_signal(SIGABRT, inferior_abort_handler);
192  if (ptrace(PT_TRACE_ME, 0, 0, 0) != 0) {
193  rz_sys_perror("ptrace-traceme");
194  }
195 #if __APPLE__
196  ptrace(PT_SIGEXC, getpid(), NULL, 0);
197 #endif
198 #else
199  if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) {
200  rz_sys_perror("ptrace-traceme");
201  exit(MAGIC_EXIT);
202  }
203 #endif
204 }
205 #endif
206 
207 #if __APPLE__ && !__POWERPC__
208 static void handle_posix_error(int err) {
209  switch (err) {
210  case 0:
211  // eprintf ("Success\n");
212  break;
213  case 22:
214  eprintf("posix_spawnp: Invalid argument\n");
215  break;
216  case 86:
217  eprintf("Unsupported architecture. Please specify -b 32\n");
218  break;
219  default:
220  eprintf("posix_spawnp: unknown error %d\n", err);
221  perror("posix_spawnp");
222  break;
223  }
224 }
225 #endif
226 
227 static RzRunProfile *_get_run_profile(RzIO *io, int bits, char **argv) {
228  char *expr = NULL;
229  int i;
231  if (!rp) {
232  return NULL;
233  }
234  for (i = 0; argv[i]; i++) {
235  rp->_args[i] = argv[i];
236  }
237  rp->_args[i] = NULL;
238  if (!argv[0]) {
239  rz_run_free(rp);
240  return NULL;
241  }
242  rp->_program = strdup(argv[0]);
243 
244  rp->_dodebug = true;
245  if (io->runprofile && *io->runprofile) {
246  if (!rz_run_parsefile(rp, io->runprofile)) {
247  eprintf("Can't find profile '%s'\n", io->runprofile);
248  rz_run_free(rp);
249  return NULL;
250  }
251  if (strstr(io->runprofile, RZ_SYS_DIR ".rz-run.")) {
252  (void)rz_file_rm(io->runprofile);
253  }
254  } else if (io->envprofile) {
255  if (!rz_run_parse(rp, io->envprofile)) {
256  eprintf("Can't parse default rz-run profile\n");
257  rz_run_free(rp);
258  return NULL;
259  }
260  }
261  if (bits == 64) {
262  rz_run_parseline(rp, expr = strdup("bits=64"));
263  } else if (bits == 32) {
264  rz_run_parseline(rp, expr = strdup("bits=32"));
265  }
266  free(expr);
267  if (rz_run_config_env(rp)) {
268  eprintf("Can't config the environment.\n");
269  rz_run_free(rp);
270  return NULL;
271  }
272  return rp;
273 }
274 
275 #if __APPLE__ && !__POWERPC__
276 
277 static void handle_posix_redirection(RzRunProfile *rp, posix_spawn_file_actions_t *fileActions) {
278  const int mode = S_IRUSR | S_IWUSR;
279  if (rp->_stdin) {
280  posix_spawn_file_actions_addopen(fileActions, STDIN_FILENO, rp->_stdin, O_RDONLY, mode);
281  }
282  if (rp->_stdout) {
283  posix_spawn_file_actions_addopen(fileActions, STDOUT_FILENO, rp->_stdout, O_WRONLY, mode);
284  }
285  if (rp->_stderr) {
286  posix_spawn_file_actions_addopen(fileActions, STDERR_FILENO, rp->_stderr, O_WRONLY, mode);
287  }
288 }
289 
290 // __UNIX__ (not windows)
291 static int fork_and_ptraceme_for_mac(RzIO *io, int bits, const char *cmd) {
292  pid_t p = -1;
293  char **argv;
294  posix_spawn_file_actions_t fileActions;
295  ut32 ps_flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
296  sigset_t no_signals;
297  sigset_t all_signals;
298  size_t copied = 1;
299  cpu_type_t cpu = CPU_TYPE_ANY;
300  posix_spawnattr_t attr = { 0 };
301  posix_spawnattr_init(&attr);
302 
303  sigemptyset(&no_signals);
304  sigfillset(&all_signals);
305  posix_spawnattr_setsigmask(&attr, &no_signals);
306  posix_spawnattr_setsigdefault(&attr, &all_signals);
307 
308  posix_spawn_file_actions_init(&fileActions);
309  posix_spawn_file_actions_addinherit_np(&fileActions, STDIN_FILENO);
310  posix_spawn_file_actions_addinherit_np(&fileActions, STDOUT_FILENO);
311  posix_spawn_file_actions_addinherit_np(&fileActions, STDERR_FILENO);
312 
313  ps_flags |= POSIX_SPAWN_CLOEXEC_DEFAULT;
314  ps_flags |= POSIX_SPAWN_START_SUSPENDED;
315 #define _POSIX_SPAWN_DISABLE_ASLR 0x0100
316  int ret;
317  argv = rz_str_argv(cmd, NULL);
318  if (!argv) {
319  posix_spawn_file_actions_destroy(&fileActions);
320  return -1;
321  }
322  RzRunProfile *rp = _get_run_profile(io, bits, argv);
323  if (!rp) {
325  posix_spawn_file_actions_destroy(&fileActions);
326  return -1;
327  }
328  handle_posix_redirection(rp, &fileActions);
329  if (rp->_args[0]) {
330  if (!rp->_aslr) {
331  ps_flags |= _POSIX_SPAWN_DISABLE_ASLR;
332  }
333 #if __x86_64__
334  if (rp->_bits == 32) {
335  cpu = CPU_TYPE_I386;
336  }
337 #endif
338  (void)posix_spawnattr_setflags(&attr, ps_flags);
339  posix_spawnattr_setbinpref_np(&attr, 1, &cpu, &copied);
340  ret = posix_spawnp(&p, rp->_args[0], &fileActions, &attr, rp->_args, NULL);
341  handle_posix_error(ret);
342  }
344  rz_run_free(rp);
345  posix_spawn_file_actions_destroy(&fileActions);
346  return p; // -1 ?
347 }
348 #endif // __APPLE__ && !__POWERPC__
349 
350 #if (!(__APPLE__ && !__POWERPC__))
351 typedef struct fork_child_data_t {
352  RzIO *io;
353  int bits;
354  const char *cmd;
355 } fork_child_data;
356 
357 static void fork_child_callback(void *user) {
358  fork_child_data *data = user;
359  char **argv = rz_str_argv(data->cmd, NULL);
360  if (!argv) {
361  exit(1);
362  }
363  rz_sys_clearenv();
364  RzRunProfile *rp = _get_run_profile(data->io, data->bits, argv);
365  if (!rp) {
367  exit(1);
368  }
369  trace_me();
370  rz_run_start(rp);
371  rz_run_free(rp);
373  exit(1);
374 }
375 
376 static int fork_and_ptraceme_for_unix(RzIO *io, int bits, const char *cmd) {
377  int ret, status, child_pid;
378  void *bed = NULL;
379  fork_child_data child_data;
380  child_data.io = io;
381  child_data.bits = bits;
382  child_data.cmd = cmd;
383  child_pid = rz_io_ptrace_fork(io, fork_child_callback, &child_data);
384  switch (child_pid) {
385  case -1:
386  perror("fork_and_ptraceme");
387  break;
388  case 0:
389  return -1;
390  default:
391  /* XXX: clean this dirty code */
392  do {
393  ret = waitpid(child_pid, &status, WNOHANG);
394  if (ret == -1) {
395  perror("waitpid");
396  return -1;
397  }
398  bed = rz_cons_sleep_begin();
399  usleep(100000);
400  rz_cons_sleep_end(bed);
401  } while (ret != child_pid && !rz_cons_is_breaked());
402  if (WIFSTOPPED(status)) {
403  eprintf("Process with PID %d started...\n", (int)child_pid);
404  } else if (WEXITSTATUS(status) == MAGIC_EXIT) {
405  child_pid = -1;
406  } else if (rz_cons_is_breaked()) {
407  kill(child_pid, SIGSTOP);
408  } else {
409  eprintf("Killing child process %d due to an error\n", (int)child_pid);
410  kill(child_pid, SIGSTOP);
411  }
412  break;
413  }
414  return child_pid;
415 }
416 #endif
417 
418 static int fork_and_ptraceme(RzIO *io, int bits, const char *cmd) {
419  // Before calling the platform implementation, append arguments to the command if they have been provided
420  char *_eff_cmd = io->args ? rz_str_appendf(strdup(cmd), " %s", io->args) : strdup(cmd);
421  int r = 0;
422 
423 #if __APPLE__ && !__POWERPC__
424  r = fork_and_ptraceme_for_mac(io, bits, _eff_cmd);
425 #else
426  r = fork_and_ptraceme_for_unix(io, bits, _eff_cmd);
427 #endif
428 
429  free(_eff_cmd);
430  return r;
431 }
432 #endif
433 
434 static bool __plugin_open(RzIO *io, const char *file, bool many) {
435  if (!strncmp(file, "waitfor://", 10)) {
436  return true;
437  }
438  if (!strncmp(file, "pidof://", 8)) {
439  return true;
440  }
441  return (!strncmp(file, "dbg://", 6) && file[6]);
442 }
443 
444 #include <rz_core.h>
445 static int get_pid_of(RzIO *io, const char *procname) {
446  RzCore *c = io->corebind.core;
447  if (c && c->dbg && c->dbg->cur) {
448  RzListIter *iter;
449  RzDebugPid *proc;
450  RzDebug *d = c->dbg;
451  RzList *pids = d->cur->pids(d, 0);
452  rz_list_foreach (pids, iter, proc) {
453  if (strstr(proc->path, procname)) {
454  eprintf("Matching PID %d %s\n", proc->pid, proc->path);
455  return proc->pid;
456  }
457  }
458  } else {
459  eprintf("Cannot enumerate processes\n");
460  }
461  return -1;
462 }
463 
464 static RzIODesc *__open(RzIO *io, const char *file, int rw, int mode) {
465  RzIOPlugin *_plugin;
466  RzIODesc *ret = NULL;
467  char uri[128];
468  if (!strncmp(file, "waitfor://", 10)) {
469  const char *procname = file + 10;
470  eprintf("Waiting for %s\n", procname);
471  while (true) {
472  int target_pid = get_pid_of(io, procname);
473  if (target_pid != -1) {
474  snprintf(uri, sizeof(uri), "dbg://%d", target_pid);
475  file = uri;
476  break;
477  }
478  rz_sys_usleep(100);
479  }
480  } else if (!strncmp(file, "pidof://", 8)) {
481  const char *procname = file + 8;
482  int target_pid = get_pid_of(io, procname);
483  if (target_pid == -1) {
484  eprintf("Cannot find matching process for %s\n", file);
485  return NULL;
486  }
487  snprintf(uri, sizeof(uri), "dbg://%d", target_pid);
488  file = uri;
489  }
490  if (__plugin_open(io, file, 0)) {
491  const char *pidfile = file + 6;
492  char *endptr;
493  int pid = (int)strtol(pidfile, &endptr, 10);
494  if (endptr == pidfile || pid < 0) {
495  pid = -1;
496  }
497  if (pid == -1) {
498  pid = fork_and_ptraceme(io, io->bits, file + 6);
499  if (pid == -1) {
500  return NULL;
501  }
502 #if __WINDOWS__
503  sprintf(uri, "w32dbg://%d", pid);
504  _plugin = rz_io_plugin_resolve(io, (const char *)uri, false);
505  if (!_plugin || !_plugin->open) {
506  return NULL;
507  }
508  ret = _plugin->open(io, uri, rw, mode);
509 #elif __APPLE__
510  sprintf(uri, "smach://%d", pid); // s is for spawn
511  _plugin = rz_io_plugin_resolve(io, (const char *)uri + 1, false);
512  if (!_plugin || !_plugin->open || !_plugin->close) {
513  return NULL;
514  }
515  ret = _plugin->open(io, uri, rw, mode);
516 #else
517  // TODO: use io_procpid here? faster or what?
518  sprintf(uri, "ptrace://%d", pid);
519  _plugin = rz_io_plugin_resolve(io, (const char *)uri, false);
520  if (!_plugin || !_plugin->open) {
521  return NULL;
522  }
523  ret = _plugin->open(io, uri, rw, mode);
524 #endif
525  } else {
526  sprintf(uri, "attach://%d", pid);
527  _plugin = rz_io_plugin_resolve(io, (const char *)uri, false);
528  if (!_plugin || !_plugin->open) {
529  return NULL;
530  }
531  ret = _plugin->open(io, uri, rw, mode);
532 #if __WINDOWS__
533  if (ret) {
534  RzCore *c = io->corebind.core;
535  c->dbg->plugin_data = ret->data;
536  }
537 #endif
538  }
539  if (ret) {
540  ret->plugin = _plugin;
541  ret->referer = strdup(file); // kill this
542  }
543  }
544  return ret;
545 }
546 
547 static int __close(RzIODesc *desc) {
548  int ret = -2;
549  eprintf("something went wrong\n");
550  if (desc) {
551  eprintf("trying to close %d with io_debug\n", desc->fd);
552  ret = -1;
553  }
555  return ret;
556 }
557 
559  .name = "debug",
560  .desc = "Attach to native debugger instance",
561  .license = "LGPL3",
562  .uris = "dbg://,pidof://,waitfor://",
563  .author = "pancake",
564  .version = "0.2.0",
565  .open = __open,
566  .close = __close,
567  .check = __plugin_open,
568  .isdbg = true,
569 };
570 #else
572  .name = "debug",
573  .desc = "Debug a program or pid. (NOT SUPPORTED FOR THIS PLATFORM)",
574 };
575 #endif
576 
577 #ifndef RZ_PLUGIN_INCORE
579  .type = RZ_LIB_TYPE_IO,
580  .data = &rz_io_plugin_debug,
582 };
583 #endif
si
static ut32 cpu[32]
Definition: analysis_or1k.c:21
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
const char * desc
Definition: bin_vsf.c:19
int bits(struct state *s, int need)
Definition: blast.c:72
static RzNumCalcValue expr(RzNum *, RzNumCalc *, int)
Definition: calc.c:167
RZ_API void * rz_cons_sleep_begin(void)
Definition: cons.c:443
RZ_API bool rz_cons_is_breaked(void)
Definition: cons.c:373
RZ_API void rz_cons_sleep_end(void *user)
Definition: cons.c:450
#define RZ_API
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
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
uint32_t ut32
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
static char * rp[]
Definition: i8080dis.c:36
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 __close(RzIODesc *fd)
Definition: io_bfdbg.c:130
RZ_API RzLibStruct rizin_plugin
Definition: io_debug.c:578
RzIOPlugin rz_io_plugin_debug
Definition: io_debug.c:571
const char int mode
Definition: ioapi.h:137
snprintf
Definition: kernel.h:364
sprintf
Definition: kernel.h:365
void * p
Definition: libc.cpp:67
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
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
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")
static const char struct stat static buf struct stat static buf static vhangup int status
Definition: sflib.h:145
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid ptrace
Definition: sflib.h:57
@ CPU_TYPE_I386
@ CPU_TYPE_ANY
#define FALSE
Definition: mybfd.h:102
#define eprintf(x, y...)
Definition: rlcc.c:7
@ RZ_DEBUG_REASON_NEW_PID
Definition: rz_debug.h:105
RZ_API bool rz_file_rm(const char *file)
Definition: file.c:865
RZ_API RzIOPlugin * rz_io_plugin_resolve(RzIO *io, const char *filename, bool many)
Definition: io_plugin.c:54
@ RZ_LIB_TYPE_IO
Definition: rz_lib.h:69
RZ_API void rz_run_free(RzRunProfile *r)
Definition: run.c:122
RZ_API RzRunProfile * rz_run_new(const char *str)
Definition: run.c:86
RZ_API bool rz_run_parsefile(RzRunProfile *p, const char *b)
Definition: run.c:468
RZ_API bool rz_run_parseline(RzRunProfile *p, const char *b)
Definition: run.c:479
RZ_API int rz_run_start(RzRunProfile *p)
Definition: run.c:1081
RZ_API int rz_run_config_env(RzRunProfile *p)
Definition: run.c:809
RZ_API bool rz_run_parse(RzRunProfile *pf, const char *profile)
Definition: run.c:103
RZ_API char * rz_str_appendf(char *ptr, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API int rz_str_arg_unescape(char *arg)
Definition: str.c:2443
RZ_API char ** rz_str_argv(const char *str, int *_argc)
Definition: str.c:2509
RZ_API void rz_str_argv_free(char **argv)
Definition: str.c:2633
RZ_API char RZ_API void rz_sys_backtrace(void)
Print the backtrace at the point this function is called from.
Definition: sys.c:265
RZ_API int rz_sys_clearenv(void)
Clean all environment variables in the calling process.
Definition: sys.c:346
RZ_API int rz_sys_usleep(int usecs)
Sleep for usecs microseconds.
Definition: sys.c:317
RZ_API int rz_sys_signal(int sig, void(*handler)(int))
Definition: sys.c:178
#define rz_sys_perror(x)
Definition: rz_types.h:336
#define RZ_SYS_DIR
Definition: rz_types.h:218
#define RZ_VERSION
Definition: rz_version.h:8
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
static int
Definition: sfsocketcall.h:114
#define O_WRONLY
Definition: sftypes.h:487
#define PT_TRACE_ME
Definition: sftypes.h:557
#define O_RDONLY
Definition: sftypes.h:486
int pid_t
Definition: sftypes.h:38
@ PTRACE_TRACEME
Definition: sftypes.h:556
int sigset_t
Definition: sftypes.h:63
#define d(i)
Definition: sha256.c:44
#define c(i)
Definition: sha256.c:43
W32DbgWParams params
Definition: w32dbg_wrap.h:36
PROCESS_INFORMATION pi
Definition: w32dbg_wrap.h:40
int(* func)(void *)
Definition: w32dbg_wrap.h:26
w32dbg_wrap_req type
Definition: w32dbg_wrap.h:18
Definition: gzappend.c:170
void * core
Definition: rz_bind.h:31
RzDebug * dbg
Definition: rz_core.h:329
int(* detach)(RzDebug *dbg, int pid)
Definition: rz_debug.h:373
bool create_new_console
Definition: rz_debug.h:268
struct rz_debug_plugin_t * cur
Definition: rz_debug.h:295
void * data
Definition: rz_io.h:102
struct rz_io_plugin_t * plugin
Definition: rz_io.h:103
char * referer
Definition: rz_io.h:100
const char * name
Definition: rz_io.h:115
const char * version
Definition: rz_io.h:117
int(* close)(RzIODesc *desc)
Definition: rz_io.h:132
RzIODesc *(* open)(RzIO *io, const char *, int perm, int mode)
Definition: rz_io.h:127
Definition: rz_io.h:59
RzCoreBind corebind
Definition: rz_io.h:92
char * runprofile
Definition: rz_io.h:81
char * envprofile
Definition: rz_io.h:82
char * args
Definition: rz_io.h:89
int bits
Definition: rz_io.h:62
struct Proc * proc
#define STDOUT_FILENO
Definition: private.h:41
#define STDERR_FILENO
Definition: private.h:45
#define STDIN_FILENO
Definition: private.h:37
@ W32_CALL_FUNC
Definition: w32dbg_wrap.h:14
int w32dbg_wrap_wait_ret(W32DbgWInst *inst)
Definition: w32dbg_wrap.c:71
#define w32dbgw_err(inst)
Definition: w32dbg_wrap.h:46
#define w32dbgw_ret(inst)
Definition: w32dbg_wrap.h:45
DWORD * HANDLE
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
DWORD