inspector-repl/inspector

inspector-repl/inspector

Spread the love

Permits to inject a in reality-purposeful C++17 REPL into working, compiled programs
that may maybe maybe access your program insist and gives aspects adore code-completion and
syntax highlighting.

The API is much like tools adore Pry in Ruby or
Pdb in Python:

Instance program:

// put as foremost.cpp
#embody <iostream>
#embody <string>

int foremost(int argc, char** argv) {
    int a = 1;
    std::string b = "hi there world";
#embody INSPECTOR
    std::cout << "2nd crash." << std::endl;
#embody INSPECTOR
}
$ ./inspector prebuild foremost.cpp 
$ clang++ $(./inspector print-cflags) foremost.cpp -o foremost 
$ ./inspector repl
$ ./foremost

Inspector instance session

Presentation slides on Inspector

10 min presentation on Inspector

Create

Necessities

  • a c++ compiler (gcc or clang++)
  • libcling (gawk set up directions underneath)
  • jsoncpp
  • python3
  • python-truly helpful-toolkit (for python3)
  • python-setuptools (for python3)
  • pkg-config

Create Hang

git clone http://root.cern.ch/git/llvm.git src
cd src
git checkout hold-patches
cd tools
git clone http://root.cern.ch/git/hold.git
git clone http://root.cern.ch/git/clang.git
cd clang
git checkout hold-patches
cd ../..
mkdir possess inst
cd possess
cmake -DCMAKE_INSTALL_PREFIX=../inst ../src
cmake --possess .
cmake --possess . --aim set up

Create Inspector

git clone git@github.com:inspector-repl/inspector.git
cd inspector
mkdir possess
cd possess
cmake -DCMAKE_PREFIX_PATH="../inst" ..
cmake --possess .

Usage

# ship python bindings
# (requires clang 5/trunk for python3 strengthen, the clang division from hold is recent ample)
# and libclang into course
export PYTHONPATH=$(readlink -f /src/tools/clang/bindings/python/)
export LD_LIBRARY_PATH=$(readlink -f /inst/lib)
cd possess
./inspector prebuild ../test/test.cpp
gcc -o test-proc $(./inspector print-cflags) ../test/test.cpp
# birth repl cli
./inspector repl
# let program connect to repl
./test-proc

TODO

news image
Read Extra


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *