mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 00:55:59 +00:00
Update SDB and remove wip sdb helpers from core-anal
This commit is contained in:
parent
9c6dc4ce2f
commit
f8586e686d
@ -856,7 +856,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETPREF("asm.flagsinbytes", "false", "Display flags inside the bytes space");
|
||||
SETPREF("asm.cmtflgrefs", "true", "Show comment flags associated to branch referece");
|
||||
SETPREF("asm.cmtright", "true", "Show comments at right of disassembly if they fit in screen");
|
||||
SETI("asm.cmtcol", 80, "Align comments at column 60");
|
||||
SETI("asm.cmtcol", 70, "Align comments at column 60");
|
||||
SETPREF("asm.comments", "true", "Show comments in disassembly view");
|
||||
SETPREF("asm.decode", "false", "Use code analysis as a disassembler");
|
||||
SETPREF("asm.indent", "false", "Indent disassembly based on reflines depth");
|
||||
|
@ -30,25 +30,6 @@ static ut64 sdb_array_get_closer_num (Sdb *db, const char *key, ut64 addr) {
|
||||
#define Fmin(x) "min"
|
||||
#define Fmax(x) "max"
|
||||
|
||||
// TODO: move into sdb, and use CAS
|
||||
static int sdb_num_min(Sdb *db, const char *k, ut64 n) {
|
||||
ut64 a = sdb_num_get (db, k, NULL);
|
||||
if (n<a || !a) {
|
||||
sdb_num_set (db, k, n, 0);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sdb_num_max(Sdb *db, const char *k, ut64 n) {
|
||||
ut64 a = sdb_num_get (db, k, NULL);
|
||||
if (n>a || !a) {
|
||||
sdb_num_set (db, k, n, 0);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bbAdd (Sdb *db, ut64 from, ut64 to, ut64 jump, ut64 fail) {
|
||||
ut64 last, addr = sdb_array_get_closer_num (db, "bbs", from);
|
||||
int add = 1;
|
||||
@ -75,8 +56,8 @@ eprintf ("ADD NEW BB %llx\n", from);
|
||||
sdb_array_set_num (db, FbbTo(from), 0, jump, 0);
|
||||
if (fail != UT64_MAX)
|
||||
sdb_array_set_num (db, FbbTo(from), 1, fail, 0);
|
||||
sdb_num_min (db, "min", from);
|
||||
sdb_num_max (db, "max", to);
|
||||
sdb_num_min (db, "min", from, 0);
|
||||
sdb_num_max (db, "max", to, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -304,7 +285,6 @@ static int analyzeFunction (RCore *core, ut64 addr) {
|
||||
// analyze next calls
|
||||
{
|
||||
char *c, *calls = sdb_get (db, "calls", NULL);
|
||||
int first = 1;
|
||||
sdb_aforeach (c, calls) {
|
||||
ut64 addr = sdb_atoi (c);
|
||||
r_cons_printf ("a2f @ 0x%"PFMT64x"\n", addr);
|
||||
|
@ -1 +1 @@
|
||||
#define SDB_VERSION "0.9.1"
|
||||
#define SDB_VERSION "0.9.2"
|
||||
|
@ -118,6 +118,8 @@ int sdb_num_set (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
int sdb_num_add (Sdb *s, const char *key, ut64 v, ut32 cas);
|
||||
ut64 sdb_num_inc (Sdb* s, const char *key, ut64 n, ut32 cas);
|
||||
ut64 sdb_num_dec (Sdb* s, const char *key, ut64 n, ut32 cas);
|
||||
int sdb_num_min (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
int sdb_num_max (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
|
||||
typedef int (*SdbForeachCallback)(void *user, const char *k, const char *v);
|
||||
int sdb_foreach (Sdb* s, SdbForeachCallback cb, void *user);
|
||||
|
@ -8,7 +8,7 @@ VAPIDIR=$(PFX)/share/vala/vapi/
|
||||
MANDIR=${PFX}/share/man/man1
|
||||
MKDIR=mkdir
|
||||
|
||||
all: src/sdb-version.h
|
||||
all: pkgconfig src/sdb-version.h
|
||||
${MAKE} -C src
|
||||
${MAKE} -C memcache
|
||||
ifneq (${HAVE_VALA},)
|
||||
@ -16,10 +16,13 @@ ifneq (${HAVE_VALA},)
|
||||
cd ${VALADIR}/types && ${MAKE}
|
||||
endif
|
||||
|
||||
.PHONY: test sdb.js
|
||||
.PHONY: test sdb.js pkgconfig
|
||||
test:
|
||||
${MAKE} -C test
|
||||
|
||||
pkgconfig:
|
||||
-${MAKE} -C pkgconfig
|
||||
|
||||
src/sdb-version.h:
|
||||
echo '#define SDB_VERSION "${SDBVER}"' > src/sdb-version.h
|
||||
|
||||
@ -57,9 +60,10 @@ install-dirs:
|
||||
INCFILES=src/sdb.h src/sdb-version.h src/cdb.h src/ht.h src/types.h
|
||||
INCFILES+=src/ls.h src/cdb_make.h src/buffer.h src/config.h
|
||||
|
||||
install: install-dirs
|
||||
install: pkgconfig install-dirs
|
||||
$(INSTALL_MAN) src/sdb.1 ${MANDIR}
|
||||
$(INSTALL_LIB) src/libsdb.${SOEXT} ${PFX}/lib
|
||||
$(INSTALL_DATA) src/libsdb.a ${PFX}/lib
|
||||
-if [ "$(SOEXT)" != "$(SOVER)" ]; then \
|
||||
cd $(PFX)/lib ; \
|
||||
mv libsdb.$(SOEXT) libsdb.$(SOVER) ; \
|
||||
@ -71,8 +75,8 @@ fi
|
||||
$(INSTALL_DATA) memcache/mcsdb.h ${PFX}/include/sdb
|
||||
$(INSTALL_PROGRAM) memcache/mcsdbd ${PFX}/bin
|
||||
$(INSTALL_PROGRAM) memcache/mcsdbc ${PFX}/bin
|
||||
$(INSTALL_DATA) ${VALADIR}/sdb.pc ${PFX}/lib/pkgconfig
|
||||
$(INSTALL_DATA) ${VALADIR}/mcsdb.pc ${PFX}/lib/pkgconfig
|
||||
$(INSTALL_DATA) pkgconfig/sdb.pc ${PFX}/lib/pkgconfig
|
||||
$(INSTALL_DATA) pkgconfig/mcsdb.pc ${PFX}/lib/pkgconfig
|
||||
ifneq (${HAVE_VALA},)
|
||||
$(INSTALL_DATA) ${VALADIR}/sdb.vapi ${PFX}/share/vala/vapi
|
||||
$(INSTALL_DATA) ${VALADIR}/mcsdb.vapi ${PFX}/share/vala/vapi
|
||||
|
@ -1,7 +1,7 @@
|
||||
DESTDIR?=
|
||||
PREFIX?=/usr
|
||||
|
||||
SDBVER=0.9.1
|
||||
SDBVER=0.9.2
|
||||
|
||||
INSTALL?=install
|
||||
|
||||
|
@ -61,3 +61,17 @@ SDB_API int sdb_bool_get(Sdb *db, const char *str, ut32 *cas) {
|
||||
const char *b = sdb_const_get (db, str, cas);
|
||||
return (!strcmp (b, "1") || !strcmp (b, "true"))? 1: 0;
|
||||
}
|
||||
|
||||
SDB_API int sdb_num_min(Sdb *db, const char*k, ut64 n, ut32 cas) {
|
||||
const char* a = sdb_const_get (db, k, NULL);
|
||||
if (!a || n<sdb_atoi (a))
|
||||
return sdb_num_set (db, k, n, cas);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDB_API int sdb_num_max(Sdb *db, const char*k, ut64 n, ut32 cas) {
|
||||
const char* a = sdb_const_get (db, k, NULL);
|
||||
if (!a || n>sdb_atoi (a))
|
||||
return sdb_num_set (db, k, n, cas);
|
||||
return 0;
|
||||
}
|
||||
|
@ -118,6 +118,8 @@ int sdb_num_set (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
int sdb_num_add (Sdb *s, const char *key, ut64 v, ut32 cas);
|
||||
ut64 sdb_num_inc (Sdb* s, const char *key, ut64 n, ut32 cas);
|
||||
ut64 sdb_num_dec (Sdb* s, const char *key, ut64 n, ut32 cas);
|
||||
int sdb_num_min (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
int sdb_num_max (Sdb* s, const char *key, ut64 v, ut32 cas);
|
||||
|
||||
typedef int (*SdbForeachCallback)(void *user, const char *k, const char *v);
|
||||
int sdb_foreach (Sdb* s, SdbForeachCallback cb, void *user);
|
||||
|
Loading…
x
Reference in New Issue
Block a user