Add support to IDA 7.0
Opened this issue · 9 comments
Add support to IDA 7.0 and this tool will be much better.
Agreed, unfortunately, I no longer have access to IDA Pro, so this would have to be a community contribution.
Any chance you can give info on how to build in windows? I'd like to try compiling against IDA 7 under Windows.
There is actually a windows
branch that has a Makefile for windows. The setup is essentially to compile and statically link libdwarf under mingw, and then statically link that in when compiling dwarfexport.
@matrix1001 @matrix1001 I've ported it to 7.0 and created a pull request.
In my case IDA 7 SDK did not contain MinGW-specific libraries (and linking with MSVC ones predictably led to crashes), so I had to take @nihilus's PR and add MSVC Makefiles on top. If you are interested, I can clean them up and send a PR.
@mephi42 I'd be ok with that. The previous PR just fell off my radar
Hi @ALSchwalm,
I just found out about the dwarfexport plugin today, and wow, I must say. It is really impressive what you've managed to implement, and definitely very useful!
I was wondering if the dwarfexport
plugin may receive some well deserved love. I would indeed be a shame if a plugin this useful fell into the forgotten by not being synced with newer versions of IDA.
Wish you all the best and happy reversing!
Cheers,
Robin
@mewmew, I'm currently using @nihilus's #8 with IDA 7.0, and I can confirm that it's working great.
@ALSchwalm, what do you think needs to be done in order to integrate that pull request?
@mewmew, I'm currently using @nihilus's #8 with IDA 7.0, and I can confirm that it's working great.
Hi @mephi42,
Thanks for the quick reply and feedback!
I tried #8 yesterday, but didn't get it working. I'm running on Linux and the latest version of both GCC and Clang was complaining about both error: a reinterpret_cast is not a constant expression
, ‘struct idainfo’ has no member named ‘is_be’
and inf.is_64bit()
. Perhaps there is something simple I've overlooked?
g++ -static-libgcc -static-libstdc++ src/platform.cpp src/dwarfexport.cpp src/dwarfgen.cpp -m32 -fPIC -shared -std=c++11 -Wno-overflow -Wno-deprecated-declarations -Wno-return-type \
-L. \
-L/home/u/idapro-7.3 \
-I/home/u/idasdk73/include -I/home/u/idapro-7.3/plugins/hexrays_sdk/include -I/usr/include/libdwarf \
-D__LINUX__ -D__X64__ -lida lib/libelf32.a lib/libdwarf32.a -o bin/dwarfexport.plx
In file included from /home/u/idasdk73/include/idp.hpp:17,
from /home/u/idasdk73/include/frame.hpp:10,
from src/platform.cpp:3:
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&))’:
/home/u/idasdk73/include/config.hpp:242:76: error: a reinterpret_cast is not a constant expression
242 | constexpr cfgopt_t(const char *_n, cfgopt_handler_t *_p) : name(_n), ptr((void *) _p), flags(IDPOPT_CST), buf_size(0) {}
| ^~~~~~~~~~~
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&, int64, int64), int64, int64)’:
/home/u/idasdk73/include/config.hpp:245:21: error: a reinterpret_cast is not a constant expression
245 | : name(_n), ptr((void *) _p), flags(IDPOPT_CST | IDPOPT_CST_PARAMS), params(_p1, _p2) {}
| ^~~~~~~~~~~
In file included from /home/u/idasdk73/include/fpro.h:11,
from /home/u/idasdk73/include/idp.hpp:11,
from /home/u/idasdk73/include/frame.hpp:10,
from src/platform.cpp:3:
/home/u/idasdk73/include/idp.hpp: At global scope:
/home/u/idasdk73/include/idp.hpp:328:23: error: static assertion failed: sizeof(asm_t) == 408
328 | CASSERT(sizeof(asm_t) == 408);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/idp.hpp:1736:29: error: static assertion failed: sizeof(processor_t) == 144
1736 | CASSERT(sizeof(processor_t) == 144);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/loader.hpp:612:28: error: static assertion failed: sizeof(plugin_t) == 64
612 | CASSERT(sizeof(plugin_t) == 64);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
src/platform.cpp: In function ‘int translate_register_num(int)’:
src/platform.cpp:247:17: error: ‘struct idainfo’ has no member named ‘is_64bit’
247 | return (inf.is_64bit()) ? translate_amd64(reg_num)
| ^~~~~~~~
src/platform.cpp:250:17: error: ‘struct idainfo’ has no member named ‘is_64bit’
250 | return (inf.is_64bit()) ? -1 : translate_arm(reg_num);
| ^~~~~~~~
src/platform.cpp: In function ‘bool decompiler_lvar_reg_and_offset(cfuncptr_t, const lvar_t&, int*, int*)’:
src/platform.cpp:264:13: error: ‘struct idainfo’ has no member named ‘is_64bit’
264 | if (inf.is_64bit()) {
| ^~~~~~~~
src/platform.cpp:283:13: error: ‘struct idainfo’ has no member named ‘is_64bit’
283 | if (inf.is_64bit()) {
| ^~~~~~~~
src/platform.cpp: In function ‘bool disassembler_lvar_reg_and_offset(func_t*, member_t*, int*, int*)’:
src/platform.cpp:319:13: error: ‘struct idainfo’ has no member named ‘is_64bit’
319 | if (inf.is_64bit()) {
| ^~~~~~~~
src/platform.cpp:342:13: error: ‘struct idainfo’ has no member named ‘is_64bit’
342 | if (inf.is_64bit()) {
| ^~~~~~~~
In file included from /home/u/idasdk73/include/idp.hpp:17,
from /home/u/idasdk73/include/frame.hpp:10,
from src/dwarfexport.cpp:3:
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&))’:
/home/u/idasdk73/include/config.hpp:242:76: error: a reinterpret_cast is not a constant expression
242 | constexpr cfgopt_t(const char *_n, cfgopt_handler_t *_p) : name(_n), ptr((void *) _p), flags(IDPOPT_CST), buf_size(0) {}
| ^~~~~~~~~~~
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&, int64, int64), int64, int64)’:
/home/u/idasdk73/include/config.hpp:245:21: error: a reinterpret_cast is not a constant expression
245 | : name(_n), ptr((void *) _p), flags(IDPOPT_CST | IDPOPT_CST_PARAMS), params(_p1, _p2) {}
| ^~~~~~~~~~~
In file included from /home/u/idasdk73/include/fpro.h:11,
from /home/u/idasdk73/include/idp.hpp:11,
from /home/u/idasdk73/include/frame.hpp:10,
from src/dwarfexport.cpp:3:
/home/u/idasdk73/include/idp.hpp: At global scope:
/home/u/idasdk73/include/idp.hpp:328:23: error: static assertion failed: sizeof(asm_t) == 408
328 | CASSERT(sizeof(asm_t) == 408);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/idp.hpp:1736:29: error: static assertion failed: sizeof(processor_t) == 144
1736 | CASSERT(sizeof(processor_t) == 144);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/loader.hpp:612:28: error: static assertion failed: sizeof(plugin_t) == 64
612 | CASSERT(sizeof(plugin_t) == 64);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
In file included from /home/u/idasdk73/include/idp.hpp:17,
from /home/u/idapro-7.3/plugins/hexrays_sdk/include/hexrays.hpp:87,
from src/dwarfexport.h:6,
from src/dwarfgen.cpp:13:
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&))’:
/home/u/idasdk73/include/config.hpp:242:76: error: a reinterpret_cast is not a constant expression
242 | constexpr cfgopt_t(const char *_n, cfgopt_handler_t *_p) : name(_n), ptr((void *) _p), flags(IDPOPT_CST), buf_size(0) {}
| ^~~~~~~~~~~
/home/u/idasdk73/include/config.hpp: In constructor ‘constexpr cfgopt_t::cfgopt_t(const char*, const char* (*)(lexer_t*, const token_t&, const token_t&, int64, int64), int64, int64)’:
/home/u/idasdk73/include/config.hpp:245:21: error: a reinterpret_cast is not a constant expression
245 | : name(_n), ptr((void *) _p), flags(IDPOPT_CST | IDPOPT_CST_PARAMS), params(_p1, _p2) {}
| ^~~~~~~~~~~
In file included from /home/u/idapro-7.3/plugins/hexrays_sdk/include/hexrays.hpp:84,
from src/dwarfexport.h:6,
from src/dwarfgen.cpp:13:
/home/u/idasdk73/include/idp.hpp: At global scope:
/home/u/idasdk73/include/idp.hpp:328:23: error: static assertion failed: sizeof(asm_t) == 408
328 | CASSERT(sizeof(asm_t) == 408);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/idp.hpp:1736:29: error: static assertion failed: sizeof(processor_t) == 144
1736 | CASSERT(sizeof(processor_t) == 144);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
/home/u/idasdk73/include/loader.hpp:612:28: error: static assertion failed: sizeof(plugin_t) == 64
612 | CASSERT(sizeof(plugin_t) == 64);
/home/u/idasdk73/include/pro.h:647:37: note: in definition of macro ‘CASSERT’
647 | #define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
| ^~~
src/dwarfgen.cpp: In function ‘std::shared_ptr<DwarfGenInfo> generate_dwarf_object(const Options&)’:
src/dwarfgen.cpp:121:21: error: ‘struct idainfo’ has no member named ‘is_be’
121 | int endian = (inf.is_be()) ? DW_DLC_TARGET_BIGENDIAN : DW_DLC_TARGET_LITTLEENDIAN;
| ^~~~~
make: *** [Makefile:12: bin/dwarfexport.plx] Error 1
I also got this include error, but the fix was easy, just add -I/usr/include/libdwarf
In file included from src/dwarfgen.cpp:13:
src/dwarfexport.h:8:10: fatal error: libdwarf.h: No such file or directory
8 | #include <libdwarf.h>
| ^~~~~~~~~~~~
Cheers,
Robin
Edit: These are the versions of GCC and Clang I've installed:
$ gcc --version
gcc (GCC) 9.2.0
$ clang --version
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin