FYI, this is the hack in r1 (dbg/regs.h)

#if __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __APPLE__
#define PTRACE_KILL PT_KILL
#define PTRACE_DETACH PT_DETACH
#define PTRACE_TRACEME PT_TRACE_ME
#define PTRACE_ATTACH PT_ATTACH
#define PTRACE_SYSCALL PT_SYSCALL
#define PTRACE_CONT PT_CONTINUE
#define PTRACE_PEEKTEXT PT_READ_D
#define PTRACE_POKEDATA PT_WRITE_D
#define PTRACE_SINGLESTEP PT_STEP
#if __POWERPC__
#define PTRACE_GETREGS PT_READ_U
#define PTRACE_SETREGS PT_WRITE_U
#define PTRACE_GETFPREGS PT_READ_U // XXX
#define PTRACE_SETFPREGS PT_WRITE_U // XXX
#else
#define PTRACE_GETREGS PT_GETREGS
#define PTRACE_SETREGS PT_SETREGS
#define PTRACE_GETFPREGS PT_GETFPREGS
#define PTRACE_SETFPREGS PT_SETFPREGS
#endif
#endif

#if __linux__ && __powerpc__
#define PTRACE_GETREGS PPC_PTRACE_GETREGS
#define PTRACE_SETREGS PPC_PTRACE_SETREGS
#define PTRACE_GETFPREGS PPC_PTRACE_GETFPREGS
#define PTRACE_SETFPREGS PPC_PTRACE_SETFPREGS
#endif

#if __sun
/* TODO: replace with dtrace? */
#define PTRACE_KILL 8
#define PTRACE_DETACH 0
#define PTRACE_TRACEME 0
#define PTRACE_ATTACH 0
#define PTRACE_SYSCALL 0
#define PTRACE_CONT     7
#define PTRACE_PEEKTEXT 2
#define PTRACE_POKEDATA 6
#define PTRACE_GETREGS 3
#define PTRACE_SETREGS 3
#define PTRACE_GETFPREGS 3
#define PTRACE_SETFPREGS 3
#define PTRACE_SINGLESTEP 9
#endif


On 04/01/11 19:01, pancake wrote:
yo

On 03/31/11 23:22, Edd Barrett wrote:
Hi,

I would like to run radare on OpenBSD. I see that it is not yet ready, needs a systcl interface defined (simple but tedious). I guess there may be other bits
missing too.

Cool, portability to BSD was one of our priorities for 0.8.
why do you need from sysctl? hope it's not a joke #aprilfools? :P
Here are some patches to actually get it building anyway:
https://github.com/vext01/ports-wip/tree/master/devel/radare/patches

Cheers

Finally I got some spare time to review the patches... :) what a stressful day!

** patch-binr_radare2_Makefile:

There's a TH_LIBS var in libr/config.mk that should do this job. in fact i plan to remove all threading stuff in r2.. it's not used anywhere now (I was using it in r2 -t to load code analysis in background) but the optimizations we are doing for 0.8 will make this unnecessary. Code analysis is fast enought to not complicate
the code with more threading stuff.

** patch-libr_core_core_c

signal.h is not a portable include. I will commit this but inside a #if __UNIX__ block. Thanks.

** patch-libr_debug_p_debug_native_c

If you check r1 source code you'll see that the implementation of the debugger in BSD is based on redefines of the linux ptrace enums (PTRACE_*), this is the same you are doing here. This is ok, but as long as you are doing the same changes in io_ptrace patch I would suggest you to do this change in a .h shared by both libraries. This way the portability to netbsd and freebsd (and gnu/kfreebsd?) will be simpler. Can you do this change?

** patch-libr_io_p_io_debug_c

This is ok, as long as this will be required for other BSD systems to make fork+ptraceme work. I'm going to commit this change, but using __BSD__ instead of the specific __OpenBSD__

** patch-libr_io_p_io_ptrace_c

As mentioned earlier in this mail I think this change must be done once libr/include/r_debug_internal.h ?
so you dont have of ifdef every call to ptrace(). Can you do this change?

I'm gonna review the other PTRACE_ redefinition patch...so .. maybe i can do I better solution and
you can try it for me (i have no BSD in any box of mine atm)

--pancake
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org


_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to