diff --git a/configure b/configure index 2cc9ce186a5f9..a3c4ddee3928a 100755 --- a/configure +++ b/configure @@ -160,7 +160,8 @@ System types: --target=TARGET configure for building compilers for TARGET [HOST] EOF2 -printf "\nOptional Features: +printf " +Optional Features: --disable-debugger disable native debugger features --with-sysmagic force to use system's magic --disable-loadlibs disable loading plugins @@ -176,8 +177,10 @@ printf "\nOptional Features: --with-ostype Choose OS type ( gnulinux windows darwin haiku ) (USEROSTYPE=auto) --without-pic do not build libr as a program independent location --with-nonpic build the library archives .a - --with-libversion specify different libversion (LIBVERSION=xxx)\n" -printf "\nSome influential environment variables: + --with-libversion specify different libversion (LIBVERSION=xxx) +" +printf " +Some influential environment variables: CC C compiler command CFLAGS C compiler flags CPPFLAGS C preprocessor flags @@ -185,8 +188,10 @@ printf "\nSome influential environment variables: nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor\n" -printf "\nReport bugs to: pancake " + CPP C preprocessor +" +printf " +Report bugs to: pancake " echo "" exit 0 } @@ -448,6 +453,9 @@ if [ "$HAVE_BIGEND" = "1" ]; then LIL_ENDIAN="0"; fi check_library HAVE_LIB_LUA5_1 lua5.1 0 if [ "$USEROSTYPE" = "auto" ]; then +if [ "$HOST_OS" = "mingw32_nt-6.2" ]; then +USEROSTYPE="mingw32" +else if [ "$HOST_OS" = "mingw32_nt" ]; then USEROSTYPE="mingw32" else @@ -472,7 +480,7 @@ if [ "$HOST_OS" = "openbsd" ]; then USEROSTYPE="bsd" else if [ "$HOST_OS" = "darwin" ]; then -USEROSTYPE="darwin"; fi; fi; fi; fi; fi; fi; fi; fi; fi +USEROSTYPE="darwin"; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi if [ "$LIBVERSION" = "xxx" ]; then LIBVERSION="$VERSION"; fi SEDFLAGS=" -e '" diff --git a/configure.acr b/configure.acr index c4fdd15735fa2..be5d21ed55f06 100644 --- a/configure.acr +++ b/configure.acr @@ -95,6 +95,9 @@ ARG_WITH USEROSTYPE=auto ostype Choose OS type ( gnulinux windows darwin haiku ) (( TODO: throw error if unknown ostype )) (( TODO: handle BSD os as different ostype? )) IFEQ USEROSTYPE auto ; { + IFEQ HOST_OS mingw32_nt-6.2 ; { + USEROSTYPE = mingw32 ; + }{ IFEQ HOST_OS mingw32_nt ; { USEROSTYPE = mingw32 ; }{ @@ -121,7 +124,7 @@ IFEQ USEROSTYPE auto ; { }{ IFEQ HOST_OS darwin ; { USEROSTYPE = darwin ; - } } } } } } } } + } } } } } } } } } } ARG_WITHOUT WITHPIC pic do not build libr as a program independent location ; diff --git a/libr/core/asm.c b/libr/core/asm.c index 02ab984d7a6ac..97183104453fd 100644 --- a/libr/core/asm.c +++ b/libr/core/asm.c @@ -14,19 +14,14 @@ static void add_hit_to_sorted_hits(RList* hits, ut64 addr, int len, ut8 is_valid static int prune_hits_in_addr_range(RList *hits, ut64 addr, ut64 len, ut8 is_valid); static int rcoreasm_address_comparator(RCoreAsmHit *a, RCoreAsmHit *b){ - if (a->addr == b->addr) - return 0; - else if (a->addr < b->addr) - return -1; - // a->addr > b->addr - return 1; + if (a->addr == b->addr) return 0; + if (a->addr < b->addr) return -1; + return 1; /* a->addr > b->addr */ } R_API RCoreAsmHit *r_core_asm_hit_new() { - RCoreAsmHit *hit = R_NEW (RCoreAsmHit); + RCoreAsmHit *hit = R_NEW0 (RCoreAsmHit); if (!hit) return NULL; - hit->code = NULL; - hit->len = 0; hit->addr = -1; hit->valid = false; return hit; @@ -34,6 +29,7 @@ R_API RCoreAsmHit *r_core_asm_hit_new() { R_API RList *r_core_asm_hit_list_new() { RList *list = r_list_new (); + if (!list) return NULL; list->free = &r_core_asm_hit_free; return list; } @@ -129,7 +125,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6 r_regex_free (rx); } } - if (align) { + if (align && align>1) { if (addr % align) { matches = false; } @@ -187,7 +183,6 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6 return hits; } - static void add_hit_to_sorted_hits(RList* hits, ut64 addr, int len, ut8 is_valid) { RCoreAsmHit *hit = r_core_asm_hit_new(); if (hit) { @@ -216,15 +211,13 @@ static void add_hit_to_hits(RList* hits, ut64 addr, int len, ut8 is_valid) { } static int prune_hits_in_addr_range(RList *hits, ut64 addr, ut64 len, ut8 is_valid) { - RCoreAsmHit hit; + RCoreAsmHit hit = {0}; hit.addr = addr; hit.len = len; - hit.code = NULL; hit.valid = is_valid; return prune_hits_in_hit_range(hits, &hit); } - static int prune_hits_in_hit_range(RList *hits, RCoreAsmHit *hit){ RListIter *iter, *iter_tmp; RCoreAsmHit *to_check_hit; @@ -259,25 +252,23 @@ static RCoreAsmHit * find_addr(RList *hits, ut64 addr) { return r_list_iter_get_data(addr_iter); } - static int handle_forward_disassemble(RCore* core, RList *hits, ut8* buf, ut64 len, ut64 current_buf_pos, ut64 current_instr_addr, ut64 end_addr){ + RCoreAsmHit *hit = NULL, *found_addr = NULL; // forward disassemble from the current instruction up to the end address - ut64 temp_instr_len = 0, - temp_instr_addr = current_instr_addr, - tmp_current_buf_pos = current_buf_pos, - start = 0, end = 0, - start_range = current_instr_addr, - end_range = end_addr; - - RAsmOp op; - RCoreAsmHit *hit = NULL, *found_addr = NULL; - ut8 is_valid = false; + ut64 temp_instr_addr = current_instr_addr; + ut64 tmp_current_buf_pos = current_buf_pos; + ut64 start_range = current_instr_addr; + ut64 end_range = end_addr; + ut64 temp_instr_len = 0; + ut64 start = 0, end = 0; + ut8 is_valid = false; + RAsmOp op; if (end_addr < current_instr_addr) return end_addr; r_asm_set_pc (core->assembler, current_instr_addr); - while ( tmp_current_buf_pos < len && temp_instr_addr < end_addr) { + while (tmp_current_buf_pos < len && temp_instr_addr < end_addr) { temp_instr_len = len - tmp_current_buf_pos; IFDBG eprintf("Current position: %"PFMT64d" instr_addr: 0x%"PFMT64x"\n", tmp_current_buf_pos, temp_instr_addr); temp_instr_len = r_asm_disassemble (core->assembler, &op, buf+tmp_current_buf_pos, temp_instr_len); @@ -285,8 +276,7 @@ static int handle_forward_disassemble(RCore* core, RList *hits, ut8* buf, ut64 l if (temp_instr_len == 0){ is_valid = false; temp_instr_len = 1; - } else - is_valid = true; + } else is_valid = true; // check to see if addr exits found_addr = find_addr(hits, temp_instr_addr); @@ -299,8 +289,7 @@ static int handle_forward_disassemble(RCore* core, RList *hits, ut8* buf, ut64 l ut32 prune_results = 0; prune_results = prune_hits_in_addr_range(hits, temp_instr_addr, temp_instr_len, is_valid); add_hit_to_sorted_hits(hits, temp_instr_addr, temp_instr_len, is_valid); - - if (prune_results ) { + if (prune_results) { r_list_add_sorted (hits, hit, ((RListComparator)rcoreasm_address_comparator)); IFDBG eprintf("Pruned %u hits from list in fwd sweep.\n", prune_results); } else { @@ -474,7 +463,7 @@ static RList * r_core_asm_back_disassemble_all(RCore *core, ut64 addr, ut64 len, return NULL; } - if (len == 0){ + if (len == 0) { return hits; } @@ -587,11 +576,11 @@ static RList *r_core_asm_back_disassemble (RCore *core, ut64 addr, int len, ut64 last_num_invalid ++; // disassembly perfect } else if (current_buf_pos + current_instr_len == next_buf_pos) { - // i think this may be the only case where an invalid instruction will be - // added because handle_forward_disassemble and handle_disassembly_overlap - // are only called in cases where a valid instruction has been found. - // and they are lazy, since they purge the hit list - ut32 purge_results = 0; + // i think this may be the only case where an invalid instruction will be + // added because handle_forward_disassemble and handle_disassembly_overlap + // are only called in cases where a valid instruction has been found. + // and they are lazy, since they purge the hit list + ut32 purge_results = 0; ut8 is_valid = true; IFDBG eprintf(" handling underlap case: current_instr_addr: 0x%"PFMT64x".\n", current_instr_addr); purge_results = prune_hits_in_addr_range(hits, current_instr_addr, current_instr_len, /* is_valid */ true); diff --git a/libr/socket/run.c b/libr/socket/run.c index a4a7e32e3cd81..901057233d3fa 100644 --- a/libr/socket/run.c +++ b/libr/socket/run.c @@ -629,10 +629,7 @@ R_API int r_run_start(RRunProfile *p) { #if __APPLE__ posix_spawnattr_t attr = {0}; pid_t pid = -1; -#endif int ret; - -#if __APPLE__ posix_spawnattr_init (&attr); if (p->_args[0]) { char **envp = r_sys_get_environ(); @@ -698,7 +695,7 @@ R_API int r_run_start(RRunProfile *p) { { int i; for (i=3; i<10; i++) close (i); } // TODO: use posix_spawn if (p->_setgid) { - ret = setgid (atoi (p->_setgid)); + int ret = setgid (atoi (p->_setgid)); if (ret < 0) return 1; }