From a912d7472bb4bda9a493d924f3e2ba902b56d5d3 Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Thu, 1 Sep 2016 22:40:38 +0200 Subject: [PATCH 1/2] Port to IDA 6.8 SDK. --- README | 2 ++ bfin-dis.cpp | 7 +++---- blackfin.h | 4 ++-- emu.cpp | 2 +- out.cpp | 10 +++++----- reg.cpp | 2 +- rigol_ldr.cpp | 3 +-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README b/README index c57904a..f86e134 100644 --- a/README +++ b/README @@ -24,6 +24,8 @@ authors RGL Firmware Loader by TomasVlad + Ported to IDA 6.8 by Martin Heistermann + license ~~~~~~~ diff --git a/bfin-dis.cpp b/bfin-dis.cpp index 65eccab..beeec36 100644 --- a/bfin-dis.cpp +++ b/bfin-dis.cpp @@ -139,10 +139,9 @@ static const char *fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble if (/*outf->symbol_at_address_func (ea, outf) ||*/ !constant_formats[cf].exact) { //outf->print_address_func (ea, outf); - char name[60]; - - if(get_colored_long_name(pc, ea, name,60)) - qsnprintf (buf, 60,"%s", name); + qstring name; + if(get_colored_long_name(&name, ea)) + qsnprintf (buf, 60,"%s", name.c_str()); else qsnprintf (buf, 60,COLSTR("0x%lx",SCOLOR_NUMBER), ea); diff --git a/blackfin.h b/blackfin.h index bc6521e..1d07f98 100644 --- a/blackfin.h +++ b/blackfin.h @@ -28,7 +28,7 @@ #include #include -#include "../idaidp.hpp" +#include "../module/idaidp.hpp" #include #pragma pack(1) @@ -58,7 +58,7 @@ int idaapi blackfin_ana(void); int idaapi blackfin_emu(void); void idaapi blackfin_out(void); -bool create_func_frame(func_t *pfn); +bool idaapi create_func_frame(func_t *pfn); ea_t idaapi get_ref_addr(ea_t ea, const char *str, int pos); diff --git a/emu.cpp b/emu.cpp index 62ba93c..578a4e3 100644 --- a/emu.cpp +++ b/emu.cpp @@ -86,7 +86,7 @@ static void setup_far_func(func_t *pfn) } */ -bool create_func_frame(func_t *pfn) +bool idaapi create_func_frame(func_t *pfn) { if ( pfn != NULL ) { diff --git a/out.cpp b/out.cpp index b9e3096..6f7e949 100644 --- a/out.cpp +++ b/out.cpp @@ -54,7 +54,7 @@ void idaapi blackfin_out(void) //Add data references if(odi.drefmode==DMODE_LOAD_HIGH) { - char name[MAXSTR]; + qstring name; size_t len = get_max_ascii_length(odi.daddr, ASCSTR_C, true); @@ -71,15 +71,15 @@ void idaapi blackfin_out(void) get_ascii_contents(odi.daddr, len, ASCSTR_C, string, sizeof(string)); - if(get_colored_long_name(0, odi.daddr, name,60)) - printf_line(0," -> %s => " COLSTR("\"%s\"",SCOLOR_RPTCMT), name, string); + if(get_colored_long_name(&name, odi.daddr)) + printf_line(0," -> %s => " COLSTR("\"%s\"",SCOLOR_RPTCMT), name.c_str(), string); else printf_line(0," -> " COLSTR("0x%lx",SCOLOR_NUMBER) " => " COLSTR("\"%s\"",SCOLOR_RPTCMT) , (unsigned long) odi.daddr,string); } else { - if(get_colored_long_name(0, odi.daddr, name,60)) - printf_line(0," -> %s", name); + if(get_colored_long_name(&name, odi.daddr)) + printf_line(0," -> %s", name.c_str()); else printf_line(0," -> " COLSTR("0x%lx",SCOLOR_NUMBER), (unsigned long) odi.daddr); } diff --git a/reg.cpp b/reg.cpp index 12e086f..f230638 100644 --- a/reg.cpp +++ b/reg.cpp @@ -33,7 +33,7 @@ static ioport_t *ports; #define CHECK_IORESP 1 //activate config file reading, thanks to tommie -#include "../iocommon.cpp" //it doesn't look nice, but i think its designated to include it +#include "../module/iocommon.cpp" //it doesn't look nice, but i think its designated to include it // A well behaving processor module should call invoke_callbacks() diff --git a/rigol_ldr.cpp b/rigol_ldr.cpp index 3130fef..3ca60f3 100644 --- a/rigol_ldr.cpp +++ b/rigol_ldr.cpp @@ -27,7 +27,7 @@ L O A D E R for firmware files for Rigol oscilloscope. */ -#include "../../ldr/idaldr.h" +#include "../ldr/idaldr.h" #include "rigol_ldr.h" static rgl_hdr _hdr; @@ -145,7 +145,6 @@ loader_t LDSC = load_rgl_file, NULL, NULL, - init_loader_options, }; From 4f0ad76e957cfdc145c864833e1d5c7ea58fde84 Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Sat, 3 Sep 2016 01:26:37 +0200 Subject: [PATCH 2/2] Don't accept empty names from get_colored_long_name. --- bfin-dis.cpp | 2 +- out.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bfin-dis.cpp b/bfin-dis.cpp index beeec36..9e794dd 100644 --- a/bfin-dis.cpp +++ b/bfin-dis.cpp @@ -140,7 +140,7 @@ static const char *fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble { //outf->print_address_func (ea, outf); qstring name; - if(get_colored_long_name(&name, ea)) + if(get_colored_long_name(&name, ea) && !name.empty()) qsnprintf (buf, 60,"%s", name.c_str()); else qsnprintf (buf, 60,COLSTR("0x%lx",SCOLOR_NUMBER), ea); diff --git a/out.cpp b/out.cpp index 6f7e949..b4579b5 100644 --- a/out.cpp +++ b/out.cpp @@ -71,14 +71,14 @@ void idaapi blackfin_out(void) get_ascii_contents(odi.daddr, len, ASCSTR_C, string, sizeof(string)); - if(get_colored_long_name(&name, odi.daddr)) + if(get_colored_long_name(&name, odi.daddr) && !name.empty()) printf_line(0," -> %s => " COLSTR("\"%s\"",SCOLOR_RPTCMT), name.c_str(), string); else printf_line(0," -> " COLSTR("0x%lx",SCOLOR_NUMBER) " => " COLSTR("\"%s\"",SCOLOR_RPTCMT) , (unsigned long) odi.daddr,string); } else { - if(get_colored_long_name(&name, odi.daddr)) + if(get_colored_long_name(&name, odi.daddr) && !name.empty()) printf_line(0," -> %s", name.c_str()); else printf_line(0," -> " COLSTR("0x%lx",SCOLOR_NUMBER), (unsigned long) odi.daddr);