Add test-rax2.sh script

This commit is contained in:
pancake 2014-05-13 17:32:01 +02:00
parent 6332b237c1
commit 31619ca208
4 changed files with 62 additions and 15 deletions

View File

@ -77,9 +77,8 @@ static int rax (char *str, int len, int last) {
ut8 *buf;
char *p, out_mode = (flags&128)? 'I': '0';
int i;
if (!(flags&4) || !len)
if (!(flags & 4) || !len)
len = strlen (str);
if ((flags & 4))
goto dotherax;
if (*str=='-') {

20
binr/rax2/test-rax2.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
echo "Testing echo... "
O=`echo hello | ./rax2 -S | ./rax2 -s`
if [ "$O" = hello ]; then
echo OK
else
echo FAIL
fi
echo "Testing cat..."
./rax2 -S <rax2 | ./rax2 -s > .rax2
A=`rahash2 -a md5 rax2 | awk '{ print $4}'`
B=`rahash2 -a md5 .rax2 | awk '{ print $4}'`
if [ "$A" = "$B" ]; then
echo OK
else
echo FAIL
fi
rm -f .rax2

22
doc/io Normal file
View File

@ -0,0 +1,22 @@
How IO should work
==================
* Maps
Used to select fd. Mapaddr..size
* Sections
Used to specify vaddr<->paddr
Manually selecting fd is still valid and it should override maps fdselection. This is.. We need a way to tell r2 to view one fd or all of them. In case of having two files mapped on the same address space we will select the last opened.
The base address is used to reallocate all vaddr offsets.
Reading/writing ops should be done in a loop checking for the section boundaries.
The sections must be asociated to a file, but we should be able to display/use them all in case of having non forced fd. This is, when not having overlapped files in memory.
The write ops should only obey to the global io configuration and ignore the section permissions (maybe just throw a warning?)
Atm sections are dupped in io and bin. We should merge them. Maybe using sdb, so we just reuse it

View File

@ -22,16 +22,16 @@ static void find_refs(RCore *core, const char *glob) {
/* TODO: Move into cmd_anal() */
static void var_help(char ch) {
const char *kind = (ch=='v')?"locals":"args";
if (ch) {
eprintf ("|Usage: af%c [idx] [type] [name]\n", ch);
eprintf ("| af%c ; list function %s\n", ch, kind);
eprintf ("| af%c 12 int buffer[3] ; add %s at index, type and name\n", ch, kind);
eprintf ("| af%c-12 ; delete %s at index 12\n", ch, kind);
eprintf ("| af%cs [index] ([offset]) ; register 'set' action\n", ch);
eprintf ("| af%cg [index] ([offset]) ; register 'get' action\n", ch);
eprintf ("|See also: afa? afv? -- add arguments and locals\n");
} else {
eprintf ("See afv? and afa?\n");
if (ch=='a' || ch=='A' || ch=='v') {
eprintf ("|Usage: af%c [idx] [type] [name]\n", ch);
eprintf ("| af%c ; list function %s\n", ch, kind);
eprintf ("| af%c 12 int buffer[3] ; add %s at index, type and name\n", ch, kind);
eprintf ("| af%c-12 ; delete %s at index 12\n", ch, kind);
eprintf ("| af%cs [index] ([offset]) ; register 'set' action\n", ch);
eprintf ("| af%cg [index] ([offset]) ; register 'get' action\n", ch);
eprintf ("|See also: afa? afv? -- add arguments and locals\n");
} else {
eprintf ("See afv? and afa?\n");
}
// TODO: fastrg == 'A'
@ -73,7 +73,7 @@ static int var_cmd(RCore *core, const char *str) {
r_anal_var_list (core->anal, fcn, 0, 0);
goto end;
case '?':
var_help(*str);
var_help (*str);
goto end;
case '.':
r_anal_var_list (core->anal, fcn, core->offset, 0);
@ -119,10 +119,16 @@ static int var_cmd(RCore *core, const char *str) {
p3[0]='\0';
p3=p3+1;
}
char kind = *str;
// p2 - name of variable
r_anal_var_add (core->anal, fcn->addr, core->offset, delta, scope,
char *type = "int";
int size = 4;
char *name = "num";
r_anal_var_add (core->anal,
fcn->addr,
scope, delta, kind, type, size, name);
//r_anal_str_to_type (core->anal, p)
NULL, p3? atoi (p3): 0, p2);
//NULL, p3? atoi (p3): 0, p2);
} else var_help (*str);
break;
default: