Better paralelization of build system

This commit is contained in:
pancake 2012-10-04 01:20:00 +02:00
parent e8a601fe53
commit 3540924f40
49 changed files with 210 additions and 585 deletions

View File

@ -11,7 +11,7 @@ Contributors: (sorted by length)
================================
- Anton Bolotinksy
- Glyn Kennington
- @schrotthaufen
- schrotthaufen
- elektranox
- neuroflip
- rvalles

30
TODO
View File

@ -155,8 +155,34 @@ Assembler
- So one can change from one arch to another with a pointer
- Cool for defining ranges of memory
0.8: focus on debugger and UI
=============================
* r_io
- We need a way to get the underlying file which responds
to the read call (this way we can know which library
lives at a specified offset. (is this already done?)
* r_bin
- Find why objdump can find stripped symbols with objcopy (see /TODO)
* radare2
- Use r_bin with r_io to get symbols
- The offset to read will define the module to analyze and retrieve syms
- Import msdn doc as comments
* r_db
- Implement iterators r_db_next() and r_db_prev() (HIGH PRIO)
- Write test programs to ensure the data is stored correctly
* r_search
- The pattern finding functions are not following the design
of the rest of the library, it needs a redesign and code cleanup
(see bytepat.c)
- Implement radare/src/xrefs.c into r_search
- Add support to change the case sensitive of searchs (ignore case)
- This must be keyword-based. Not globally
- Sync vapi (r_search_regexp not implemented)
- Enable/disable nested hits? (discuss+ implement in parent app?)
- Just skip bytes until end of keyword
* Ranged/scrollable zoom mode
* AES/RSA Key finding
http://citp.princeton.edu/memory/code/ <- implement this stuff in r2

View File

@ -1,81 +0,0 @@
Decompiler for radare2 trackline
================================
Objectives
==========
- Name local variables argments and global vars (Cv ...)
- Common construct detection (if/switch/for/while/do)
- Enum detection/support (load from .h ?) #define /enum parse only
- Detect sign of variables (depending on the conditionals used)
- Change operations to ease reading ('\n' instead of 0xa.. sub<->add)
- Detect and propagate variable types
- Symbol recognition
Core (RAnal, RMeta, RBin, ...)
==============================
* Language: C
* Analyze opcodes
* Detect numeric sign
* Detect data type and size by analyzing the accesses
* Analyze conditionals (if () goto .., labels, ...)
* Support push+ret constructions
* Analyze function calls (fast/slowcall, parameters, data types, return values..)
* Define data types (as 'pm' structs (memory format string))
* Analyze common constructions
Plugin (Radare.Decompiler class)
================================
* Language: Vala
* Using visitor paradigm
* Bidirectional sync methods for core
- Caches data and code from the core
- Comments must be syncronized too
* Independent structure compared to core
* Optimize sequences of opcodes
* Optimize AST (remove unaccessible code, join nodes, ...)
* Polimorph operations to simplify reading (shl eax, 1 => eax *= 2)
* Remove stack-related operations
* Resolve and propagate data types
* Parse .h files in order to import function signatures, defines, enums, ..
* Support to decompile single function or full program
* Each node must have a to_string() method to serialize
* Indent resulting code
* Remove trash code
UI (Gtk+)
=========
* Language: Vala
* Implemented as a Gtk.Widget
* Walk along the decompiled program code
- change variable names (read/write value)
- go xrefs
Future
======
* Floating point support
* Support high-level language constructions (objective-C, gobject, c++, ...)
External linkz
==============
* http://www.pivotaltracker.com/
-------------8<-------------------------------------------- -- - - - - -
+-------------------+
| Plugin API design |
+-------------------+
public class RadareDecompiler.AST { }
public class RadareDecompiler.Node { }
public class RadareDecompiler.Function { }
public class RadareDecompiler.Variable { }
public class RadareDecompiler.Constant { }
public class RadareDecompiler.Conditional { }
public class RadareDecompiler.Enum { }
public class Radare.Decompiler {
public class Decompiler(RCore core) {
...
}
public void sync(bool write) { ... }
}

View File

@ -1,63 +0,0 @@
TODO for hackatons
==================
Inconcrete things to do
=======================
* Compile radare2 on many OS and platforms as possible
- Windows? 32/64 bits (mingw32, cygwin)
- OSX?
- Solaris? (-lsocket ..)
* Test w32 bins with rabin2, r2, ..
* Implement process launcher wrapper // anybody
- opens xterm and redirects stdin/stdout/stderr
- Allows to change chroot
- Allows to setup chroot
- Define uid/gid
- sleep before exec
- show pid before exec
* Write Vala applications
- Test the current .vapi files
- Add missing methods/classes in vapi files
- Examples can be found in swig/vapi/t
- Propose new APIs and usage
- Vala is a good way to express code
* Clean warnings
- Find missing function signatures in libr/include/.h
- R_APIfy those APIs (sync with vapi)
Concrete TODO points
====================
* r_io
- We need a way to get the underlying file which responds
to the read call (this way we can know which library
lives at a specified offset. (is this already done?)
* r_bin
- Find why objdump can find stripped symbols with objcopy (see /TODO)
* radare2
- Use r_bin with r_io to get symbols
- The offset to read will define the module to analyze and retrieve syms
- Import msdn doc as comments
* r_db
- Implement iterators r_db_next() and r_db_prev() (HIGH PRIO)
- Write test programs to ensure the data is stored correctly
* r_search
- The pattern finding functions are not following the design
of the rest of the library, it needs a redesign and code cleanup
(see bytepat.c)
- Implement radare/src/xrefs.c into r_search
- Add support to change the case sensitive of searchs (ignore case)
- This must be keyword-based. Not globally
- Sync vapi (r_search_regexp not implemented)
- Enable/disable nested hits? (discuss+ implement in parent app?)
- Just skip bytes until end of keyword

View File

@ -1,42 +0,0 @@
Current development fronts
==========================
33 decompilation -- we need better code analysis, but basic decompilation will be in 0.5
we will provide at some point a decompiler as a plugin (more news soon)
many enhacements and fixes are being done in the code analysis backend
29 bindiffing (graph) --
basicblock tree diffing should be implemented for 0.5
we need to fix ired's bdiff in order to have binary diffing
26 better code analysis -- pancake and nibble are working on this now, it's advancing
18 code emulation -- some work has been done in r_vm, but needs much more refactoring
do we need code emulation? how ? anal ? vm? eval?
13 radare scripting like in r1 -- please, report issues in mailing list or privmail
8 signature support -- formatstring not yet implemented, this will be helpful for code analysis
6 web interface -- r2w, somebody interested?
3 osx support -- more prio? x86-32 and x86-64 hardware required, volunteers? read doc/osx fmi
Full poll
=========
33 decompilation -- we need better code analysis, but basic decompilation will be in 0.5
29 bindiffing (graph) -- nibble is working on this too, pancake has some binary diffing in C
26 better code analysis -- nibble is mainly working on this now
25 windows support -- please report bugs, pancake will
22 gdb remote support -- not prioritary atm (volunteers?) linked to bochs/qemu
20 hardware breakpoints -- no plans for next release..will probably be in 0.6
18 code emulation -- some work has been done in r_vm, but needs much more refactoring
18 Debug programs in isolated environment -- this is simple issue, any volunteer?
14 threaded debugger -- some work will be done, but dont expect big changes
13 radare scripting like in r1 -- please, report issues in mailing list or privmail
13 dalvik (android) -- no plans, no hw, any volunteer? please ask for things to be done if you want to help on this
11 write support for RBin -- nibble will work on this, but code analysis is prioritary atm
11 bochs and qemu support -- very low priority, this depends on gdb support
9 pdb support -- any volunteer to convert pdb into radare script
9 RLine with autocompletion -- no plans atm, but this feature will come eventually
8 signature support -- DONE (volunteers to generate database
6 web interface -- r2w
5 floating point debugger -- very low priority at this point
3 osx support -- x86-32 and x86-64 hardware required, volunteers? read doc/osx fmi
3 extended dwarf support -- zero priority for next release :)

View File

@ -26,7 +26,6 @@ LDFLAGS+=../../libr/cmd/libr_cmd.a
LDFLAGS+=../../libr/fs/libr_fs.a
LDFLAGS+=../../libr/sign/libr_sign.a
LDFLAGS+=../../libr/magic/libr_magic.a
LDFLAGS+=../../libr/line/libr_line.a
LDFLAGS+=../../libr/cons/libr_cons.a
LDFLAGS+=../../libr/diff/libr_diff.a
LDFLAGS+=../../libr/syscall/libr_syscall.a

View File

@ -1,6 +1,6 @@
BIN=rabin2
BINDEPS=r_lib r_magic r_core r_db r_bin r_egg r_cons
BINDEPS+=r_config r_line r_io r_cmd r_print r_flags r_asm
BINDEPS+=r_config r_io r_cmd r_print r_flags r_asm
BINDEPS+=r_debug r_hash r_lang r_anal r_parse r_bp r_reg
BINDEPS+=r_search r_syscall r_sign r_diff r_socket r_fs r_magic r_util

View File

@ -1,7 +1,7 @@
BIN=radare2
BINDEPS=r_core r_parse r_search r_cons r_lib r_config
BINDEPS+=r_bin r_debug r_anal r_diff r_reg r_bp r_io r_cmd r_fs
BINDEPS+=r_sign r_print r_lang r_asm r_syscall r_db r_hash r_line
BINDEPS+=r_sign r_print r_lang r_asm r_syscall r_db r_hash
BINDEPS+=r_magic r_socket r_flags r_util r_th r_egg
CFLAGS+=-DR2_BIRTH=\"`date +%Y-%m-%d`\" -DR2_GITTIP=\"$(GIT_TIP)\"

View File

@ -2,7 +2,7 @@ BIN=radiff2
BINDEPS=r_core r_diff r_config r_lib r_cons r_search r_anal
BINDEPS+=r_bin r_debug r_io r_print r_asm r_hash r_fs
BINDEPS+=r_socket r_flags r_lang r_reg r_bp r_cmd r_sign r_parse
BINDEPS+=r_line r_syscall r_db r_magic r_util r_parse r_egg
BINDEPS+=r_syscall r_db r_magic r_util r_parse r_egg
include ../rules.mk

View File

@ -1,6 +1,6 @@
BIN=rafind2
BINDEPS=r_search r_io r_print r_lib r_asm r_anal r_reg r_cons r_util r_syscall r_diff
BINDEPS+=r_socket r_db r_parse
BINDEPS=r_search r_io r_print r_lib r_asm r_anal r_reg r_cons
BINDEPS+=r_socket r_db r_parse r_util r_syscall r_diff
include ../rules.mk

View File

@ -1,5 +1,6 @@
BIN=rahash2
BINDEPS=r_io r_hash r_util r_print r_socket r_asm r_cons r_anal r_lib r_syscall r_reg r_diff r_db r_parse
BINDEPS=r_io r_hash r_util r_print r_socket r_asm r_cons
BINDEPS+=r_anal r_lib r_syscall r_reg r_diff r_db r_parse
include ../rules.mk

2
configure vendored
View File

@ -475,7 +475,7 @@ for A in ${ENVWORDS} ; do
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_db.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_line.pc pkgcfg/r_syscall.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_lib.pc pkgcfg/r_parse.pc pkgcfg/r_print.pc pkgcfg/r_th.pc pkgcfg/r_fs.pc ; do # SUBDIRS
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_db.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_syscall.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_lib.pc pkgcfg/r_parse.pc pkgcfg/r_print.pc pkgcfg/r_th.pc pkgcfg/r_fs.pc ; do # SUBDIRS
if [ -f "${VPATH}/${A}.acr" ]; then
SD_TARGET=${A}
else

View File

@ -124,7 +124,6 @@ SUBDIRS ./config-user.mk
pkgcfg/r_cmd.pc
pkgcfg/r_config.pc
pkgcfg/r_flags.pc
pkgcfg/r_line.pc
pkgcfg/r_syscall.pc
pkgcfg/r_sign.pc
pkgcfg/r_util.pc

View File

@ -38,7 +38,7 @@ endif
.c.o:
ifneq ($(SILENT),)
@echo CC $<
@echo CC $(shell basename $<)
endif
$(CC) -c $(CFLAGS) -o $@ $<

View File

@ -7,14 +7,31 @@ LFX=${DESTDIR}/${LIBDIR}
IFX=${DESTDIR}/${INCLUDEDIR}
PWD=$(shell pwd)
LIBS=util magic socket db cons line lib io lang flags bin hash config syscall
LIBS+=cmd reg diff anal parse asm print search egg bp sign debug fs th core
#DEPRECATED APIS : LIBS+=th crypto
LIBS0=util socket hash
LIBS1=reg cons db magic lib diff bp search
LIBS2=syscall cmd lang io crypto flags bin
LIBS3=fs anal
LIBS4=parse sign
LIBS5=asm
LIBS6=print egg
LIBS7=core
LIBS=$(LIBS0) $(LIBS1) $(LIBS2) $(LIBS3) $(LIBS4) $(LIBS5) $(LIBS6) $(LIBS7)
.PHONY: $(LIBS)
all:
@for lib in ${LIBS}; do \
cd $${lib} && ${MAKE} || exit 1 ; cd .. ; done
@echo Build done for: ${LIBS}
${MAKE} $(LIBS0)
${MAKE} $(LIBS1)
${MAKE} $(LIBS2)
${MAKE} $(LIBS3)
${MAKE} $(LIBS4)
${MAKE} $(LIBS5)
${MAKE} $(LIBS6)
${MAKE} $(LIBS7)
$(LIBS):
@echo "DIR $@"
cd $@ ; ${MAKE}
pkgcfg:
@for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} pkgcfg ); done

