Is there a python binding, or any other script binding, that has access to individual instructions?

There is llvmlite http://llvmlite.readthedocs.io/en/latest/ , but it doesn't seem to support reading individual instructions, based on these docs.

I was thinking to make a simple code analysis tool to, for example, find all system calls that have unchecked return codes, but I can't find a binding for any scripting language. And I am averse to writing this in C++.

Thanks,

Yuri

Hi Yuri,

When you say code analysis, do you mean checking from source code itself, the intermediate representation, the assembly instructions or the binary?

Brenda

I was going to check C/C++ source code by the means of compiling it into .ll format and looking at the instruction level.

Yuri

Hi,

I was thinking to make a simple code analysis tool to, for example, find all system calls that have unchecked return codes, but I can't find a binding for any scripting language. And I am averse to writing this in C++.

One possible choice would be llvmcpy -- Python bindings used by the rev.ng (https://rev.ng/) project:
https://github.com/revng/llvmcpy

Here's an example showing syscalls invocations tracing:
https://github.com/revng/revamb/blob/master/docs/PythonExample.rst#tracing-all-the-syscall-invocations

Best,
Matt

This works, thank you!

I've created the FreeBSD port for llvmcpy.

Thanks!

Yuri

There is llvmlite http://llvmlite.readthedocs.io/en/latest/ , but it doesn't seem to support reading individual instructions, based on these docs.

I was thinking to make a simple code analysis tool to, for example, find all system calls that have unchecked return codes, but I can't find a binding for any scripting language. And I am averse to writing this in C++.

Thanks,

Yuri