From 0126fcabc9093644ba2109a041e113fdbd6d22ff Mon Sep 17 00:00:00 2001 From: Josh Watson Date: Tue, 18 Sep 2018 20:16:58 -0700 Subject: Fix generation of core.BNLog Most of the BNLog API methods are just variable length arguments of strings. BNLog also includes a `level` parameter, which causes a `TypeError` when `binaryninja.log.log(level, msg)` is called, because it is expecting all parameters to be strings. This PR fixes it so that `BNLog` is correctly generated. Note: I haven't actually tested this to verify `generator` still works, because my Makefile is messed up currently. --- python/generator.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/generator.cpp b/python/generator.cpp index 39e45aea..2b2f0e91 100644 --- a/python/generator.cpp +++ b/python/generator.cpp @@ -396,9 +396,18 @@ int main(int argc, char* argv[]) // As of writing this, only BNLog's have variable instruction lengths, but in an attempt not to break in the future: if (funcName.compare(0, 6, "_BNLog") == 0) { - fprintf(out, "def %s(*args):\n", name.c_str()); - fprintf(out, "\treturn %s(*[cstr(arg) for arg in args])\n\n", funcName.c_str()); - continue; + if (funcName != "_BNLog") + { + fprintf(out, "def %s(*args):\n", name.c_str()); + fprintf(out, "\treturn %s(*[cstr(arg) for arg in args])\n\n", funcName.c_str()); + continue; + } + else + { + fprintf(out, "def %s(level, *args):\n", name.c_str()); + fprintf(out, "\treturn %s(level, *[cstr(arg) for arg in args])\n\n", funcName.c_str()); + continue; + } } } -- cgit v1.3.1