View File

@ -1,4 +1,4 @@
include ../../global.mk
include ../config.mk
NAME=r_anal
EXTRA_CLEAN=clean2
@ -7,12 +7,17 @@ DEPS=r_util r_db r_lib r_reg r_syscall r_diff
CFLAGS*=HAVE_CPARSE=$(HAVE_CPARSE)
CFLAGS+=-DCORELIB -Iarch -I$(TOP)/shlr
include $(LTOP)/config.mk
LDFLAGS+=${BN_LIBS}
foo:
for a in pre libr_anal.${EXT_SO} libr_anal.${EXT_AR} plugins ; do ${MAKE} $$a ; done
.PHONY: pre libs ${EXTRA_CLEAN}
all: plugins
plugins: libr_anal.${EXT_SO} libr_anal.${EXT_AR}
@${MAKE} -C p all
libr_anal.${EXT_SO} libr_anal.${EXT_AR}: pre
include ${STATIC_ANAL_PLUGINS}
STATIC_OBJS=$(addprefix $(LTOP)/anal/p/,$(STATIC_OBJ))
@ -28,12 +33,7 @@ pre:
@cd cparse && ${MAKE} all
@cd $(TOP)/shlr && ${MAKE}
#@if [ ! -e libr_anal.${EXT_SO} ]; then rm -f ${STATIC_OBJS} ; fi
clean2:
@cd cparse && ${MAKE} clean
plugins:
@${MAKE} -C p all
include $(LTOP)/rules.mk

