mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-29 16:10:52 +00:00
Fix debugger build for SerenityOS
This commit is contained in:
parent
620c3fa3dd
commit
c15315e0e3
@ -25,8 +25,10 @@ R_LIB_VERSION_HEADER(r_debug);
|
||||
|
||||
/* hack to fix compilation of debugger on BSD systems */
|
||||
/* This needs some testing (netbsd, freebsd, openbsd, kfreebsd) */
|
||||
#if __BSD__ || defined(__serenity__)
|
||||
#if __BSD__
|
||||
#include <machine/reg.h>
|
||||
#endif
|
||||
|
||||
/* hakish hack to hack the openbsd/sparc64 hack */
|
||||
#undef reg
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <r_lib.h>
|
||||
#include <r_core.h>
|
||||
|
||||
#if __linux__ || __APPLE__ || __WINDOWS__ || __NetBSD__ || __KFBSD__ || __OpenBSD__
|
||||
#if __linux__ || __APPLE__ || __WINDOWS__ || __NetBSD__ || __KFBSD__ || __OpenBSD__ || __serenity__
|
||||
#define DEBUGGER_SUPPORTED 1
|
||||
#else
|
||||
#define DEBUGGER_SUPPORTED 0
|
||||
@ -192,7 +192,11 @@ static void trace_me(void) {
|
||||
#if __APPLE__
|
||||
r_sys_signal (SIGTRAP, SIG_IGN); //NEED BY STEP
|
||||
#endif
|
||||
#if __APPLE__ || __BSD__
|
||||
#if __serenity__
|
||||
if (ptrace (PT_TRACE_ME, 0, 0, 0) != 0) {
|
||||
r_sys_perror ("ptrace-traceme");
|
||||
}
|
||||
#elif __APPLE__ || __BSD__
|
||||
/* we can probably remove this #if..as long as PT_TRACE_ME is redefined for OSX in r_debug.h */
|
||||
r_sys_signal (SIGABRT, inferior_abort_handler);
|
||||
if (ptrace (PT_TRACE_ME, 0, 0, 0) != 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2008-2021 - pancake */
|
||||
/* radare - LGPL - Copyright 2008-2022 - pancake */
|
||||
|
||||
#include <r_userconf.h>
|
||||
#include <r_util.h>
|
||||
@ -7,7 +7,7 @@
|
||||
#include <r_cons.h>
|
||||
#include <r_debug.h>
|
||||
|
||||
#if DEBUGGER && (__linux__ || __BSD__)
|
||||
#if DEBUGGER && (__linux__ || __BSD__ || defined(__serenity__))
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
@ -54,7 +54,7 @@ static int __waitpid(int pid) {
|
||||
|
||||
#define debug_read_raw(io,x,y) r_io_ptrace((io), PTRACE_PEEKTEXT, (x), (void *)(y), R_PTRACE_NODATA)
|
||||
#define debug_write_raw(io,x,y,z) r_io_ptrace((io), PTRACE_POKEDATA, (x), (void *)(y), (r_ptrace_data_t)(z))
|
||||
#if __OpenBSD__ || __NetBSD__ || __KFBSD__
|
||||
#if __OpenBSD__ || __NetBSD__ || __KFBSD__ || defined(__serenity__)
|
||||
typedef int ptrace_word; // int ptrace(int request, pid_t pid, caddr_t addr, int data);
|
||||
#else
|
||||
typedef size_t ptrace_word; // long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2014-2021 - pancake */
|
||||
/* radare - LGPL - Copyright 2014-2022 - pancake */
|
||||
|
||||
#include <r_userconf.h>
|
||||
#include <r_io.h>
|
||||
@ -264,13 +264,11 @@ static bool __plugin_open(RIO *io, const char *file, bool many) {
|
||||
}
|
||||
|
||||
static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
int ret, pid = r_sys_getpid ();
|
||||
if (r_sandbox_enable (0)) {
|
||||
return NULL;
|
||||
}
|
||||
io->va = true; // nop
|
||||
ret = update_self_regions (io, pid);
|
||||
if (ret) {
|
||||
int pid = r_sys_getpid ();
|
||||
if (update_self_regions (io, pid)) {
|
||||
return r_io_desc_new (io, &r_io_plugin_self,
|
||||
file, rw, mode, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user