Fix help messages, macro call and implement temporary seek syntax (x@+3)

This commit is contained in:
pancake 2012-07-12 03:55:09 +02:00
parent c814a9f67a
commit 99774c723f
7 changed files with 33 additions and 35 deletions

19
TODO
View File

@ -7,6 +7,11 @@
====[[ 0.9.1 ]]====
* Source debugging or gtfo
- integration with rabin2 -d
* sC not working
* get cparse ftw
* show analized functions in 'aa' -> discuss
Discuss
Add $EDITOR alias for file open(read/write) -
@ -17,13 +22,8 @@ Add $EDITOR alias for file open(read/write) -
* refactor vmenus.c -> refresh function must be redefined for each menu
EVAL
? flag -flag2 => fails because of the ' ' before the minus sign
? flag-flag2 works
// show hints for
0x100005eca ff2540130000 jmp qword [rip+0x1340] [1]
* Source debugging or gtfo
* Fix ?-
* Register diff colorization is broken
* bar for cursor?
@ -31,8 +31,6 @@ EVAL
- show number of occurrences for each byte
- maybe in 'ad' command, analyze data
* highlight search hits in hexdump
* Implement s/x
* sC not working
* Implement debugger backtrace properly
* _ -> write string does not obeys the cursor
* rep+ret instruction (f3c3) should be identified as RET
@ -46,7 +44,6 @@ EVAL
* Fix iterators for r_macro (test only?)
- search for antidebug/disasm tricks opcodes
- allows to find interesting points to analyze
* get cparse ftw
* use slices for r_list_iter primitives
BUGS:
@ -69,10 +66,8 @@ BUGS:
* rabin2 -z /dev/sda1 TAKES TOO LONG. opening r2 /tmp/fs is SLOW as shit.
===[ 0.9.2 ]===
* Embed Luvit?
* Add support for classes (useful for c++, dex, objc, ...)
- command to add new classes
* show analized functions in 'aa'
* Tracing support for the debugger
- "e cmd.trace=dr=;.dr*;pd 2@eip"
- dca sym.main imp.printf
@ -138,10 +133,6 @@ earada
------
* Add print support for bitfields (pm b...)
* Fix io_haret memory dump
* r_socket (already done?)
- Add SSL support
- http API in r_socket module
- allow to get/post data/files with continue on plain/ssl
* refactor rap and raps
* remove all uses of alloca() // mingw and grep reports them all :)
* typedef all function pointers, like in r_bp

View File