View File

@ -451,7 +451,7 @@ R_API char *r_anal_fcn_to_string(RAnal *a, RAnalFunction* fs) {
// TODO: This function is not fully implemented
/* set function signature from string */
R_API int r_anal_str_to_fcn(RAnal *a, RAnalFunction *f, const char *sig) {
char *p, *q, *r, *str;
char *str; //*p, *q, *r
RAnalType *t;
if (!a || !f || !sig) {

View File

@ -6,15 +6,13 @@ CFLAGS+=-L../../util -lr_util -L../../anal -lr_anal -L../../reg -lr_reg
LDFLAGS+=${LINK}
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
@true
all: ${ALL_TARGETS} ;
ALL_TARGETS=
# TODO: rename to enabled plugins
ARCHS=x86.mk x86_udis86.mk x86_simple.mk ppc.mk arm.mk avr.mk csr.mk dalvik.mk sh.mk
include $(ARCHS)
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}

View File

@ -4,9 +4,9 @@ STATIC_OBJ+=${OBJ_ARC}
TARGET_ARC=anal_arc.${EXT_SO}
ALL_TARGETS+=${TARGET_ARC}
LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
#LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
#LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
#LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
${TARGET_ARC}: ${OBJ_ARC}
${CC} $(call libname,anal_arc) ${LDFLAGS} ${CFLAGS} -o anal_arc.${EXT_SO} ${OBJ_ARC}

View File

@ -4,9 +4,9 @@ STATIC_OBJ+=${OBJ_ARM}
TARGET_ARM=anal_arm.${EXT_SO}
ALL_TARGETS+=${TARGET_ARM}
LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
#LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
#LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
#LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
${TARGET_ARM}: ${OBJ_ARM}
${CC} $(call libname,anal_arm) ${LDFLAGS} ${CFLAGS} -o anal_arm.${EXT_SO} ${OBJ_ARM}

View File

@ -4,9 +4,9 @@ STATIC_OBJ+=${OBJ_BF}
TARGET_BF=anal_bf.${EXT_SO}
ALL_TARGETS+=${TARGET_BF}
LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
#LDFLAGS+=-L$(TOP)/libr/lib -lr_lib
#LDFLAGS+=-L$(TOP)/libr/syscall -lr_syscall
#LDFLAGS+=-L$(TOP)/libr/diff -lr_diff
${TARGET_BF}: ${OBJ_BF}
${CC} $(call libname,anal_bf) ${LDFLAGS} ${CFLAGS} -o anal_bf.${EXT_SO} ${OBJ_BF}

View File

@ -4,9 +4,9 @@ STATIC_OBJ+=${OBJ_M68K}
TARGET_M68K=anal_m68k.${EXT_SO}
ALL_TARGETS+=${TARGET_M68K}
LDFLAGS+=-L../../lib -lr_lib
LDFLAGS+=-L../../syscall -lr_syscall
LDFLAGS+=-L../../diff -lr_diff
#LDFLAGS+=-L../../lib -lr_lib
#LDFLAGS+=-L../../syscall -lr_syscall
#LDFLAGS+=-L../../diff -lr_diff
${TARGET_M68K}: ${OBJ_M68K}
${CC} $(call libname,anal_m68k) ${LDFLAGS} ${CFLAGS} -o anal_m68k.${EXT_SO} ${OBJ_M68K}

View File

@ -4,9 +4,9 @@ STATIC_OBJ+=${OBJ_Z80}
TARGET_Z80=anal_z80.${EXT_SO}
ALL_TARGETS+=${TARGET_Z80}
LDFLAGS+=-L../../lib -lr_lib
LDFLAGS+=-L../../syscall -lr_syscall
LDFLAGS+=-L../../diff -lr_diff
#LDFLAGS+=-L../../lib -lr_lib
#LDFLAGS+=-L../../syscall -lr_syscall
#LDFLAGS+=-L../../diff -lr_diff
${TARGET_Z80}: ${OBJ_Z80}
${CC} $(call libname,anal_z80) ${LDFLAGS} ${CFLAGS} -o anal_z80.${EXT_SO} ${OBJ_Z80}

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2010-2011 */
/* radare - LGPL - Copyright 2010-2012 */
/* nibble<.ds@gmail.com> + pancake<nopcode.org> */
#include <r_anal.h>
@ -169,7 +169,7 @@ R_API void r_anal_var_list_show(RAnal *anal, RAnalFunction *fcn, ut64 addr) {
v->name, (int)v->type->custom.a->count);
else
eprintf ("%s %s %s = ", r_anal_var_scope_to_str (anal, v->scope),
r_anal_type_to_str (anal, v->type, ""), v->name, "");
r_anal_type_to_str (anal, v->type, ""), v->name);
// TODO: implement r_var_dbg_read using r_vm or r_num maybe?? sounds dupped
// XXX: not fully implemented
eprintf ("0x%"PFMT64x, 0LL);

View File

@ -1,14 +1,16 @@
include ../config.mk
include ../../global.mk
NAME=r_bin
DEPS=r_lib r_util
foo:
@for a in $(LIBSO) ${LIBAR} plugins ; do ${MAKE} $$a ; done
.PHONY: pre
pre: $(LIBSO) $(LIBAR)
@${MAKE} -C p all
CFLAGS+=-DCORELIB -Iformat -Imangling
include $(TOP)/libr/config.mk
include ${STATIC_BIN_PLUGINS}
include ${STATIC_BIN_XTR_PLUGINS}
@ -16,7 +18,4 @@ STATIC_OBJS=$(addprefix $(LTOP)/bin/p/, $(STATIC_OBJ))
OBJS=bin.o bin_meta.o bin_write.o demangle.o dwarf.o
OBJS+=mangling/cxx/cp-demangle.o ${STATIC_OBJS}
plugins:
cd p && ${MAKE} all
include $(TOP)/libr/rules.mk

View File

@ -1,20 +1,16 @@
include ../config.mk
NAME=r_bp
DEPS+=r_util
CFLAGS+=-DCORELIB
include ../config.mk
foo:
for a in libr_bp.${EXT_SO} libr_bp.${EXT_AR} plugins ; do ${MAKE} $$a ; done
.PHONY: pre
pre: libr_bp.${EXT_SO} libr_bp.${EXT_AR}
${MAKE} -C p
include ${STATIC_BP_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst bp_,p/bp_,$(STATIC_OBJ)))
OBJS=bp.o watch.o io.o plugin.o traptrace.o ${STATIC_OBJS}
#pre:
# if [ ! -e libr_bp.so ]; then rm -f ${STATIC_OBJS} ; fi
plugins:
cd p && ${MAKE} all
include ../rules.mk

