diff options
| author | Josh Watson <josh@trailofbits.com> | 2018-09-18 20:16:58 -0700 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2018-10-05 14:46:17 -0400 |
| commit | 0126fcabc9093644ba2109a041e113fdbd6d22ff (patch) | |
| tree | 7680c81cd103f1c60ef0a54be11ab41f3cd1d78b /python/generator.cpp | |
| parent | 182df815ecea771a0d99a38e33c522d290fa568f (diff) | |
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.
Diffstat (limited to 'python/generator.cpp')
| -rw-r--r-- | python/generator.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
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; + } } } |