@ -203,8 +203,9 @@ R_API int r_cmd_macro_cmd_args(RCmdMacro *mac, const char *ptr, const char *args
if (ptr[j]=='$') {
if (ptr[j+1]>='0' && ptr[j+1]<='9') {
int wordlen;
const char *word = r_str_word_get0 (arg, ptr[j+1]-'0');
if (word) {
int w = ptr[j+1]-'0';
const char *word = r_str_word_get0 (arg, w);
if (word && *word) {
wordlen = strlen (word);
if ((i+wordlen+1) >= sizeof (cmd)) {
//free (arg);
@ -213,7 +214,7 @@ R_API int r_cmd_macro_cmd_args(RCmdMacro *mac, const char *ptr, const char *args
memcpy (cmd+i, word, wordlen+1);
i += wordlen-1;
j++;
}
} else eprintf ("Undefined argument %d\n", w);
} else
if (ptr[j+1]=='@') {
char off[32];

View File

@ -464,10 +464,7 @@ static void register_path (RList *l) {
}
static RList *recurse(RCore *core, RAnalBlock *from, RAnalBlock *dest) {
RList *ret;
RAnalBlock *bb;
ret = recurse_bb (core, from->jump, dest);
RList *ret = recurse_bb (core, from->jump, dest);
if (ret) register_path (ret);
ret = recurse_bb (core, from->fail, dest);
if (ret) register_path (ret);
@ -505,10 +502,10 @@ R_API RList* r_core_anal_graph_to(RCore *core, ut64 addr, int n) {
eprintf ("ROOT BB 0x%08"PFMT64x"\n", root->addr);
eprintf ("DEST BB 0x%08"PFMT64x"\n", dest->addr);
list = r_list_new ();
{
/* {
RList *ll = recurse (core, root, dest);
//r_list_append (list, ll);
}
r_list_append (list, ll);
} */
printf ("=> 0x%08"PFMT64x"\n", root->jump);
} else eprintf ("Unable to find source or destination basic block\n");
return list;

View File

@ -681,6 +681,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd) {
core->tmpseek = ptr? R_TRUE: R_FALSE;
if (ptr) {
ut64 tmpoff, tmpbsz, addr;
const char *offstr;
char *ptr2 = strchr (ptr+1, ':');
*ptr = '\0';
cmd = r_str_clean (cmd);
@ -691,13 +692,19 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd) {
r_core_block_size (core, r_num_math (core->num, ptr2+1));
}
addr = r_num_math (core->num, ptr+1);
offstr = r_str_trim_head (ptr+1);
addr = r_num_math (core->num, offstr);
if (isalpha (ptr[1]) && addr== 0) {
if (!r_flag_get (core->flags, ptr+1)) {
eprintf ("Invalid address (%s)\n", ptr+1);
return R_FALSE;
}
}
} else {
char ch = *offstr;
if (ch=='-' || ch=='+')
addr = core->offset+addr;
}
if (ptr[1]=='@') {
// TODO: remove temporally seek (should be done by cmd_foreach)
ret = r_core_cmd_foreach (core, cmd, ptr+2);

View File

@ -17,16 +17,15 @@ static int cmd_macro(void *data, const char *input) {
break;
case '?':
eprintf (
"Usage: (foo\\n..cmds..\\n)\n"
" Record macros grouping commands\n"
" (foo args,..,..) ; define a macro\n"
" (foo args,..,..)() ; define and call a macro\n"
"Usage: (foo args,cmd1,cmd2,..)\n"
" (foo args,..,..) ; define a macro\n"
" (foo args,..,..)() ; define and call a macro\n"
" (-foo) ; remove a macro\n"
" .(foo) ; to call it\n"
" () ; break inside macro\n"
" (* ; list all defined macros\n"
"Argument support:\n"
" (foo x y\\n$1 @ $2) ; define fun with args\n"
" (foo x y\\n$0 @ $1) ; define fun with args\n"
" .(foo 128 0x804800) ; call it with args\n"
"Iterations:\n"
" .(foo\\n() $@) ; define iterator returning iter index\n"
@ -53,11 +52,13 @@ static int cmd_macro(void *data, const char *input) {
buf[strlen(buf)-1]=0;
r_cmd_macro_add (&core->cmd->macro, buf);
if (mustcall) {
char *comma = strchr (buf, ',');
char *comma = strchr (buf, ' ');
if (!comma)
comma = strchr (buf, ',');
if (comma) {
*comma = ' ';
strcpy (comma+1, buf+mustcall);
//printf ("CALL (%s)\n", buf);
printf ("CALL (%s)\n", buf);
r_cmd_macro_call (&core->cmd->macro, buf);
} else eprintf ("Invalid syntax for macro\n");
}

View File

@ -111,7 +111,7 @@ static int cmd_print(void *data, const char *input) {
break;
case 'e': // entropy
{
char *p;
ut8 *p;
int psz, i = 0;
int fsz = core->file?core->file->size:0;
psz = fsz/core->blocksize;
@ -127,7 +127,7 @@ static int cmd_print(void *data, const char *input) {
break;
case 'p': // printable chars
{
char *p;
ut8 *p;
int psz, i = 0, j, k;
int fsz = core->file?core->file->size:0;
psz = fsz/core->blocksize;

View File

@ -167,6 +167,7 @@ static int cmd_seek(void *data, const char *input) {
" sa [[+-]a] [asz] ; seek asz (or bsize) aligned to addr\n"
" sf|sF ; seek next/prev scr.fkey\n"
" s/ DATA ; search for next occurrence of 'DATA'\n"
" s/x 9091 ; search for next occurrence of \\x90\\x91\n"
" sb ; seek aligned to bb start\n"
" sn ; seek to next opcode\n"
" sC str ; seek to comment matching given string\n"