View File

@ -2,6 +2,9 @@ include ../config.mk
NAME=r_cons
OBJS=cons.o pipe.o output.o grep.o input.o hud.o
OBJS+=line.o
DEPS=r_util
include ../rules.mk
line.o: dietline.c

View File

@ -1,8 +1,7 @@
/* radare - LGPL - Copyright 2007-2012 pancake<nopcode.org> */
/* dietline is a lightweight and portable library similar to GNU readline */
#include <r_line.h>
#include <r_cons.h>
#include <string.h>
#include <stdlib.h>

View File

@ -1,6 +1,6 @@
/* radare - LGPL - Copyright 2007-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2007-2012 pancake<nopcode.org> */
#include <r_line.h>
#include <r_cons.h>
static RLine r_line_instance;
#define I r_line_instance

View File

@ -2,7 +2,7 @@ include ../config.mk
NAME=r_core
DEPS=r_config r_cons r_line r_io r_cmd r_util r_print r_flags r_asm r_lib
DEPS=r_config r_cons r_io r_cmd r_util r_print r_flags r_asm r_lib
DEPS+=r_debug r_hash r_bin r_lang r_io r_anal r_parse r_print r_bp r_egg
DEPS+=r_reg r_search r_syscall r_sign r_diff r_socket r_fs r_magic r_db

