Fix aarch64 gdbr profile and update sdb

This commit is contained in:
pancake 2014-05-12 17:07:27 +02:00
parent 547f7f5024
commit eeaa5ffd60
6 changed files with 38 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2012 - pancake */
/* radare - LGPL - Copyright 2009-2014 - pancake, defragger */
#include <r_asm.h>
#include <r_debug.h>
@ -267,6 +267,12 @@ static const char *r_debug_gdb_reg_profile(RDebug *dbg) {
);
} else if (dbg->bits == R_SYS_BITS_64) {
return strdup (
"=pc pc\n"
"=sp sp\n"
"=a0 r0\n"
"=a1 r1\n"
"=a2 r2\n"
"=a3 r3\n"
"gpr x0 .8 0 0\n"
"gpr x1 .8 8 0\n"
"gpr x2 .8 16 0\n"

View File

@ -95,6 +95,7 @@ char *sdb_get (Sdb*, const char *key, ut32 *cas);
const char *sdb_const_get (Sdb*, const char *key, ut32 *cas);
int sdb_set (Sdb*, const char *key, const char *data, ut32 cas);
int sdb_concat(Sdb *s, const char *key, const char *value, ut32 cas);
int sdb_uncat(Sdb *s, const char *key, const char *value, ut32 cas);
int sdb_add (Sdb* s, const char *key, const char *val, ut32 cas);
void sdb_list(Sdb*);
int sdb_sync (Sdb*);

View File

@ -259,15 +259,22 @@ next_quote:
if (sdb_isnum (val)) {
int op = *cmd;
if (*val=='-') {
op = '-';
if (*cmd == '-') {
op = '+';
} else {
op = '-';
}
d = sdb_atoi (val+1);
} else d = sdb_atoi (val);
if (op=='+')
sdb_num_inc (s, cmd+1, d, 0);
else
sdb_num_dec (s, cmd+1, d, 0);
else sdb_num_dec (s, cmd+1, d, 0);
} else {
sdb_concat (s, cmd+1, val, 0);
if (*cmd=='+') {
sdb_concat (s, cmd+1, val, 0);
} else {
sdb_uncat (s, cmd+1, val, 0);
}
}
} else {
int base = sdb_num_base (sdb_const_get (s, cmd+1, 0));

View File

@ -231,6 +231,23 @@ SDB_API int sdb_unset (Sdb* s, const char *key, ut32 cas) {
return key? sdb_set (s, key, "", cas): 0;
}
// alias for '-key=str'.. '+key=str' concats
SDB_API int sdb_uncat(Sdb *s, const char *key, const char *value, ut32 cas) {
// remove 'value' from current key value.
// TODO: cas is ignored here
char *p, *v = sdb_get (s, key, NULL);
int vlen = strlen (value);
int mod = 0;
while ((p = strstr (v, value))) {
memmove (p, p+vlen, strlen (p+vlen)+1);
mod = 1;
}
if (mod)
sdb_set (s, key, v, 0);
free (v);
return 0;
}
SDB_API int sdb_concat(Sdb *s, const char *key, const char *value, ut32 cas) {
int ret, kl, vl;
const char *p;

View File

@ -95,6 +95,7 @@ char *sdb_get (Sdb*, const char *key, ut32 *cas);
const char *sdb_const_get (Sdb*, const char *key, ut32 *cas);
int sdb_set (Sdb*, const char *key, const char *data, ut32 cas);
int sdb_concat(Sdb *s, const char *key, const char *value, ut32 cas);
int sdb_uncat(Sdb *s, const char *key, const char *value, ut32 cas);
int sdb_add (Sdb* s, const char *key, const char *val, ut32 cas);
void sdb_list(Sdb*);
int sdb_sync (Sdb*);

View File

@ -157,7 +157,7 @@ SDB_API ut64 sdb_unow () {
}
SDB_API int sdb_isnum (const char *s) {
if (*s=='-') // || *s=='+')
if (*s=='-' || *s=='+')
return 1;
if (*s>='0' && *s<='9')
return 1;