First steps (Tutorial)ΒΆ
The following tutorial illustrates basic usage of bjoern. You will learn how to start the server, import code, spawn a bjoern-shell and run queries against the database.
- Begin by starting the bjoern-server:
./bjoern-server.sh
This starts an orientDB server instance, along with the OrientDB Studio on port 2480. Studio provides a useful interface to explore the database contents (see http://orientdb.com/docs/last/Home-page.html).
- In another shell, import some code
./bjoern-import.sh /bin/ls
This will start a thread inside the server process which performs the import. You will see an ‘Import finished’ message in the server log upon completion.
- Create a shell thread using bjosh
bjosh create
- Connect to the shell process using bjosh
bjosh connect
- Get names of all functions (sample query)
_ _ _
| |__ (_) ___ ___| |__
| '_ \| |/ _ \/ __| '_ \
| |_) | | (_) \__ \ | | |
|_.__// |\___/|___/_| |_|
|__/ bjoern shell
bjoern> queryNodeIndex('nodeType:Func').repr
- Get all calls
getCallsTo('').map
- Get basic blocks containing calls to ‘malloc’
getCallsTo('malloc').in('IS_BB_OF').repr
- Walk to first instruction of each function
getFunctions('').funcToInstr().repr