View File

@ -5,41 +5,38 @@ DEPS=r_util
OBJS=db.o table.o pair.o
PRE=sdb/src/libsdb.a
SDBLIB=sdb/src/libsdb.a
EXTRA_CLEAN=sdbclean
EXTRA_TARGETS+=${PRE}
EXTRA_TARGETS+=${SDBLIB}
CFLAGS+=-Isdb/src
VC=git
URL=git://github.com/radare/sdb
F=README.md config.mk src Makefile
SYNCFILES=$(addprefix sdb.${VC}/,${F})
SYNCFILES=$(addprefix sdb.vc/,${F})
include ../rules.mk
# link against sdb
LINK+=${PRE}
LINK+=${SDBLIB}
sdbclean:
cd sdb/src ; ${MAKE} clean
sdb/src/libsdb.a:
#cd sdb/src ; ${MAKE} CFLAGS=-fPIC libsdb.a
$(SDBLIB):
cd sdb ; ${MAKE} src/sdb-version.h
cd sdb/src ; ${MAKE} ARCH=xxx \
RANLIB="${RANLIB}" \
CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" libsdb.a
.PHONY: sdb-sync sync-sdb
.PHONY: sdb-sync sync-sdb sdbclean
sdb-sync sync-sdb:
rm -rf sdb sdb.${VC}
${VC} clone ${URL} sdb.${VC}
mkdir sdb
rm -rf sdb sdb.vc
git clone ${URL} sdb.vc
mkdir -p sdb
cp -rf ${SYNCFILES} sdb
rm -rf sdb.${VC}
rm -rf ../include/sdb
rm -rf sdb.vc ../include/sdb
mkdir -p ../include/sdb
cd sdb ; ${MAKE} src/sdb-version.h
cp -f sdb/src/*.h ../include/sdb

View File

@ -19,8 +19,6 @@ src/sdb-version.h:
clean:
rm -f src/sdb-version.h
cd src && ${MAKE} clean
cd memcache && ${MAKE} clean
cd test && ${MAKE} clean
cd ${VALADIR} && ${MAKE} clean
dist:

View File

@ -1,23 +1,18 @@
include ../config.mk
NAME=r_egg
DEPS=r_util r_asm r_syscall r_db
include ../config.mk
#OBJS+=p/x86_osx_binsh.o
OBJS=egg.o lang.o
OBJS+=emit_x86.o
OBJS+=emit_arm.o
OBJS+=emit_x64.o
OBJS+=emit_trace.o
foo:
for a in ${LIBSO} ${LIBAR} all ; do ${MAKE} $$a ; done
all: ${LIBSO} ${LIBAR}
P=p/
include ${STATIC_EGG_PLUGINS}
OBJS+=$(subst ..,p/..,$(subst egg_,p/egg_,$(STATIC_OBJ)))
#plugins plugins:
# Do not build plugins. all are static @cd p && ${MAKE} all
OBJS+=$(subst ..,${P}..,$(subst egg_,${P}egg_,$(STATIC_OBJ)))
include ../rules.mk

View File

@ -1,7 +1,7 @@
#ifndef _INCLUDE_CONS_R_
#define _INCLUDE_CONS_R_
#define HAVE_DIETLINE 0
#define HAVE_DIETLINE 1
#include <r_types.h>
#include <r_util.h>
@ -243,4 +243,64 @@ R_API int r_cons_get_column();
R_API char *r_cons_message(const char *msg);
#endif
/* r_line */
#define R_LINE_BUFSIZE 4096
#define R_LINE_HISTSIZE 256
typedef struct r_line_hist_t {
char **data;
int size;
int index;
int top;
int autosave;
} RLineHistory;
typedef struct r_line_buffer_t {
char data[R_LINE_BUFSIZE];
int index;
int length;
} RLineBuffer;
typedef struct r_line_t RLine; // forward declaration
typedef int (*RLineCallback)(RLine *line);
typedef struct r_line_comp_t {
int argc;
const char **argv;
RLineCallback run;
} RLineCompletion;
struct r_line_t {
RLineCompletion completion;
RLineHistory history;
RLineBuffer buffer;
int echo;
int has_echo;
char *prompt;
char *clipboard;
int disable;
void *user;
}; /* RLine */
#ifdef R_API
R_API RLine *r_line_new();
R_API RLine *r_line_singleton();
R_API void r_line_free();
R_API char *r_line_get_prompt ();
R_API void r_line_set_prompt(const char *prompt);
R_API int r_line_hist_load(const char *file);
R_API char *r_line_readline();
/* label ?! */
R_API int r_line_hist_add(const char *line);
R_API int r_line_hist_save(const char *file);
R_API int r_line_hist_label(const char *label, void (*cb)(const char*));
R_API void r_line_label_show();
#endif
#endif

