diff --git a/libr/asm/arch/m68k/m68k_disasm/m68k_disasm.c b/libr/asm/arch/m68k/m68k_disasm/m68k_disasm.c index b9e5e3ad17..d338afe758 100644 --- a/libr/asm/arch/m68k/m68k_disasm/m68k_disasm.c +++ b/libr/asm/arch/m68k/m68k_disasm/m68k_disasm.c @@ -3029,7 +3029,7 @@ void print_disp(dis_buffer_t *dbuf, int disp, int sz, int rel, int dd) disp = (int)((short)disp); if (rel == -1) { /*phx - use sval to print real destination address */ - nv = disp + (u_int)dbuf->sval + 2*(dd+1); + nv = disp + (u_long)dbuf->sval + 2*(dd+1); printu(dbuf, nv, SIZE_LONG); } else { diff --git a/libr/asm/arch/x86/bea/BeaEngine.h b/libr/asm/arch/x86/bea/BeaEngine.h index 791d6a6b96..bbf095a4a6 100644 --- a/libr/asm/arch/x86/bea/BeaEngine.h +++ b/libr/asm/arch/x86/bea/BeaEngine.h @@ -5,7 +5,7 @@ #define BYTE unsigned char #define WORD unsigned short #define DWORD unsigned int -#define __stdcall __attribute__((stdcall)) +#define __stdcall #endif #define INSTRUCT_LENGTH 64 diff --git a/libr/asm/p/Makefile b/libr/asm/p/Makefile index bcee941789..4990c08fe9 100644 --- a/libr/asm/p/Makefile +++ b/libr/asm/p/Makefile @@ -1,6 +1,5 @@ -CFLAGS=-I../../include -I../arch/ -I../arch/include -w -fPIC -shared -Wl,-R.. +CFLAGS=-I../../include -I../arch/ -I../arch/include -Wall -fPIC -shared -Wl,-R.. # XXX -# -Wall CFLAGS+=-DLIL_ENDIAN=1 -D__UNIX__ ## X86 diff --git a/libr/asm/t/rasm2.c b/libr/asm/t/rasm2.c index b69167f8d2..c904056edf 100644 --- a/libr/asm/t/rasm2.c +++ b/libr/asm/t/rasm2.c @@ -67,7 +67,10 @@ static int rasm_asm(char *buf, u64 offset) /* TODO: Arch, syntax... */ - r_asm_set(&a, "asm_x86_olly"); + if (!r_asm_set(&a, "asm_x86_olly")) { + fprintf(stderr, "Error: Cannot find asm_x86 plugin\n"); + return 1; + } r_asm_set_pc(&a, offset); ret = r_asm_assemble(&a, &aop, buf); @@ -90,11 +93,11 @@ static int __lib_asm_dt(struct r_lib_plugin_t *pl, void *p, void *u) { return R_ int main(int argc, char *argv[]) { + char *arch = NULL; u64 offset = 0x8048000; int dis = 0, str = 0, c; r_asm_init(&a); - r_asm_set(&a, "asm_x86"); r_lib_init(&l, "radare_plugin"); r_lib_add_handler(&l, R_LIB_TYPE_ASM, "(dis)assembly plugins", &__lib_asm_cb, &__lib_asm_dt, NULL); @@ -107,10 +110,7 @@ int main(int argc, char *argv[]) { switch( c ) { case 'a': - if (!r_asm_set(&a, optarg)) - r_asm_set(&a, "asm_x86"); - if (!strcmp(optarg, "asm_bf")) - str = 1; + arch = optarg; break; case 'b': r_asm_set_bits(&a, r_num_math(NULL, optarg)); @@ -134,6 +134,19 @@ int main(int argc, char *argv[]) } } + if (arch) { + if (!r_asm_set(&a, arch)) { + fprintf(stderr, "Error: Unknown plugin\n"); + return 1; + } + if (!strcmp(arch, "asm_bf")) + str = 1; + } else if (!r_asm_set(&a, "asm_x86")) { + fprintf(stderr, "Error: Cannot find asm_x86 plugin\n"); + return 1; + } + + if (argv[optind]) { if (!strcmp(argv[optind], "-")) { char buf[1024]; diff --git a/libr/lang/lang.c b/libr/lang/lang.c index 60d4632be6..45c6a913db 100644 --- a/libr/lang/lang.c +++ b/libr/lang/lang.c @@ -94,9 +94,10 @@ int r_lang_prompt(struct r_lang_t *lang) buf[strlen(buf)-1]='\0'; if (!strcmp(buf, "q")) return R_TRUE; - if (!strcmp(buf, "?")) - printf(*lang->cur->help); - else r_lang_run(lang, buf, strlen(buf)); + if (!strcmp(buf, "?")) { + if (lang->cur->help) + printf(*lang->cur->help); + } else r_lang_run(lang, buf, strlen(buf)); } return R_TRUE; } diff --git a/libr/lang/p/dummy.c b/libr/lang/p/dummy.c index fe716c5570..e50a5c1aeb 100644 --- a/libr/lang/p/dummy.c +++ b/libr/lang/p/dummy.c @@ -12,6 +12,7 @@ static int dummy_run(void *user, const char *code, int len) static struct r_lang_handle_t r_lang_plugin_dummy = { .name = "dummy", .desc = "Dummy language extension", + .help = NULL, .run = &dummy_run, .run_file = NULL, .set_argv = NULL, diff --git a/libr/lang/p/lua.c b/libr/lang/p/lua.c index e0115a055a..cbe6574e75 100644 --- a/libr/lang/p/lua.c +++ b/libr/lang/p/lua.c @@ -12,6 +12,7 @@ static int lua_run(void *user, const char *code, int len) static struct r_lang_handle_t r_lang_plugin_lua = { .name = "lua", .desc = "LUA language extension", + .help = NULL, .run = &lua_run, .run_file = NULL, .set_argv = NULL,