From bb837312759350eaa3ed095807b1b8b63fbf1fe0 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Tue, 26 Feb 2008 19:53:27 +0000 Subject: [PATCH] Sources synced up to 0.9.55 --- build.py | 4 ++-- python/idc.py | 32 +++++++++++++++----------------- swig/idaapi.i | 2 ++ swig/kernwin.i | 7 +++++++ swig/nalt.i | 5 +---- swig/name.i | 8 +++----- swig/typeinf.i | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 28 deletions(-) diff --git a/build.py b/build.py index 24bbb73..bdaf717 100644 --- a/build.py +++ b/build.py @@ -193,7 +193,7 @@ class GCCBuilder(BuilderBase): self.include_delimiter = "-I" self.macro_delimiter = "-D" self.libpath_delimiter = "-L" - self.compiler_parameters = "" + self.compiler_parameters = "-fpermissive" self.linker_parameters = "-shared" self.basemacros = [ ] self.compiler = "g++" @@ -404,5 +404,5 @@ if __name__ == "__main__": cleanlist = [] cleanlist.extend(BUILD_TEMPFILES) cleanlist.append(plugin_name) - clean(cleanlist) +# clean(cleanlist) diff --git a/python/idc.py b/python/idc.py index 57889e4..4ca7070 100644 --- a/python/idc.py +++ b/python/idc.py @@ -2605,10 +2605,8 @@ def Refresh(): def RefreshLists(): """ Refresh all list views (names, functions, etc) - - FIXME: unimplemented """ - raise NotImplementedError + idaapi.refresh_lists() #---------------------------------------------------------------------------- @@ -5665,11 +5663,9 @@ def GetType(ea): @param ea: the address of the object - @return: type string, 0 - failed - - FIXME: unimplemented + @return: type string or None if failed """ - raise NotImplementedError + return idaapi.idc_get_type(ea) def GuessType(ea): @@ -5678,12 +5674,10 @@ def GuessType(ea): @param ea: the address of the object, can be the structure member id too - @return: type string, 0 - failed - - FIXME: unimplemented + @return: type string or None if failed """ - raise NotImplementedError - + return idaapi.idc_guess_type(ea) + def SetType(ea, type): """ @@ -5708,10 +5702,8 @@ def ParseTypes(input, flags): @param flags: combination of PT_... constants or 0 @return: number of errors - - FIXME: unimplemented """ - raise NotImplementedError + return idaapi.idc_parse_types(input, flags) PT_FILE = 0x0001 # input if a file name (otherwise contains type declarations) @@ -5921,9 +5913,15 @@ def SetBptCnd(ea, cnd): @param cnd: breakpoint condition @return: success - FIXME: unimplemented """ - raise NotImplementedError + bpt = idaapi.bpt_t() + + if not idaapi.get_bpt(ea, bpt): + return False + + bpt.condition = cnd + + return idaapi.update_bpt(bpt) def AddBptEx(ea, size, bpttype): diff --git a/swig/idaapi.i b/swig/idaapi.i index a9a6cc6..c991a2c 100644 --- a/swig/idaapi.i +++ b/swig/idaapi.i @@ -67,7 +67,9 @@ typedef long long longlong; %array_class(uchar, ucharArray); %array_class(tid_t, tidArray); +%array_class(ea_t, eaArray); %pointer_class(int, int_pointer); +%pointer_class(ea_t, ea_pointer); %include "ida.i" %include "idd.hpp" diff --git a/swig/kernwin.i b/swig/kernwin.i index b4bef83..5b59e50 100644 --- a/swig/kernwin.i +++ b/swig/kernwin.i @@ -9,6 +9,13 @@ %apply unsigned long *INOUT { sel_t *sel }; %rename (_askseg) askseg; +%inline %{ +void refresh_lists(void) +{ + callui(ui_list); +} +%} + %pythoncode %{ def asklong(defval, format): res, val = _idaapi._asklong(defval, format) diff --git a/swig/nalt.i b/swig/nalt.i index 3f49336..0f178da 100644 --- a/swig/nalt.i +++ b/swig/nalt.i @@ -1,6 +1,3 @@ %ignore NALT_EA; -%ignore NALT_ULONG; -#define NALT_EA() - -%include "nalt.hpp" +%include "nalt.hpp" \ No newline at end of file diff --git a/swig/name.i b/swig/name.i index 16dd1ec..1151ee9 100644 --- a/swig/name.i +++ b/swig/name.i @@ -3,16 +3,14 @@ %cstring_bounded_output(char *dstname, MAXSTR); %cstring_bounded_output(char *buf, MAXSTR); +// This is for get_name_value's output value +%apply unsigned long *OUTPUT { uval_t *value }; + // FIXME: These should be fixed -%ignore get_name_value; %ignore append_struct_fields; %ignore get_struct_operand; -%ignore debug_name_how_t; %ignore set_debug_names; -%ignore set_debug_name; %ignore get_debug_name; -%ignore del_debug_names; -%ignore get_debug_name_ea; %ignore nameVa; // Unexported & kernel-only diff --git a/swig/typeinf.i b/swig/typeinf.i index e9eef3e..ff6cc99 100644 --- a/swig/typeinf.i +++ b/swig/typeinf.i @@ -171,4 +171,51 @@ til_t * load_til_header_wrap(const char *tildir, const char *name) } %} +%inline %{ +/* Parse types from a string or file. See ParseTypes() in idc.py */ +int idc_parse_types(const char *input, int flags) +{ + int hti = ((flags >> 4) & 7) << HTI_PAK_SHIFT; + if ( (flags & 1) != 0 ) + { + hti |= HTI_FIL; + } + + return parse_types2(input, (flags & 2) == 0 ? msg : NULL, hti); +} + +char *idc_get_type(ea_t ea, char *buf, size_t bufsize) +{ + type_t type[MAXSTR]; + p_list fnames[MAXSTR]; + + if (get_ti(ea, type, sizeof(type), fnames, sizeof(fnames))) + { + int code = print_type_to_one_line(buf, bufsize, idati, type, + NULL, NULL, fnames); + if ( code == T_NORMAL ) + { + return buf; + } + } \ + return NULL; +} + +char *idc_guess_type(ea_t ea, char *buf, size_t bufsize) +{ + type_t type[MAXSTR]; + p_list fnames[MAXSTR]; + + if (guess_type(ea, type, sizeof(type), fnames, sizeof(fnames))) + { + int code = print_type_to_one_line(buf, bufsize, idati, type, + NULL, NULL, fnames); + if ( code == T_NORMAL ) + { + return buf; + } + } \ + return NULL; +} +%}