View File

@ -15,7 +15,6 @@
#include "r_anal.h"
#include "r_cmd.h"
#include "r_cons.h"
#include "r_line.h"
#include "r_print.h"
#include "r_search.h"
#include "r_sign.h"

View File

@ -1,64 +0,0 @@
#ifndef _INCLUDE_R_LINE_H_
#define _INCLUDE_R_LINE_H_
#include <r_types.h>
#include <r_cons.h>
#include <r_util.h>
#define R_LINE_BUFSIZE 4096
#define R_LINE_HISTSIZE 256
typedef struct r_line_hist_t {
char **data;
int size;
int index;
int top;
int autosave;
} RLineHistory;
typedef struct r_line_buffer_t {
char data[R_LINE_BUFSIZE];
int index;
int length;
} RLineBuffer;
typedef struct r_line_t RLine; // forward declaration
typedef int (*RLineCallback)(RLine *line);
typedef struct r_line_comp_t {
int argc;
const char **argv;
RLineCallback run;
} RLineCompletion;
struct r_line_t {
RLineCompletion completion;
RLineHistory history;
RLineBuffer buffer;
int echo;
int has_echo;
char *prompt;
char *clipboard;
int disable;
void *user;
}; /* RLine */
#ifdef R_API
R_API RLine *r_line_new();
R_API RLine *r_line_singleton();
R_API void r_line_free();
R_API char *r_line_get_prompt ();
R_API void r_line_set_prompt(const char *prompt);
R_API int r_line_hist_load(const char *file);
R_API char *r_line_readline();
/* label ?! */
R_API int r_line_hist_add(const char *line);
R_API int r_line_hist_save(const char *file);
R_API int r_line_hist_label(const char *label, void (*cb)(const char*));
R_API void r_line_label_show();
#endif
#endif

