* Implement basic register profile for OpenBSD

native debugger backend.
* Fix make symstall in BSD systems
  - PWD var looks like a linuxism
This commit is contained in:
pancake 2011-04-02 20:03:00 +02:00
parent 2810f68d65
commit 075b495a5c
6 changed files with 39 additions and 3 deletions

View File

@ -1,6 +1,7 @@
include config-user.mk
include global.mk
PWD=`pwd`
REMOTE=radare.org:/srv/http/radareorg/get/beta
all: plugins.cfg

View File

@ -1,4 +1,5 @@
include ../config-user.mk
PWD=`pwd`
.PHONY: all clean install install-symlink deinstall uninstall mrproper
@ -20,6 +21,8 @@ install:
install-symlink:
mkdir -p ${PFX}/bin
echo ${PWD}
echo ${PFX}
for a in ${BINS} ; do ln -fs ${PWD}/$$a/$$a ${PFX}/bin/$$a ; done
ln -fs ${PWD}/rarc2/rarc2-tool ${PFX}/bin/rarc2-tool
-ln -fs ${PFX}/bin/radare2 ${PFX}/bin/r2

View File

@ -3,6 +3,7 @@ include config.mk
PREFIX?=${PWD}/../prefix
PFX=${DESTDIR}${PREFIX}
PWD=`pwd`
#PREFIX=${PFX}
# Libraries

View File

@ -844,9 +844,9 @@ static void cmd_reg(RCore *core, const char *str) {
break;
case 'p':
if (!str[1]) {
if (core->dbg->reg->reg_profile) {
if (core->dbg->reg->reg_profile_str) {
//core->anal->reg = core->dbg->reg;
r_cons_printf ("%s\n", core->dbg->reg->reg_profile);
r_cons_printf ("%s\n", core->dbg->reg->reg_profile_str);
//r_cons_printf ("%s\n", core->anal->reg->reg_profile);
} else eprintf ("No register profile defined. Try 'dr.'\n");
} else r_reg_set_profile (core->dbg->reg, str+2);

View File

@ -197,6 +197,7 @@ static int r_debug_native_step(RDebug *dbg) {
ut32 addr = 0; /* should be eip */
//ut32 data = 0;
//printf("NATIVE STEP over PID=%d\n", pid);
addr = r_debug_reg_get (dbg, "pc");
ret = ptrace (PTRACE_SINGLESTEP, pid, addr, 0); //addr, data);
if (ret == -1) {
perror ("native-singlestep");
@ -392,6 +393,35 @@ static const char *r_debug_native_reg_profile() {
"gpr ctr .32 148 0\n"
"gpr mq .32 152 0\n"
"gpr vrsave .32 156 0\n"
);
#elif __i386__ && __OpenBSD__
return strdup (
"=pc eip\n"
"=sp esp\n"
"=bp ebp\n"
"=a0 eax\n"
"=a1 ebx\n"
"=a2 ecx\n"
"=a3 edi\n"
// TODO: add ax, al, ah, ...
"gpr eax .32 0 0\n"
"gpr ecx .32 4 0\n"
"gpr edx .32 8 0\n"
"gpr ebx .32 12 0\n"
"gpr esp .32 16 0\n"
"gpr ebp .32 20 0\n"
"gpr esi .32 24 0\n"
"gpr edi .32 28 0\n"
"gpr eip .32 32 0\n"
"gpr eflags .32 36 0 c1p.a.zstido.n.rv\n"
"seg cs .32 40 0\n"
"seg ss .32 44 0\n"
"seg ds .32 48 0\n"
"seg es .32 52 0\n"
"seg fs .32 56 0\n"
"seg gs .32 60 0\n"
// TODO: implement flags like in linux --those flags are wrong
);
#elif __i386__
return strdup (

View File

@ -5,8 +5,9 @@
#include <r_io.h>
#include <r_lib.h>
#include <r_cons.h>
#include <r_debug.h>
#if __linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__
#if __linux__ || __BSD__
#include <sys/ptrace.h>
#include <sys/types.h>