View File

@ -9,7 +9,8 @@ CFLAGS+=-Wall -DCORELIB
include ../socket/deps.mk
all: libr_io.${EXT_SO} libr_io.${EXT_AR}
.PHONY: pre
pre: libr_io.${EXT_SO} libr_io.${EXT_AR}
${MAKE} -C p
include ${STATIC_IO_PLUGINS}

View File

@ -2,6 +2,6 @@ include ../config.mk
NAME=r_lang
OBJS=lang.o
DEPS=r_util r_lib r_line
DEPS=r_util r_lib r_cons
include ../rules.mk

View File

@ -1,10 +0,0 @@
include ../config.mk
NAME=r_line
DEPS=r_util r_cons
OBJS=line.o
#LINK=-L../cons -lr_cons -Wl,-R../cons ../util/*.a
include ../rules.mk
line.o: dietline.c

View File

@ -1,147 +0,0 @@
/* THIS FILE CONTAINS OLD FUNCTIONS TO BE DEPRECATED OR RETHINKED */
/* scripting */
/* TODO: remove label related stuff */
#if 0
#define BLOCK 4096
static char *labels = NULL;
static ut32 size = 0;
static ut32 lsize = 0;
static int label_get(char *name)
{
int i, n;
for(i=0;i<size;i++) {
if (!strcmp(name, labels+i+4)) {
memcpy(&n, labels+i, 4);
return n;
}
i+=strlen(labels+i+4)+4;
}
return -1;
}
static void label_add (const char *str) {
ut32 size = r_line_histidx;
ut32 len = strlen(str)-1;
fprintf(stderr, "New label(%s)\n",str); // XXX debug
memset(labels+lsize+4, '\0', BLOCK-((lsize+len+4)%BLOCK));
memcpy(labels+lsize, &size, 4);
memcpy(labels+lsize+4, str, len);
lsize+=len+4+1;
}
void r_line_label_show()
{
ut32 i, p, n = 0;
for(i=0;i<lsize;i++,n++) {
memcpy(&p, labels+i, 4);
printf(" %03d %03d %s\n", i, p, labels+i+4);
i+=strlen(labels+i+4)+4;
}
}
static void label_reset()
{
lsize = 0;
free(labels);
labels = NULL;
}
static int is_label(const char *str)
{
if (str[0]=='\0')
return 0;
if (str[strlen(str)-1]==':') {
if (str[0]==':') {
r_line_label_show();
return 2;
}
return 1;
}
return 0;
}
#endif
/* TODO: Remove this test case .. this is not R_API */
#if 0
static int r_line_printchar() {
unsigned char buf[10];
r_cons_set_raw(1);
buf[0]=r_line_readchar();
switch(buf[0]) {
case 226:
case 197:
case 195:
case 194:
buf[0] = r_line_readchar();
printf("unicode-%02x-%02x\n", buf[0],buf[1]);
break;
case 8: // wtf is 127?
case 127: printf("backspace\n"); break;
case 32: printf("space\n"); break;
case 27:
read(0, buf, 5);
printf("esc-%02x-%02x-%02x-%02x\n",
buf[0],buf[1],buf[2],buf[3]);
break;
case 12: printf("^L\n"); break;
case 13: printf("intro\n"); break;
case 18: printf("^R\n"); break;
case 9: printf("tab\n"); break;
case 3: printf("control-c\n"); break;
case 0: printf("control-space\n"); break;
default:
printf("(code:%d)\n", buf[0]);
break;
}
r_cons_set_raw(0);
return buf[0];
}
#endif
/* history stuff */
int r_line_hist_label(const char *label, void (*cb)(const char*))
{
int i;
#if 0
if (label[0]=='.') {
if (!is_label(label+1))
return 0;
} else {
switch(is_label(label)) {
case 0:
case 2:
return 0;
}
}
#endif
#if 0
i = label_get(label);
if (i == -1) {
label_add(label);
return 1;
}
#endif
if (r_line_history != NULL)
for(i=0;i<r_line_histsize; i++) {
if (r_line_history[i] == NULL)
break;
fprintf(stderr, "%s\n", r_line_history[i]);
if (cb != NULL)
cb(r_line_history[i]);
else fprintf(stderr, "%s\n", r_line_history[i]);
}
return 1;
}

View File

@ -1,11 +0,0 @@
OBJ=hello.o
BIN=hello
BINDEPS=r_cons r_line r_util
#LIBS=../*.o -L../../cons -Wl,-R../../cons -lr_cons \
# ../../util/*.a
#hello: ${OBJ}
# ${CC} ${LDFLAGS} ${OBJ} -o hello
include ../../rules.mk

View File

@ -1,32 +0,0 @@
#include "r_line.h"
static const char *myargv[4] = { "fontana", "fonticulo", "funebre", NULL };
static int complete (void *pline) {
RLine *line = (RLine*) pline;
line->completion.argc = 3;
line->completion.argv = (const char **)myargv;
return 0;
}
int main() {
const char *str;
RLine *line = r_line_new ();
r_cons_new ();
line->completion.run = (RLineCallback) complete;
#if 0
if (!r_line_init ()) {
printf ("Cannot initizalize r_line\n");
return 0;
}
#endif
for (;;) {
str = r_line_readline (0, NULL);
if (str == NULL) // catch eof
break;
printf ("%s\n", str);
r_line_hist_add (str);
}
r_line_free ();
return 0;
}

View File

@ -5,7 +5,7 @@ include $(LTOP)/config.mk
ALL?=
CFLAGS+=-I$(LIBR)/include
LDFLAGS+=$(addprefix -L$(LTOP)/,$(subst r_,,$(BINDEPS)))
LDFLAGS+=$(addprefix -L../,$(subst r_,,$(BINDEPS)))
LDFLAGS+=$(addprefix -l,$(BINDEPS))
SRC=$(subst .o,.c,$(OBJ))
MAGICSED=| sed -e 's,-lr_magic,@LIBMAGIC@,g'
@ -17,23 +17,17 @@ ifeq ($(USE_RPATH),1)
LDFLAGS+=-Wl,-R${PREFIX}/lib
endif
#---------------------#
# Rules for libraries #
#---------------------#
ifeq (${OSTYPE},gnulinux)
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
else
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
endif
all:
@echo "DIR ${NAME}"
${MAKE} ${EXTRA_TARGETS} ${LIBSO} ${LIBAR}
all: ${LIBSO} ${LIBAR} ${EXTRA_TARGETS}
ifneq ($(SILENT),)
@-if [ -e p/Makefile ]; then (cd p && ${MAKE} all) ; fi
@-if [ -f p/Makefile ]; then (cd p && ${MAKE} all) ; fi
else
@-if [ -e p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE} all) ; fi
@-if [ -f p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE} all) ; fi
endif
ifeq ($(WITHPIC),1)
@ -50,8 +44,7 @@ ${LIBSO}: $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ}
break ; \
fi ; done
else
${LIBSO}:
@:
${LIBSO}: ;
endif
ifeq ($(WITHNONPIC),1)
@ -61,8 +54,7 @@ ifneq ($(SILENT),)
endif
${CC_AR} ${OBJS} ${SHARED_OBJ}
else
$(LIBAR):
@:
$(LIBAR): ;
endif
pkgcfg:
@ -91,6 +83,9 @@ mrproper: clean
-rm -f *.d
@true
.PHONY: all install pkgcfg clean deinstall uninstall
.PHONY: all install pkgcfg clean deinstall uninstall echodir
# autodetect dependencies object
-include $(OBJS:.o=.d)
endif

View File

@ -1,3 +1,5 @@
include ../config.mk
NAME=r_vm
DEPS=r_util

View File

@ -1,11 +0,0 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=@LIBDIR@
includedir=${prefix}/include
Name: r_line
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_line -lr_util -lr_cons
Cflags: -I${includedir}/libr

View File

@ -1,9 +1,7 @@
/* radare - LGPL - Copyright 2009-2012 pancake<nopcode.org> */
[CCode (cheader_filename="r_cons.h", cprefix="r_cons", lower_case_cprefix="r_cons_")]
namespace Radare {
[Compact]
[CCode (cname="RCons", free_function="", cprefix="r_cons_")]
[CCode (cheader_filename="r_cons.h", cname="RCons", free_function="", cprefix="r_cons_")]
/* XXX: LEAK */
public class RCons {
// public RCons ();
@ -72,4 +70,17 @@ namespace Radare {
//public static int grepbuf (string str, int len);
public static void invert (bool set, int color);
}
[Compact]
[CCode (cname="RLine", cheader_filename="r_line.h", cprefix="r_line_", free_function="")]
public class RLine {
//public RLine();
public static RLine singleton();
public static bool readline (); //int argc, char **argv);
public static void set_prompt (string promp);
public static bool hist_load (string file);
public static bool hist_add (string line);
public static bool hist_save (string file);
//public static bool hist_label (string file);
}
}

View File

@ -1,7 +1,6 @@
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
namespace Radare {
[Compact]
[CCode (cname="RLine", cheader_filename="r_line.h", cprefix="r_line_", free_function="")]
public class RLine {
//public RLine();

View File

@ -1,8 +0,0 @@
This directory contains the scripts used to ease updates,
compilation, and dependency fixes required to maintain
a system wide installation of radare2.
./install.sh : install r2 in /usr
./update.sh : update r2 installation (fail on abi changes)
./python.sh : install python bindings
./uninstall.sh : deinstall r2