diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml deleted file mode 100644 index 1dc995588..000000000 --- a/.github/workflows/build-and-test.yml +++ /dev/null @@ -1,88 +0,0 @@ -#uses omake to build and test on ubuntu only - -name: build-and-test -on: - - pull_request - -jobs: - build: - runs-on: ubuntu-18.04 - - env: - OPAMJOBS: 2 - OPAMRETRES: 8 - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install OCaml - uses: ocaml/setup-ocaml@v2 - with: - ocaml-compiler: 4.08.x - dune-cache: true - - - name: Add the testing Repository - run: opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing - - - name: Pin OASIS - run: opam pin add oasis https://github.com/BinaryAnalysisPlatform/oasis.git - - - name: Install system dependencies - run: opam depext -u bap-extra - - - name: Pin BAP - run: opam pin add bap . --no-action - - - name: Install rest of the system dependencies - run: opam depext -u bap - - - name: Install Ghidra - run: | - sudo add-apt-repository ppa:ivg/ghidra -y - sudo apt-get install libghidra-dev -y - sudo apt-get install libghidra-data -y - - - name: Install opam dependencies - run: | - opam install bap --deps-only - opam install omake - - - name: Configure BAP - run: | - opam exec -- ./configure-omake \ - --enable-tests \ - --with-llvm-version=9 \ - --with-llvm-config=llvm-config-9 - - - name: Build BAP - run: opam exec -- make - - - name: Install BAP - run: opam exec -- make reinstall - - - name: Run Unit Tests - run: opam exec -- make test - - - name: Run Functional Tests - run: opam exec -- make check - - - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: bap-log - path: ~/.local/state/bap - - - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: unit-tests-log - path: _build/oUnit-*.log - - - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: fun-tests-log - path: | - testsuite/*.log - testsuite/logs diff --git a/.github/workflows/build-dev-repo.yml b/.github/workflows/build-dev-repo.yml deleted file mode 100644 index 6fc747b42..000000000 --- a/.github/workflows/build-dev-repo.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: build-dev-repo - -on: - - pull_request - -jobs: - build: - strategy: - matrix: - os: - - ubuntu-20.04 - - macos-11 - ocaml-compiler: - - 4.11.x - - 4.08.x - - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.os == 'macos-11'}} - - env: - TMPDIR: /tmp - XDG_CACHE_HOME: /tmp/cache - BAP_LOG_DIR: /tmp/bap-log - OPAMJOBS: 2 - OPAMRETRES: 8 - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Use OCaml ${{ matrix.ocaml-compiler }} - uses: ocaml/setup-ocaml@v2 - with: - ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: ${{ matrix.os != 'macos-11' }} - - - name: Add the testing Repository - run: opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing - - - name: Pin BAP - run: opam pin add bap . --no-action - - - name: Configure Homebrew LLVM - if: matrix.os == 'macos-11' - run: | - rm -rf /usr/local/bin/2to3 - rm -f $(opam var lib)/ocaml/version - brew unlink gcc@9 - brew update - brew upgrade - echo 'LLVM_CONFIG=/usr/local/opt/llvm@9/bin/llvm-config' >> $GITHUB_ENV - - - name: Install system dependencies - run: opam depext -u bap - - - name: Install opam dependencies - run: opam install bap --deps-only - - - name: Build and Install BAP - run: opam install bap - - - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: opam-log-${{ matrix.os }}-${{ matrix.ocaml-compiler }} - path: ~/.opam/log diff --git a/.github/workflows/full.yml b/.github/workflows/full.yml new file mode 100644 index 000000000..4f3aa90df --- /dev/null +++ b/.github/workflows/full.yml @@ -0,0 +1,53 @@ +# tests all packages, including bap-extra +# it requires ghidra, so it works only on ubuntu-20.04 +name: full +run-name: Testing everything in ${{ github.ref }} + +on: + - pull_request + +jobs: + build: + runs-on: ubuntu-20.04 + env: + BAP_LOG_DIR: $HOME/log + OPAMRETRES: 8 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Ghidra and Dejagnu + run: | + sudo add-apt-repository ppa:ivg/ghidra -y + sudo apt-get update -y + sudo apt-get install libghidra-dev -y + sudo apt-get install libghidra-data -y + sudo apt-get install dejagnu -y + + - name: Install OCaml + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: 4.14.x + dune-cache: true + opam-disable-sandboxing: true + + - name: Install BAP + run: opam install . --with-test + + - name: Run Functional Tests + run: opam exec -- make check + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: bap-log + path: ~/.local/state/bap + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: fun-tests-log + path: | + testsuite/*.log + testsuite/logs diff --git a/.github/workflows/check-the-style.yml b/.github/workflows/lint.yml similarity index 72% rename from .github/workflows/check-the-style.yml rename to .github/workflows/lint.yml index ad1bad16d..08bfe5732 100644 --- a/.github/workflows/check-the-style.yml +++ b/.github/workflows/lint.yml @@ -1,10 +1,11 @@ -name: check-the-style +name: lint +run-name: Linting ${{ github.ref }} on: - pull_request jobs: - build: + check: runs-on: ubuntu-latest env: @@ -18,7 +19,9 @@ jobs: - name: Setup OCaml uses: ocaml/setup-ocaml@v2 with: - ocaml-compiler: 4.08.x + ocaml-compiler: 4.14.x + opam-pin: false + opam-depext: false dune-cache: true - name: Check the Style diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..b0370be5d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,89 @@ +name: main +run-name: Testing main packages in ${{ github.ref }} +on: + - pull_request + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-20.04 + - macos-11 + ocaml-compiler: + - 4.08.x + - 4.14.x + exclude: + - os: macos-11 + ocaml-compiler: 4.08.x + + + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.os == 'macos-11'}} + + env: + TMPDIR: /tmp + XDG_CACHE_HOME: /tmp/cache + BAP_LOG_DIR: /tmp/bap-log + OPAMJOBS: 2 + OPAMRETRES: 8 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Prepare Ubuntu + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt-get update -y + sudo apt-get install dejagnu -y + + - name: Prepare macOS + if: matrix.os == 'macos-11' + run: | + echo 'LLVM_CONFIG=/usr/local/opt/llvm@9/bin/llvm-config' >> $GITHUB_ENV + brew install deja-gnu + + - name: Install OCaml + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: ${{ matrix.os != 'macos-11' }} + opam-disable-sandboxing: true + opam-local-packages: | + *.opam + !bap-extra.opam + !bap-radare2.opam + !bap-ghidra.opam + !bap-primus-symbolic-executor.opam + !bap-ida.opam + opam-repositories: | + default: git+https://github.com/ocaml/opam-repository.git + bap: git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing + + - name: Build BAP + run: opam install bap.dev --with-test + + - name: Run MC Functional Tests + run: | + opam exec -- make TOOLS=mc check + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: bap-log + path: ~/.local/state/bap + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: unit-tests-log + path: _build/default/lib_test/*/oUnit-*.log + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: fun-tests-log + path: | + testsuite/*.log + testsuite/logs diff --git a/.github/workflows/nightly-testing.yml b/.github/workflows/nightly.yml similarity index 72% rename from .github/workflows/nightly-testing.yml rename to .github/workflows/nightly.yml index 34e7d5627..1146116c7 100644 --- a/.github/workflows/nightly-testing.yml +++ b/.github/workflows/nightly.yml @@ -1,4 +1,5 @@ -name: nightly-regression-tests +name: nightly +run-name: Running nightly tests on ${{ github.sha }} on: schedule: @@ -10,9 +11,9 @@ jobs: strategy: matrix: os: - - ubuntu-18.04 + - ubuntu-20.04 ocaml-compiler: - - 4.11.x + - 4.14.x - 4.08.x runs-on: ${{ matrix.os }} @@ -22,29 +23,22 @@ jobs: OPAMRETRES: 8 steps: - - name: Use OCaml ${{ matrix.ocaml-compiler }} - uses: ocaml/setup-ocaml@master - with: - ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: true - cache-prefix: nightly - - - name: Install Ghidra + - name: Install Extra System Dependencies run: | sudo add-apt-repository ppa:ivg/ghidra -y sudo apt-get install libghidra-dev -y sudo apt-get install libghidra-data -y + sudo apt-get install dejagnu -y - - name: Add the Testing Repository - run: opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing - - name: Install System Dependencies - run: opam depext -u bap-extra - - - name: Install radare2 Dependencies - run: opam depext -u bap-radare2 - - - name: Cleanup the Caches - run: sudo apt clean --yes + - name: Use OCaml ${{ matrix.ocaml-compiler }} + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: ${{ matrix.os != 'macos-11' }} + opam-disable-sandboxing: true + opam-repositories: | + default: git+https://github.com/ocaml/opam-repository.git + bap: git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing - name: Build and Install BAP run: opam install bap-extra bap-radare2 @@ -54,11 +48,6 @@ jobs: with: repository: BinaryAnalysisPlatform/bap - - name: Install Extra System Dependencies - run: | - opam pin add bap . -n - opam depext -u bap - - name: Run Functional Tests run: opam exec -- make check diff --git a/.github/workflows/oasis.yml b/.github/workflows/oasis.yml new file mode 100644 index 000000000..bd1b9e043 --- /dev/null +++ b/.github/workflows/oasis.yml @@ -0,0 +1,96 @@ +name: oasis +run-name: Building ${{ github.ref }} with OASIS +on: + - pull_request + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-20.04 + - macos-11 + ocaml-compiler: + - 4.08.x + - 4.14.x + exclude: + - os: macos-11 + ocaml-compiler: 4.08.x + + + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.os == 'macos-11'}} + + env: + TMPDIR: /tmp + XDG_CACHE_HOME: /tmp/cache + BAP_LOG_DIR: /tmp/bap-log + OPAMJOBS: 2 + OPAMRETRES: 8 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Prepare Ubuntu + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt-get update -y + sudo apt-get install dejagnu -y + + - name: Prepare macOS + if: matrix.os == 'macos-11' + run: | + echo 'LLVM_CONFIG=/usr/local/opt/llvm@9/bin/llvm-config' >> $GITHUB_ENV + brew install deja-gnu + + - name: Install OCaml ${{ matrix.ocaml-compiler }} + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: ${{ matrix.os != 'macos-11' }} + opam-disable-sandboxing: true + opam-repositories: | + default: git+https://github.com/ocaml/opam-repository.git + bap: git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing + + - name: Install OPAM dependencies + run: opam install . --deps-only + + - name: Install dependencies requires for the OASIS build + run: opam install oasis ppx_bap conf-bap-llvm conf-binutils + + - name: Configure BAP + run: >- + BAP_DEBUG=true + opam exec -- + ./configure --enable-everything + --disable-ghidra + --disable-ida + --prefix=$(opam var prefix) + --with-llvm-config=$(opam var conf-bap-llvm:config) + --with-llvm-version=$(opam var conf-bap-llvm:package-version) + --objdump-paths="$(opam var conf-binutils:objdumps)" + + - name: Build BAP + run: opam exec -- make + + - name: Install BAP + run: opam exec -- make reinstall + + - name: Run functional tests + run: opam exec -- make check + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: bap-log + path: ~/.local/state/bap + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: fun-tests-log + path: | + testsuite/*.log + testsuite/logs diff --git a/.github/workflows/build-from-opam.yml b/.github/workflows/opam.yml similarity index 95% rename from .github/workflows/build-from-opam.yml rename to .github/workflows/opam.yml index 6c666bd72..b75ad9926 100644 --- a/.github/workflows/build-from-opam.yml +++ b/.github/workflows/opam.yml @@ -1,4 +1,5 @@ -name: build-from-opam +name: opam +run-name: Installing ${{ github.ref }} from opam on: - push diff --git a/.gitignore b/.gitignore index c05bc948b..a157e9c9b 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,8 @@ bap_main_config.ml tools/postinstall.ml OMakefile /testsuite/ +/config.status +/config.status.in +/_opam/ +/plugins/api/api_sites.ml +/plugins/stub_resolver/stub_resolver_sites.ml diff --git a/.merlin b/.merlin deleted file mode 100644 index f2f9e01b9..000000000 --- a/.merlin +++ /dev/null @@ -1,96 +0,0 @@ -FLG -short-paths -FLG -w +a-4-6-7-9-29-32..42-44-45-48-50-60 -FLG -safe-string - -PKG core_kernel -PKG core_kernel.caml_unix -PKG fileutils -PKG uri -PKG ppx_bap -PKG camlzip -PKG uuidm - -B _build -B _build/lib/bap -B _build/lib/bap_main -B _build/lib/bap_recipe -B _build/lib/bap_abi -B _build/lib/bap_api -B _build/lib/bitvec -B _build/lib/bitvec_order -B _build/lib/bitvec_sexp -B _build/lib/bap_bundle -B _build/lib/bap_c -B _build/lib/bap_config -B _build/lib/bap_disasm -B _build/lib/bap_dwarf -B _build/lib/bap_elf -B _build/lib/bap_future -B _build/lib/bap_image -B _build/lib/bap_plugins -B _build/lib/bap_sema -B _build/lib/bap_types -B _build/lib/bap_core_theory -B _build/lib/graphlib -B _build/lib/monads -B _build/lib/ogre -B _build/lib/bap_primus -B _build/lib/bap_llvm -B _build/lib/regular -B _build/lib/text_tags -B _build/lib/knowledge - -B lib/bap -B lib/bap_main -B lib/bap_recipe -B lib/bap_relation -B lib/bap_abi -B lib/bap_api -B lib/bitvec -B lib/bitvec_order -B lib/bitvec_sexp -B lib/bitvec_binprot -B lib/bap_bundle -B lib/bap_c -B lib/bap_config -B lib/bap_disasm -B lib/bap_dwarf -B lib/bap_elf -B lib/bap_future -B lib/bap_image -B lib/bap_plugins -B lib/bap_primus -B lib/bap_sema -B lib/bap_strings -B lib/bap_types -B lib/bap_core_theory -B lib/bap_traces -B lib/graphlib -B lib/monads -B lib/ogre -B lib/bap_primus -B lib/bap_llvm -B lib/regular -B lib/text_tags -B lib/knowledge -B lib/bap_powerpc - -S lib/bap -S lib/bap_main -S lib/bap_recipe -S lib/bap_abi -S lib/bap_api -S lib/bap_c -S lib/regular -S lib/graphlib -S lib/bap_future -S lib/bap_plugins -S lib/bap_bundle -S lib/bap_config -S lib/bap_types -S lib/bap_disasm -S lib/bap_image -S lib/monads -S lib/bap_primus -S lib/bap_llvm -S lib/ogre diff --git a/LICENSE b/LICENSE index b6c8fac59..66d9a6e6a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2021 Carnegie Mellon University +Copyright (c) 2014-2022 Carnegie Mellon University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index a2dd367b3..c9f6f1789 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ testsuite: git clone https://github.com/BinaryAnalysisPlatform/bap-testsuite.git testsuite check: testsuite - make REVISION=5909f59c5c29a7b143573bd49b8101a68ccded32 -C testsuite + make REVISION=5c65cc07c48ff738e843c0fc6dfb16a0eeb572c3 -C testsuite .PHONY: indent check-style status-clean diff --git a/README.md b/README.md index 7904af949..7a74ee8c3 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ ## Overview -The Carnegie Mellon University Binary Analysis Platform (CMU BAP) is a suite of utilities and libraries that enables analysis of programs in the machine code representation. BAP supports x86, x86-64, ARM, MIPS, PowerPC and new architectures can be added as plugins. BAP includes various analyses, standard interpreter, microexecution interpreter, and symbolic executor. BAP features its own domain-specific language, [Primus Lisp][primus-lisp], that is used for implementing analyses, specifying verification conditions, modeling functions (writing stubs) and even interfacing with the SMT solver. The [toolkit][toolkit] repository includes various examples of program analysis tools that could be implemented with BAP and can be used as the starting point (in addition to the [tutorial][bap-tutorial]) for implementing custom analyses. BAP can be used as a framework with a single [bap][demo] utility that is [extended with plugins][extending] or it can be used as a library [embedded][embedding] in a user application, which could be written in OCaml or, in any other language, using [C bindings][bap-bindings]. We also provide some [minimal support for Python][bap-python] to make it easier to start learning BAP. +The Carnegie Mellon University Binary Analysis Platform (CMU BAP) is a suite of utilities and libraries that enables analysis of binary programs. BAP supports x86, x86-64, ARM, MIPS, PowerPC and new architectures can be added using plugins. BAP includes various analyses, standard interpreter, microexecution interpreter, and a symbolic executor. BAP features its own domain-specific language, [Primus Lisp][primus-lisp], that is used for implementing analyses, specifying verification conditions, modeling functions (writing stubs), and even interfacing with the SMT solver. The [toolkit][toolkit] repository includes various examples of program analysis tools that could be implemented with BAP and can be used as the starting point (in addition to the [tutorial][bap-tutorial]) for implementing custom analyses. BAP can be used as a framework with a single [bap][demo] utility that is [extended with plugins][extending] or it can be used as a library [embedded][embedding] in a user application, which could be written in OCaml or, in any other language, using [C bindings][bap-bindings]. We also provide some [minimal support for Python][bap-python] to make it easier to start learning BAP. -BAP is developed in [CMU, Cylab](https://www.cylab.cmu.edu/) and is sponsored by grants from the United States Department of Defense, Siemens, Boeing, ForAllSecure, and the Korea government, see [sponsors](#Sponsors) for more information. BAP is used in various institutions and serves as a backbone for many interesting projects, some are highlighted below: +BAP was developed in [CMU, Cylab](https://www.cylab.cmu.edu/) and is sponsored by grants from the United States Department of Defense, Siemens, Boeing, ForAllSecure, and the Korea government, see [sponsors](#Sponsors) for more information. BAP is used in various institutions and serves as a backbone for many interesting projects, some are highlighted below: * [The CGC winner][cgc] [ForAllSecure Mayhem][mayhem] * [Draper's Laboratory CBAT Tools][cbat] * [Fraunhofer FKIE CWE Checker][cwe-checker] @@ -37,27 +37,36 @@ sudo dpkg -i {bap,libbap,libbap-dev}_2.5.0.deb Our binary packages do not include the OCaml development environment. If you are going to write an analysis in OCaml you need to install BAP from the source code using either [opam][opam-install] or by cloning and building this repository directly. The opam method is the recommended one. Once it is installed the following three commands should install the platform in a newly created switch. ```bash -opam init --comp=4.12.1 # inits opam and install the OCaml compiler -eval `opam config env` # activates opam environment -opam depext --install bap # installs bap and its dependencies +opam init --comp=4.14.1 # inits opam and install the OCaml compiler +opam install bap # installs bap and its dependencies +eval $(opam env)` # activates opam environment ``` -The `opam depext --install bap` command will try to install the system dependencies of BAP. If it fails, try to install the system dependencies manually, using your operating system package manager, and then use the common `opam install bap` command, to install BAP. If it still doesn't work, do not hesitate to drop by our [chat][gitter] and seek help there. It is manned with friendly people that will be happy to help. +The `opam install bap` command will try to install the system dependencies of BAP using your operating system package manager. If it fails due to a missing system dependency, try installing the system dependencies manually and then repeat the `opam install bap` command. If it still doesn't work, do not hesitate to drop by our [chat][gitter] and seek help there. It is manned with friendly people that will be happy to help. -The instruction above will get you the latest stable release of BAP. If you're interested in our rolling releases, which are automatically updated every time a commit to the master branch happens, then you can add our testing repository to opam, with the following command +The instruction above will get you the latest stable release of BAP. If you're interested in our rolling releases, which are automatically updated every time a commit to the master branch happens, then you can create a new switch that uses our testing repository ```bash -opam repo add bap-testing git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing +opam switch create bap-testing --repos \ + default,bap=git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing 4.14.1 +opam install bap ``` -After it is added, the `bap-testing` repository will take precedence over the stable repository and you will get the freshly picked BAP packages straight from the farm. +After it is added, the `bap` repository will take precedence over the stable repository and you will get the freshly picked BAP packages straight from the farm. -If you insist on building BAP manually or just want to tackle with BAP internals, then you can clone this repository and build it manually. You will need to start with a fresh environment without BAP being installed, to prevent clashes. You will obviously need to install the dependencies of BAP, our `configure` script will help you figure out the missing libraries. Once all the dependencies are satisfied, the following triplet will build and install the Platform: +If you want to build BAP manually or just want to tackle with BAP internals, then you can clone this repository and build it manually. We suggest your starting with a fresh environment without BAP being installed, to prevent clashes, or even better to use a local switch, e.g., ```bash -./configure --enable-everything -make -make install +git clone git@github.com:BinaryAnalysisPlatform/bap.git && cd bap +opam switch create . --deps-only +dune build && dune install ``` -The `configure` script lets you define a specific set of components that you need. We have nearly a hundred of components and naming them all will be too tedious, that's why we added the `--enable-everything` option. It plays nice with the `--disable-` component so that you can unselect components that are not relevant to your current task. For more tips and tricks see our [wiki][wiki] and do not hesitate to tip back. We encourage everyone to use our wiki for collaboration and information sharing. And as always, drop by [gitter][gitter] for a friendly chat. +The snippet above will clone bap, create a fresh local switch, install the necessary dependencies, including the system one, and, finally, build and install bap with dune. Alternatively, if you already have a switch where you want to build and install bap, you can use +``` +git clone git@github.com:BinaryAnalysisPlatform/bap.git && cd bap +opam install . --deps-only +dune build && dune install +``` + +to install bap and its dependencies into the currently selected switch. ## Using @@ -132,6 +141,25 @@ Let's briefly go through the code. The `counter` object is a visitor that has th A little bit more complex example, as well as an example that uses Python, can be found in our [tutorial][bap-tutorial]. + +### Building a plugin with dune + +You can also build and install bap plugins using dune. For that, you need to define a library and use the `plugin` stanza that uses this library. Below is the template `dune` file, +``` +(library + (name FOO) + (public_name OUR-FOO.plugin) + (libraries bap bap-main)) + +(plugin + (name FOO) + (package OUR-FOO) + (libraries OUR-FOO.plugin) + (site (bap-common plugins))) +``` + +Eveything that is capitalized in the above snippet is a placeholder that you shall substitute with appropriate private and public names for your plugin. Notice, that the `.plugin` extension is not necessary, but is percieved as a good convention. + ### Interactive REPL BAP also ships an interactive toplevel utility `baptop`. This is a shell-like utility that interactively evaluates OCaml expressions and prints their values. It will load BAP libraries and initialize all plugins for you, so you can interactively explore the vast world of BAP. The `baptop` utility can also serve as a non-interactive interpreter, so that you can run your OCaml scripts, e.g., `baptop myscript.ml` or you can even specify it using sha-bang at the top of your file, e.g., `#!/usr/bin/env baptop`. We built `baptop` using UTop, but you can easily use any other OCaml toplevel, including `ocaml` itself, just load the `bap.top` library, e.g., for vanilla `ocaml` toplevel use the following directives diff --git a/bap-abi.opam b/bap-abi.opam new file mode 100644 index 000000000..f9b888bcd --- /dev/null +++ b/bap-abi.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP plugin and library for ABI-specific transformations" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-pass" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-analyze.opam b/bap-analyze.opam new file mode 100644 index 000000000..46ecdfa53 --- /dev/null +++ b/bap-analyze.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Knowledge Base REPL" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "linenoise" {>= "1.1.0" & < "2.0.0"} + "monads" {= version} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-api.opam b/bap-api.opam new file mode 100644 index 000000000..646e14c57 --- /dev/null +++ b/bap-api.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP pass that adds arguments to subroutines" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-arm.opam b/bap-arm.opam new file mode 100644 index 000000000..b83285d8f --- /dev/null +++ b/bap-arm.opam @@ -0,0 +1,48 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP ARM support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-library" "arm"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bap-traces" {= version} + "bitvec-order" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-beagle-strings.opam b/bap-beagle-strings.opam new file mode 100644 index 000000000..9a6d57979 --- /dev/null +++ b/bap-beagle-strings.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Finds strings in binaries using microexecution" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "bap-beagle" {= version} + "ppx_bap" {= version} + "bap-std" {= version} + "bap-strings" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-beagle.opam b/bap-beagle.opam new file mode 100644 index 000000000..7270ca63c --- /dev/null +++ b/bap-beagle.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP obfuscated string solver" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-future" {= version} + "bap-microx" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bap-strings" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-bil.opam b/bap-bil.opam new file mode 100644 index 000000000..e83bc7991 --- /dev/null +++ b/bap-bil.opam @@ -0,0 +1,43 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Instruction Language (BIL)" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-future" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "bitvec-order" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-bml.opam b/bap-bml.opam new file mode 100644 index 000000000..e8b751a24 --- /dev/null +++ b/bap-bml.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Term Mapping Language (BML)" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-build.opam b/bap-build.opam new file mode 100644 index 000000000..91519beba --- /dev/null +++ b/bap-build.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Build Tool (ocamlbuild+bap)" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-tool" "ocamlbuild"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ocamlbuild" + "ocamlfind" + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-bundle.opam b/bap-bundle.opam new file mode 100644 index 000000000..ac9cc7adf --- /dev/null +++ b/bap-bundle.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A bundler for BAP plugins" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-tool"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "camlzip" {>= "1.0" & < "2.0"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "bap-common" {= version} + "ppx_bap" {= version} + "uri" {>= "4.2.0"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-byteweight-frontend.opam b/bap-byteweight-frontend.opam new file mode 100644 index 000000000..82ce3b459 --- /dev/null +++ b/bap-byteweight-frontend.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A frontend to the BAP function start identification framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-frontend" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-byteweight" {= version} + "bap-std" {= version} + "cmdliner" {>= "1.0" & < "2.0"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "bap-common" {= version} + "ocurl" {>= "0.9.0"} + "ppx_bap" {= version} + "re" {>= "1.0" & < "2.0"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-byteweight.opam b/bap-byteweight.opam new file mode 100644 index 000000000..30eebb787 --- /dev/null +++ b/bap-byteweight.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP function start identification library and pass" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-signatures" {= version} + "bap-std" {= version} + "camlzip" {>= "1.0" & < "2.0"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "uri" {>= "4.2.0"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-c.opam b/bap-c.opam new file mode 100644 index 000000000..03065f4c5 --- /dev/null +++ b/bap-c.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The C language support library for BAP" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "c"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-cache.opam b/bap-cache.opam new file mode 100644 index 000000000..5091474c2 --- /dev/null +++ b/bap-cache.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP cache management" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "mmap" + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "uuidm" {>= "0.9.7"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-callgraph-collator.opam b/bap-callgraph-collator.opam new file mode 100644 index 000000000..818d1bba6 --- /dev/null +++ b/bap-callgraph-collator.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Compares binaries callgraphs" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-analysis"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "bap-common" {= version} + "ppx_bap" {= version} + "re" {>= "1.0" & < "2.0"} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-callsites.opam b/bap-callsites.opam new file mode 100644 index 000000000..f3ab5be24 --- /dev/null +++ b/bap-callsites.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP pass that injects data definitions at call sites" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-pass"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-common.opam b/bap-common.opam new file mode 100644 index 000000000..38b5e8d38 --- /dev/null +++ b/bap-common.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A Package on which all BAP packages depend" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "meta"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "base" {>= "v0.14" & < "v0.16"} + "dune" {>= "3.1"} + "dune-configurator" + "dune-site" + "ocaml" {> "4.08.0"} + "stdio" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-constant-tracker.opam b/bap-constant-tracker.opam new file mode 100644 index 000000000..5694ea248 --- /dev/null +++ b/bap-constant-tracker.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A constant tracking analysis based on BAP Primus" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-analysis" "bap-plugin" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-core-theory.opam b/bap-core-theory.opam new file mode 100644 index 000000000..23dba49f1 --- /dev/null +++ b/bap-core-theory.opam @@ -0,0 +1,42 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Machine Code Semantics" +description: + "The Core Theory is an intermediate language that is designed to express the semantics of computer programs. It focuses on programs that are represented in binary machine code and is capable of an accurate representation of the architectural and micro-architectural details of the program behavior." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-knowledge" {= version} + "bap-main" {= version} + "bitvec" {= version} + "bitvec-binprot" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-core.opam b/bap-core.opam new file mode 100644 index 000000000..9e5ecf3e9 --- /dev/null +++ b/bap-core.opam @@ -0,0 +1,81 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The core BAP packages" +description: "the meta package to install the core parts of BAP" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "meta"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-analyze" {= version} + "bap-api" {= version} + "bap-arm" {= version} + "bap-bil" {= version} + "bap-build" {= version} + "bap-bundle" {= version} + "bap-byteweight" {= version} + "bap-cache" {= version} + "bap-callgraph-collator" {= version} + "bap-callsites" {= version} + "bap-c" {= version} + "bap-cxxfilt" {= version} + "bap-demangle" {= version} + "bap-dependencies" {= version} + "bap-disassemble" {= version} + "bap-dump-symbols" {= version} + "bap-elementary" {= version} + "bap-flatten" {= version} + "bap-frontc" {= version} + "bap-frontend" {= version} + "bap-glibc-runtime" {= version} + "bap-llvm" {= version} + "bap-mc" {= version} + "bap-mips" {= version} + "bap-objdump" {= version} + "bap-optimization" {= version} + "bap-patterns" {= version} + "bap-plugins" {= version} + "bap-powerpc" {= version} + "bap-primus-lisp" {= version} + "bap-primus" {= version} + "bap-print" {= version} + "bap-raw" {= version} + "bap-recipe-command" {= version} + "bap-recipe" {= version} + "bap-relation" {= version} + "bap-relocatable" {= version} + "bap-report" {= version} + "bap-riscv" {= version} + "bap-specification" {= version} + "bap-ssa" {= version} + "bap-std" {= version} + "bap-stub-resolver" {= version} + "bap-symbol-reader" {= version} + "bap-systemz" {= version} + "bap-thumb" {= version} + "bap-toplevel" {= version} + "bap-x86" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-cxxfilt.opam b/bap-cxxfilt.opam new file mode 100644 index 000000000..cacc15a35 --- /dev/null +++ b/bap-cxxfilt.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A name demangler that uses system's c++filt" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-demangle" {= version} + "bap-std" {= version} + "conf-binutils" {>= "0.3"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-demangle.opam b/bap-demangle.opam new file mode 100644 index 000000000..35563b8a5 --- /dev/null +++ b/bap-demangle.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Provides names service and demangling facilities for BAP" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-dependencies.opam b/bap-dependencies.opam new file mode 100644 index 000000000..d7410b4cf --- /dev/null +++ b/bap-dependencies.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Shows program depenencies" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-disassemble.opam b/bap-disassemble.opam new file mode 100644 index 000000000..86181fbd0 --- /dev/null +++ b/bap-disassemble.opam @@ -0,0 +1,46 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Disassembles and analyzes binaries using BAP" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bitvec-binprot" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-dump-symbols.opam b/bap-dump-symbols.opam new file mode 100644 index 000000000..f5e68a388 --- /dev/null +++ b/bap-dump-symbols.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP plugin for dumping symbol information" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-dwarf.opam b/bap-dwarf.opam new file mode 100644 index 000000000..04f466622 --- /dev/null +++ b/bap-dwarf.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP DWARF parser" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "dwarf"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-elementary.opam b/bap-elementary.opam new file mode 100644 index 000000000..23ada57ad --- /dev/null +++ b/bap-elementary.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Floating-point approximations of elementary functions" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "floating-points"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-elf.opam b/bap-elf.opam new file mode 100644 index 000000000..000bfa8e4 --- /dev/null +++ b/bap-elf.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP ELF parser and program loader" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "elf"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-dwarf" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "ppx_bitstring" {>= "4.0.0" & < "5.0.0"} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-extra.opam b/bap-extra.opam new file mode 100644 index 000000000..73afb837f --- /dev/null +++ b/bap-extra.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The extra BAP packages" +description: "the meta package to install the core parts of BAP" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "meta"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap" {= version} + "bap-byteweight-frontend" {= version} + "bap-elf" {= version} + "bap-primus-symbolic-executor" {= version} + "bap-ghidra" {= version} + "bap-trace" {= version} + "bap-traces" {= version} + "bap-radare2" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-flatten.opam b/bap-flatten.opam new file mode 100644 index 000000000..bbd4f305a --- /dev/null +++ b/bap-flatten.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP pass that flattens program to TAC" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-frontc.opam b/bap-frontc.opam new file mode 100644 index 000000000..aaa71bcb4 --- /dev/null +++ b/bap-frontc.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP C language fronted based on FrontC" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "c"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-c" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "FrontC" {>= "4.1.0"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-frontend.opam b/bap-frontend.opam new file mode 100644 index 000000000..9352f4ce0 --- /dev/null +++ b/bap-frontend.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The main BAP command-line tool" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ocamlfind" + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-future.opam b/bap-future.opam new file mode 100644 index 000000000..f3de322c7 --- /dev/null +++ b/bap-future.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A library for asynchronous values" +description: + "A library for reasoning about state based dynamic systems. This can be seen as a common denominator between Lwt and Async libraries." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "future"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-ghidra.opam b/bap-ghidra.opam new file mode 100644 index 000000000..eead1e0f5 --- /dev/null +++ b/bap-ghidra.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The BAP NSA Ghidra backend" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "ghidra" "disassembler"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "bap-common" {= version} + "bap-std" {= version} + "bap-main" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-glibc-runtime.opam b/bap-glibc-runtime.opam new file mode 100644 index 000000000..e45ad10b0 --- /dev/null +++ b/bap-glibc-runtime.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The BAP Glibc Runtime support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-c" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ogre" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-ida-plugin.opam b/bap-ida-plugin.opam new file mode 100644 index 000000000..64e0120f6 --- /dev/null +++ b/bap-ida-plugin.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP IDA Pro integration" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-ida" "ida-pro"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-ida.opam b/bap-ida.opam new file mode 100644 index 000000000..3e7a7c1c8 --- /dev/null +++ b/bap-ida.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP IDA Pro integration" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "ida-pro"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "regular" {= version} + "fileutils" + "bap-common" {= version} + "bap-std" {= version} + "re" {>= "1.0" & < "2.0"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-knowledge.opam b/bap-knowledge.opam new file mode 100644 index 000000000..0d7ace58d --- /dev/null +++ b/bap-knowledge.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Knowledge Reasoning and Representation Framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "knowledge"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "bap-common" {= version} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-llvm.opam b/bap-llvm.opam new file mode 100644 index 000000000..9e30543a5 --- /dev/null +++ b/bap-llvm.opam @@ -0,0 +1,50 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP LLVM backend" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "llvm"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "conf-bap-llvm" {>= "1.8"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "mmap" + "monads" {= version} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" +build: [ + ["dune" "subst"] {dev} + [ + "ocaml" "tools/configure.ml" + "--with-llvm-config=%{conf-bap-llvm:config}%" + ] + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] + +depexts: [ + ["clang" "libncurses5-dev"] {os-distribution = "ubuntu"} + ["clang"] {os-distribution = "debian"} + ["clang" "libxml2-dev"] {os-distribution = "alpine"} + ["clang"] {os-distribution = "fedora"} +] diff --git a/bap-llvm.opam.template b/bap-llvm.opam.template new file mode 100644 index 000000000..023dc359f --- /dev/null +++ b/bap-llvm.opam.template @@ -0,0 +1,27 @@ +build: [ + ["dune" "subst"] {dev} + [ + "ocaml" "tools/configure.ml" + "--with-llvm-config=%{conf-bap-llvm:config}%" + ] + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] + +depexts: [ + ["clang" "libncurses5-dev"] {os-distribution = "ubuntu"} + ["clang"] {os-distribution = "debian"} + ["clang" "libxml2-dev"] {os-distribution = "alpine"} + ["clang"] {os-distribution = "fedora"} +] diff --git a/bap-main.opam b/bap-main.opam new file mode 100644 index 000000000..1384328d1 --- /dev/null +++ b/bap-main.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The BAP Framework Configuration Library" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-build" {= version} + "bap-future" {= version} + "bap-plugins" {= version} + "bap-recipe" {= version} + "base" {>= "v0.14" & < "v0.16"} + "cmdliner" {>= "1.0" & < "2.0"} + "bap-common" {= version} + "stdio" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-mc.opam b/bap-mc.opam new file mode 100644 index 000000000..40a9a4496 --- /dev/null +++ b/bap-mc.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Machine Code Playground (BAP's llvm-mc)" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-microx.opam b/bap-microx.opam new file mode 100644 index 000000000..5ca6452db --- /dev/null +++ b/bap-microx.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Legacy Microexecution Framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-mips.opam b/bap-mips.opam new file mode 100644 index 000000000..f1ea9e606 --- /dev/null +++ b/bap-mips.opam @@ -0,0 +1,44 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP MIPS Semantics" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "mips"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-objdump.opam b/bap-objdump.opam new file mode 100644 index 000000000..0aebe19d9 --- /dev/null +++ b/bap-objdump.opam @@ -0,0 +1,46 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Extracts symbols from a binary using binutils objdump" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "conf-binutils" {>= "0.3"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "re" {>= "1.0" & < "2.0"} + "odoc" {with-doc} +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" +build: [ + ["dune" "subst"] {dev} + ["ocaml" "tools/configure.ml" "--prefix=%{prefix}%" + "--objdump-paths=%{conf-binutils:objdumps}%"] + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] diff --git a/bap-objdump.opam.template b/bap-objdump.opam.template new file mode 100644 index 000000000..365d1b092 --- /dev/null +++ b/bap-objdump.opam.template @@ -0,0 +1,18 @@ +build: [ + ["dune" "subst"] {dev} + ["ocaml" "tools/configure.ml" "--prefix=%{prefix}%" + "--objdump-paths=%{conf-binutils:objdumps}%"] + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] diff --git a/bap-optimization.opam b/bap-optimization.opam new file mode 100644 index 000000000..3a7cc8a3c --- /dev/null +++ b/bap-optimization.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP IR optimization pass" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-pass"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "bap-std" {= version} + "regular" {= version} + "graphlib" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-patterns.opam b/bap-patterns.opam new file mode 100644 index 000000000..7b9676e8b --- /dev/null +++ b/bap-patterns.opam @@ -0,0 +1,47 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Applies semantic actions to the matching byte patterns" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bitvec-binprot" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "bap-common" {= version} + "ppx_bap" {= version} + "uri" {>= "4.2.0"} + "xmlm" {>= "1.3.0"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-phoenix.opam b/bap-phoenix.opam new file mode 100644 index 000000000..d8abb8ba0 --- /dev/null +++ b/bap-phoenix.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Dumps BAP project in the phoenix format" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-std" {= version} + "cmdliner" + "cmdliner" {>= "1.0" & < "2.0"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ezjsonm" + "graphlib" {= version} + "ppx_bap" {= version} + "regular" {= version} + "text-tags" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-piqi.opam b/bap-piqi.opam new file mode 100644 index 000000000..61b3b62ab --- /dev/null +++ b/bap-piqi.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Serializes BAP Project in various formats using piqi" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "piqi" {>= "0.7.8"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-plugins.opam b/bap-plugins.opam new file mode 100644 index 000000000..784ef9f73 --- /dev/null +++ b/bap-plugins.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Plugin management library" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-bundle" {= version} + "bap-future" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "ocamlfind" + "ppx_bap" {= version} + "uri" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-powerpc.opam b/bap-powerpc.opam new file mode 100644 index 000000000..ac5cee521 --- /dev/null +++ b/bap-powerpc.opam @@ -0,0 +1,45 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP PowerPC semantics" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "powerpc"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-dictionary.opam b/bap-primus-dictionary.opam new file mode 100644 index 000000000..450a6485a --- /dev/null +++ b/bap-primus-dictionary.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Provides dictionary data structure to Primus Lisp" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-exploring-scheduler.opam b/bap-primus-exploring-scheduler.opam new file mode 100644 index 000000000..e8d0b2bf0 --- /dev/null +++ b/bap-primus-exploring-scheduler.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus scheduler" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-greedy-scheduler.opam b/bap-primus-greedy-scheduler.opam new file mode 100644 index 000000000..e8d0b2bf0 --- /dev/null +++ b/bap-primus-greedy-scheduler.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus scheduler" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-limit.opam b/bap-primus-limit.opam new file mode 100644 index 000000000..b461ad79a --- /dev/null +++ b/bap-primus-limit.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Enables BAP Primus interpreter termination " +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-lisp.opam b/bap-primus-lisp.opam new file mode 100644 index 000000000..1b2adc595 --- /dev/null +++ b/bap-primus-lisp.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Primus Lisp runtime" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-loader.opam b/bap-primus-loader.opam new file mode 100644 index 000000000..d8072e954 --- /dev/null +++ b/bap-primus-loader.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Primus loader" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-mark-visited.opam b/bap-primus-mark-visited.opam new file mode 100644 index 000000000..f0dbd8429 --- /dev/null +++ b/bap-primus-mark-visited.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus coverage tracker" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus-track-visited" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-powerpc.opam b/bap-primus-powerpc.opam new file mode 100644 index 000000000..ca01881cc --- /dev/null +++ b/bap-primus-powerpc.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus PowerPC support module" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-print.opam b/bap-primus-print.opam new file mode 100644 index 000000000..9c7a5e889 --- /dev/null +++ b/bap-primus-print.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus state and observations printer" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-future" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bare" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-promiscuous.opam b/bap-primus-promiscuous.opam new file mode 100644 index 000000000..b98fbb057 --- /dev/null +++ b/bap-primus-promiscuous.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus promiscuous executor" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-propagate-taint.opam b/bap-primus-propagate-taint.opam new file mode 100644 index 000000000..849dcf30f --- /dev/null +++ b/bap-primus-propagate-taint.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus legacy taint engine compatibility layer" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bap-taint" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-random.opam b/bap-primus-random.opam new file mode 100644 index 000000000..6c2fe76a2 --- /dev/null +++ b/bap-primus-random.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus value randomizer" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-region.opam b/bap-primus-region.opam new file mode 100644 index 000000000..c331c980c --- /dev/null +++ b/bap-primus-region.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus Lisp regions library" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus" "bap-primus-lisp"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-round-robin-scheduler.opam b/bap-primus-round-robin-scheduler.opam new file mode 100644 index 000000000..e8d0b2bf0 --- /dev/null +++ b/bap-primus-round-robin-scheduler.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus scheduler" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-support.opam b/bap-primus-support.opam new file mode 100644 index 000000000..f111dfd89 --- /dev/null +++ b/bap-primus-support.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Provides essential Primus components" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "meta"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-primus-exploring-scheduler" {= version} + "bap-primus-greedy-scheduler" {= version} + "bap-primus-limit" {= version} + "bap-primus-loader" {= version} + "bap-primus-mark-visited" {= version} + "bap-primus-print" {= version} + "bap-primus-promiscuous" {= version} + "bap-primus-round-robin-scheduler" {= version} + "bap-primus-wandering-scheduler" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-symbolic-executor.opam b/bap-primus-symbolic-executor.opam new file mode 100644 index 000000000..bdd4bd3a1 --- /dev/null +++ b/bap-primus-symbolic-executor.opam @@ -0,0 +1,42 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus symbolic executor" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-primus-track-visited" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "regular" {= version} + "bitvec" {= version} + "zarith" + "z3" {>= "4.8.8-1" & < "4.8.13"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-systems.opam b/bap-primus-systems.opam new file mode 100644 index 000000000..a5ea180a2 --- /dev/null +++ b/bap-primus-systems.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus systems repository" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-taint.opam b/bap-primus-taint.opam new file mode 100644 index 000000000..26e77081b --- /dev/null +++ b/bap-primus-taint.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus taint analysis framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-taint" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-test.opam b/bap-primus-test.opam new file mode 100644 index 000000000..93c8c67ad --- /dev/null +++ b/bap-primus-test.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus testing and program verification framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-track-visited.opam b/bap-primus-track-visited.opam new file mode 100644 index 000000000..b9b4d4b4e --- /dev/null +++ b/bap-primus-track-visited.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus coverage tracker library" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-wandering-scheduler.opam b/bap-primus-wandering-scheduler.opam new file mode 100644 index 000000000..e8d0b2bf0 --- /dev/null +++ b/bap-primus-wandering-scheduler.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus scheduler" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus-x86.opam b/bap-primus-x86.opam new file mode 100644 index 000000000..8287f7ff6 --- /dev/null +++ b/bap-primus-x86.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A BAP Primus X86 support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-x86" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-primus.opam b/bap-primus.opam new file mode 100644 index 000000000..c5d395e63 --- /dev/null +++ b/bap-primus.opam @@ -0,0 +1,48 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Microexecution Framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library" "bap-primus"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-future" {= version} + "bap-knowledge" {= version} + "bap-std" {= version} + "bap-strings" {= version} + "bitvec-binprot" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "monads" {= version} + "parsexp" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "regular" {= version} + "uuidm" {>= "0.9.7"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-print.opam b/bap-print.opam new file mode 100644 index 000000000..e96015b10 --- /dev/null +++ b/bap-print.opam @@ -0,0 +1,42 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Prints BAP project in various human-readable formats" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-demangle" {= version} + "bap-knowledge" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "re" {>= "1.0" & < "2.0"} + "regular" {= version} + "text-tags" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-radare2.opam b/bap-radare2.opam new file mode 100644 index 000000000..6dec2df3f --- /dev/null +++ b/bap-radare2.opam @@ -0,0 +1,48 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Radare2 integration" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "radare2"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-arm" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-future" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bitvec" {= version} + "conf-radare2" + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "ppx_bap" {= version} + "re" {>= "1.0" & < "2.0"} + "yojson" + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-raw.opam b/bap-raw.opam new file mode 100644 index 000000000..8d8a4935d --- /dev/null +++ b/bap-raw.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP raw files loader" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "bap-std" {= version} + "bap-main" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-recipe-command.opam b/bap-recipe-command.opam new file mode 100644 index 000000000..1c83d1688 --- /dev/null +++ b/bap-recipe-command.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Manages BAP recipes" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command" "bap-tool"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-main" {= version} + "bap-recipe" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-recipe.opam b/bap-recipe.opam new file mode 100644 index 000000000..30bfdf7d2 --- /dev/null +++ b/bap-recipe.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Bundles together command-line options and resources" +description: + "A recipe is either a single file or a directory (optionally zipped) that contains a parametrized specification of command-line parameters and support files if necessary." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-tool" "command-line"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "parsexp" {>= "v0.14" & < "v0.16"} + "stdio" {>= "v0.14" & < "v0.16"} + "stdlib-shims" + "uuidm" {>= "0.9.7"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-relation.opam b/bap-relation.opam new file mode 100644 index 000000000..a4169dc0a --- /dev/null +++ b/bap-relation.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A set of relations (bimap) " +description: + "A relation between two sets is a set of pairs made from the elements of these sets. This library implements a bidirectional mapping between two sets and computes their matching that defines bijections between the sets." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "data-structure"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-relocatable.opam b/bap-relocatable.opam new file mode 100644 index 000000000..5ca8913cd --- /dev/null +++ b/bap-relocatable.opam @@ -0,0 +1,48 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP plugin that manages symbol relocations" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-arm" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-powerpc" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bap-x86" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-report.opam b/bap-report.opam new file mode 100644 index 000000000..bd1decb2c --- /dev/null +++ b/bap-report.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP plugin for reporting progress bars and statuses" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "bap-std" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-riscv.opam b/bap-riscv.opam new file mode 100644 index 000000000..ba986487e --- /dev/null +++ b/bap-riscv.opam @@ -0,0 +1,42 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP RISCV support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "riscv"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-knowledge" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-run.opam b/bap-run.opam new file mode 100644 index 000000000..38acb0bfb --- /dev/null +++ b/bap-run.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Primus Framework frontend" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "monads" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-signatures.opam b/bap-signatures.opam new file mode 100644 index 000000000..2a6d77568 --- /dev/null +++ b/bap-signatures.opam @@ -0,0 +1,28 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A data package with BAP binary signatures" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "data"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "odoc" {with-doc} +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" + +build: [] +install: [ + ["tar" "xvf" "sigs.tar.gz"] + ["mkdir" "-p" "%{share}%/bap/signatures/"] + ["cp" "data/sigs.zip" "%{share}%/bap/signatures/byteweight.zip"] + ["cp" "-r" "data/Ghidra" "%{share}%/bap/signatures/"] +] +extra-source "sigs.tar.gz" { + src: + "https://github.com/BinaryAnalysisPlatform/bap/releases/download/v2.4.0/sigs.tar.gz" + checksum: "md5=04e2ebb1b30d2d12bf2ceb240544044f" +} diff --git a/bap-signatures.opam.template b/bap-signatures.opam.template new file mode 100644 index 000000000..db9458863 --- /dev/null +++ b/bap-signatures.opam.template @@ -0,0 +1,13 @@ + +build: [] +install: [ + ["tar" "xvf" "sigs.tar.gz"] + ["mkdir" "-p" "%{share}%/bap/signatures/"] + ["cp" "data/sigs.zip" "%{share}%/bap/signatures/byteweight.zip"] + ["cp" "-r" "data/Ghidra" "%{share}%/bap/signatures/"] +] +extra-source "sigs.tar.gz" { + src: + "https://github.com/BinaryAnalysisPlatform/bap/releases/download/v2.4.0/sigs.tar.gz" + checksum: "md5=04e2ebb1b30d2d12bf2ceb240544044f" +} diff --git a/bap-specification.opam b/bap-specification.opam new file mode 100644 index 000000000..74e4dff1d --- /dev/null +++ b/bap-specification.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Extracts meta information from binaries" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-command"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-ssa.opam b/bap-ssa.opam new file mode 100644 index 000000000..bbf6c0638 --- /dev/null +++ b/bap-ssa.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Translates program into the SSA form" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-std.opam b/bap-std.opam new file mode 100644 index 000000000..91c0c275b --- /dev/null +++ b/bap-std.opam @@ -0,0 +1,59 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Standard Library" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-bundle" {= version} + "bap-core-theory" {= version} + "bap-future" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-plugins" {= version} + "bap-relation" {= version} + "base-unix" + "bitvec-order" {= version} + "bitvec" {= version} + "camlzip" {>= "1.07" & < "2.0"} + "cmdliner" + "core_kernel" {>= "v0.14" & < "v0.16"} + "fileutils" + "graphlib" {= version} + "mmap" + "monads" {= version} + "ocamlfind" {>= "1.5.6" & < "2.0.0"} + "ogre" {= version} + "ounit" + "ppx_bap" {= version} + "regular" {= version} + "result" + "uri" + "utop" {>= "2.0.0"} + "uuidm" + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-strings.opam b/bap-strings.opam new file mode 100644 index 000000000..2a1970abd --- /dev/null +++ b/bap-strings.opam @@ -0,0 +1,46 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Text utilities useful in Binary Analysis and Reverse Engineering" +description: """ +The library provides several algorithms: + +- Detector - that uses a maximum aposteriori likelihood estimator + (MAP) to detect code that operates with textual data (aka Bayesian + inference). + +- Unscrambler - that is capable of finding all possible words, that + can be built from a bag of letters in O(1). + +- Scanner - a generic algorithm for finding strings of characters (a + library variant of strings tool)""" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-stub-resolver.opam b/bap-stub-resolver.opam new file mode 100644 index 000000000..d1dd3c727 --- /dev/null +++ b/bap-stub-resolver.opam @@ -0,0 +1,43 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Relinks stubs to their implementations" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-relation" {= version} + "bap-std" {= version} + "bitvec-order" {= version} + "bitvec-sexp" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-symbol-reader.opam b/bap-symbol-reader.opam new file mode 100644 index 000000000..f4a6d0124 --- /dev/null +++ b/bap-symbol-reader.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Reads symbol information from a file" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-relation" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-systemz.opam b/bap-systemz.opam new file mode 100644 index 000000000..46f2949d4 --- /dev/null +++ b/bap-systemz.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Systemz support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugins"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-taint-propagator.opam b/bap-taint-propagator.opam new file mode 100644 index 000000000..b7918b6cc --- /dev/null +++ b/bap-taint-propagator.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Legacy Taint propagation engine" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-microx" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "graphlib" {= version} + "monads" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-taint.opam b/bap-taint.opam new file mode 100644 index 000000000..4fc2a1581 --- /dev/null +++ b/bap-taint.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Taint Analysis Framework" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bap-strings" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "monads" {= version} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-term-mapper.opam b/bap-term-mapper.opam new file mode 100644 index 000000000..b57b3d56c --- /dev/null +++ b/bap-term-mapper.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP program transformation DSL" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-bml" {= version} + "bap-common" {= version} + "bap-main" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-thumb.opam b/bap-thumb.opam new file mode 100644 index 000000000..96c77c4bc --- /dev/null +++ b/bap-thumb.opam @@ -0,0 +1,41 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Thumb support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-arm" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-knowledge" {= version} + "bap-main" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-toplevel.opam b/bap-toplevel.opam new file mode 100644 index 000000000..3c4179888 --- /dev/null +++ b/bap-toplevel.opam @@ -0,0 +1,37 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP toplevel, baptop" +description: + "The utop-enhanced bap toplevel interpreter. Run `baptop` and start using bap right away. Or use it as the interpreter for your BAP scripts, e.g., `baptop myprog.ml`" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "toplevel"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ocamlfind" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-trace.opam b/bap-trace.opam new file mode 100644 index 000000000..3d18922c2 --- /dev/null +++ b/bap-trace.opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP plugin for loading and inspecting execution traces" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-future" {= version} + "bap-plugins" {= version} + "bap-std" {= version} + "bap-traces" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "regular" {= version} + "uri" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-traces.opam b/bap-traces.opam new file mode 100644 index 000000000..fd3a34b41 --- /dev/null +++ b/bap-traces.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP execution traces abstractions" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "bap-std" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "regular" {= version} + "uri" {>= "1.9.0"} + "uuidm" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-trivial-condition-form.opam b/bap-trivial-condition-form.opam new file mode 100644 index 000000000..c4ae59347 --- /dev/null +++ b/bap-trivial-condition-form.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Eliminates complex branch conditions" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "bap-std" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-warn-unused.opam b/bap-warn-unused.opam new file mode 100644 index 000000000..0bb27692c --- /dev/null +++ b/bap-warn-unused.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Warns if an unused argument may cause an issue" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "bap-std" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap-x86.opam b/bap-x86.opam new file mode 100644 index 000000000..4305b3a1a --- /dev/null +++ b/bap-x86.opam @@ -0,0 +1,49 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP x86/x86-64 support package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-plugin" "bap-library" "x86" "x86-64"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-abi" {= version} + "bap-api" {= version} + "bap-common" {= version} + "bap-core-theory" {= version} + "bap-c" {= version} + "bap-demangle" {= version} + "bap-future" {= version} + "bap-knowledge" {= version} + "bap-llvm" {= version} + "bap-main" {= version} + "bap-primus" {= version} + "bap-std" {= version} + "bitvec" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ogre" {= version} + "ppx_bap" {= version} + "regular" {= version} + "zarith" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bap.opam b/bap.opam new file mode 100644 index 000000000..c55fb23e2 --- /dev/null +++ b/bap.opam @@ -0,0 +1,53 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Meta Package" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "meta"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-core" {= version} + "bap-beagle" {= version} + "bap-beagle-strings" {= version} + "bap-constant-tracker" {= version} + "bap-microx" {= version} + "bap-primus-dictionary" {= version} + "bap-primus-powerpc" {= version} + "bap-primus-propagate-taint" {= version} + "bap-primus-random" {= version} + "bap-primus-region" {= version} + "bap-primus-support" {= version} + "bap-primus-systems" {= version} + "bap-primus-taint" {= version} + "bap-primus-test" {= version} + "bap-primus-x86" {= version} + "bap-run" {= version} + "bap-strings" {= version} + "bap-taint" {= version} + "bap-taint-propagator" {= version} + "bap-term-mapper" {= version} + "bap-trivial-condition-form" {= version} + "bap-warn-unused" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bare.opam b/bare.opam new file mode 100644 index 000000000..3cd1fc74d --- /dev/null +++ b/bare.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP Rule Engine" +description: + "BARE is a library that provides the non-linear pattern matching on streams of facts that are represented as s-expressions." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "parsexp" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/benchmarks/.merlin b/benchmarks/.merlin deleted file mode 100644 index 041056706..000000000 --- a/benchmarks/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -B ../_build/lib_test/bap_core -B ../_build/lib_test/bap_dwarf -B ../_build/lib_test/bap_elf -B ../_build/lib_test/bap_image -B ../_build/lib_test/bap_types -PKG core -PKG core_bench -REC diff --git a/bitvec-binprot.opam b/bitvec-binprot.opam new file mode 100644 index 000000000..3d7b3f5fa --- /dev/null +++ b/bitvec-binprot.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Janestreet's Binprot serialization for Bitvec" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bin_prot" {>= "v0.14" & < "v0.16"} + "bitvec" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bitvec-order.opam b/bitvec-order.opam new file mode 100644 index 000000000..a600fc070 --- /dev/null +++ b/bitvec-order.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "The Base-compatible comparators and orders for Bitvec " +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "base" {>= "v0.14"} + "bitvec-sexp" {= version} + "bitvec" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bitvec-sexp.opam b/bitvec-sexp.opam new file mode 100644 index 000000000..d8259050c --- /dev/null +++ b/bitvec-sexp.opam @@ -0,0 +1,33 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Sexp serializers for Bitvec" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "sexp"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "sexplib0" {>= "v0.14"} + "bitvec" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/bitvec.opam b/bitvec.opam new file mode 100644 index 000000000..1e4555cad --- /dev/null +++ b/bitvec.opam @@ -0,0 +1,32 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Fixed-size bitvectors and modular arithmetic, based on Zarith" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "bap-library"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "zarith" {>= "1.4"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/dune b/dune new file mode 100644 index 000000000..7736d71b2 --- /dev/null +++ b/dune @@ -0,0 +1,47 @@ +(env + (dev + (flags (:standard + -warn-error -A + -w -6-9-27-32..34-37-50-58)) + (ocamlopt_flags (:standard -O3)))) + + +(rule + (target config.status.in) + (mode fallback) + (action (with-stdout-to %{target} (echo "")))) + +(rule + (alias config) + (target config.status) + (deps config.status.in) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -init)))))) + + +(library + (name ppx_bap) + (public_name ppx_bap) + (kind ppx_rewriter) + (libraries + ppx_assert + ppx_bench + ppx_bin_prot + ppx_compare + ppx_enumerate + ppx_fields_conv + ppx_hash + ppx_here + ppxlib + ppx_optcomp + ppx_sexp_conv + ppx_sexp_value + ppx_variants_conv) + (preprocess no_preprocessing)) + +(alias + (name default) + (deps (alias_rec install))) diff --git a/dune-project b/dune-project new file mode 100644 index 000000000..6d1245d76 --- /dev/null +++ b/dune-project @@ -0,0 +1,1640 @@ +(lang dune 3.1) +(using dune_site 0.1) + +(name bap) +(license MIT) +(version 0639b56-dirty) +(authors "The BAP Team") +(maintainers "Ivan Gotovchits ") +(source (github BinaryAnalysisPlatform/bap)) + + +(explicit_js_mode) +(formatting disabled) + +(use_standard_c_and_cxx_flags false) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Package Descriptions ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Meta Packages + +(package + (name bap) + (synopsis "BAP Meta Package") + (tags (bap meta)) + (allow_empty) + (depends + (bap-core (= :version)) + (bap-beagle (= :version)) + (bap-beagle-strings (= :version)) + (bap-constant-tracker (= :version)) + (bap-microx (= :version)) + (bap-primus-dictionary (= :version)) + (bap-primus-powerpc (= :version)) + (bap-primus-propagate-taint (= :version)) + (bap-primus-random (= :version)) + (bap-primus-region (= :version)) + (bap-primus-support (= :version)) + (bap-primus-systems (= :version)) + (bap-primus-taint (= :version)) + (bap-primus-test (= :version)) + (bap-primus-x86 (= :version)) + (bap-run (= :version)) + (bap-strings (= :version)) + (bap-taint (= :version)) + (bap-taint-propagator (= :version)) + (bap-term-mapper (= :version)) + (bap-trivial-condition-form (= :version)) + (bap-warn-unused (= :version)))) + +(package + (name bap-core) + (synopsis "The core BAP packages") + (tags (bap meta)) + (allow_empty) + (description "the meta package to install the core parts of BAP") + (depends + (bap-abi (= :version)) + (bap-analyze (= :version)) + (bap-api (= :version)) + (bap-arm (= :version)) + (bap-bil (= :version)) + (bap-build (= :version)) + (bap-bundle (= :version)) + (bap-byteweight (= :version)) + (bap-cache (= :version)) + (bap-callgraph-collator (= :version)) + (bap-callsites (= :version)) + (bap-c (= :version)) + (bap-cxxfilt (= :version)) + (bap-demangle (= :version)) + (bap-dependencies (= :version)) + (bap-disassemble (= :version)) + (bap-dump-symbols (= :version)) + (bap-elementary (= :version)) + (bap-flatten (= :version)) + (bap-frontc (= :version)) + (bap-frontend (= :version)) + (bap-glibc-runtime (= :version)) + (bap-llvm (= :version)) + (bap-mc (= :version)) + (bap-mips (= :version)) + (bap-objdump (= :version)) + (bap-optimization (= :version)) + (bap-patterns (= :version)) + (bap-plugins (= :version)) + (bap-powerpc (= :version)) + (bap-primus-lisp (= :version)) + (bap-primus (= :version)) + (bap-print (= :version)) + (bap-raw (= :version)) + (bap-recipe-command (= :version)) + (bap-recipe (= :version)) + (bap-relation (= :version)) + (bap-relocatable (= :version)) + (bap-report (= :version)) + (bap-riscv (= :version)) + (bap-specification (= :version)) + (bap-ssa (= :version)) + (bap-std (= :version)) + (bap-stub-resolver (= :version)) + (bap-symbol-reader (= :version)) + (bap-systemz (= :version)) + (bap-thumb (= :version)) + (bap-toplevel (= :version)) + (bap-x86 (= :version)))) + +(package + (name bap-extra) + (synopsis "The extra BAP packages") + (tags (bap meta)) + (allow_empty) + (description "the meta package to install the core parts of BAP") + (depends + (bap (= :version)) + (bap-byteweight-frontend (= :version)) + (bap-elf (= :version)) + (bap-primus-symbolic-executor (= :version)) + (bap-ghidra (= :version)) + (bap-trace (= :version)) + (bap-traces (= :version)) + (bap-radare2 (= :version)))) + +(package + (name bap-common) + (synopsis "A Package on which all BAP packages depend") + (tags (bap meta)) + (sites + (lib plugins) + (share api) + (share lisp) + (share primus) + (share semantics) + (share signatures) + (share site_lisp)) + (depends + (base (and (>= v0.14) (< v0.16))) + dune + dune-configurator + dune-site + (ocaml (> 4.08.0)) + (stdio (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-support) + (synopsis "Provides essential Primus components") + (tags (bap meta)) + (allow_empty) + (depends + (bap-primus-exploring-scheduler (= :version)) + (bap-primus-greedy-scheduler (= :version)) + (bap-primus-limit (= :version)) + (bap-primus-loader (= :version)) + (bap-primus-mark-visited (= :version)) + (bap-primus-print (= :version)) + (bap-primus-promiscuous (= :version)) + (bap-primus-round-robin-scheduler (= :version)) + (bap-primus-wandering-scheduler (= :version)))) + +;; Data Packages + +(package + (name bap-signatures) + (tags (bap data)) + (allow_empty) + (synopsis "A data package with BAP binary signatures")) + +;; Actual Packages + +(package + (name bap-abi) + (synopsis "BAP plugin and library for ABI-specific transformations") + (tags (bap bap-pass bap-plugin)) + (depends + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-analyze) + (synopsis "BAP Knowledge Base REPL") + (tags (bap bap-command bap-plugin)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (linenoise (and (>= 1.1.0) (< 2.0.0))) + (monads (= :version)) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-api) + (synopsis "BAP pass that adds arguments to subroutines") + (tags (bap bap-plugin bap-library)) + (depends (bap-common (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-arm) + (synopsis "BAP ARM support package") + (tags (bap bap-plugin bap-library arm)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bap-traces (= :version)) + (bitvec-order (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-beagle) + (synopsis "BAP obfuscated string solver") + (tags (bap bap-plugin)) + (deprecated_package_names bap-beagle-prey) + (depends + (bap-future (= :version)) + (bap-microx (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bap-strings (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-bil) + (synopsis "BAP Instruction Language (BIL)") + (tags (bap bap-plugin)) + (depends + (bap-core-theory (= :version)) + (bap-future (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (bitvec-order (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-bml) + (synopsis "BAP Term Mapping Language (BML)") + (tags (bap bap-library)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-byteweight) + (synopsis "BAP function start identification library and pass") + (tags (bap bap-library bap-plugin)) + (depends + (bap-signatures (= :version)) + (bap-std (= :version)) + (camlzip (and (>= 1.0) (< 2.0))) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + (uri (>= 4.2.0)))) + +(package + (name bap-byteweight-frontend) + (synopsis "A frontend to the BAP function start identification framework") + (tags (bap bap-frontend bap-command)) + (depends + (bap-byteweight (= :version)) + (bap-std (= :version)) + (cmdliner (and (>= 1.0) (< 2.0))) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + (bap-common (= :version)) + (ocurl (>= 0.9.0)) + (ppx_bap (= :version)) + (re (and (>= 1.0) (< 2.0))))) + +(package + (name bap-build) + (synopsis "BAP Build Tool (ocamlbuild+bap)") + (tags (bap bap-tool ocamlbuild)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + ocamlbuild + ocamlfind + (ppx_bap (= :version)))) + +(package + (name bap-bundle) + (synopsis "A bundler for BAP plugins") + (tags (bap bap-tool)) + (depends + (camlzip (and (>= 1.0) (< 2.0))) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + (bap-common (= :version)) + (ppx_bap (= :version)) + (uri (>= 4.2.0)))) + +(package + (name bap-c) + (synopsis "The C language support library for BAP") + (tags (bap bap-library c)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-cache) + (synopsis "BAP cache management") + (tags (bap bap-plugin)) + (depends + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + mmap + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + (uuidm (>= 0.9.7)))) + +(package + (name bap-callgraph-collator) + (synopsis "Compares binaries callgraphs") + (tags (bap bap-analysis)) + (depends + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (bap-common (= :version)) + (ppx_bap (= :version)) + (re (and (>= 1.0) (< 2.0))) + (regular (= :version)))) + +(package + (name bap-callsites) + (synopsis "BAP pass that injects data definitions at call sites") + (tags (bap bap-plugin bap-pass)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(package + (name bap-core-theory) + (synopsis "BAP Machine Code Semantics") + (description "\ +The Core Theory is an intermediate language that is designed to \ +express the semantics of computer programs. It focuses on programs \ +that are represented in binary machine code and is capable of an \ +accurate representation of the architectural and micro-architectural \ +details of the program behavior.") + (tags (bap bap-library)) + (depends + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bitvec (= :version)) + (bitvec-binprot (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-constant-tracker) + (synopsis "A constant tracking analysis based on BAP Primus") + (tags (bap bap-analysis bap-plugin bap-primus)) + (depends + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(package + (name bap-cxxfilt) + (synopsis "A name demangler that uses system's c++filt") + (tags (bap bap-plugin)) + (depends + (bap-demangle (= :version)) + (bap-std (= :version)) + (conf-binutils (>= 0.3)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(package + (name bap-demangle) + (synopsis "Provides names service and demangling facilities for BAP") + (tags (bap bap-library)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(package + (name bap-dependencies) + (synopsis "Shows program depenencies") + (tags (bap bap-command)) + (depends + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-disassemble) + (synopsis "Disassembles and analyzes binaries using BAP") + (tags (bap bap-command)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bitvec-binprot (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-dump-symbols) + (synopsis "A BAP plugin for dumping symbol information") + (tags (bap bap-plugin)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-dwarf) + (synopsis "BAP DWARF parser") + (tags (bap bap-library dwarf)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-elementary) + (synopsis "Floating-point approximations of elementary functions") + (tags (bap bap-library floating-points)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-elf) + (synopsis "BAP ELF parser and program loader") + (tags (bap bap-plugin elf)) + (depends + (bap-dwarf (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (ppx_bitstring (and (>= 4.0.0) (< 5.0.0))) + (regular (= :version)))) + +(package + (name bap-flatten) + (synopsis "A BAP pass that flattens program to TAC") + (tags (bap bap-plugin)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(package + (name bap-frontend) + (synopsis "The main BAP command-line tool") + (tags (bap bap-command)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + ocamlfind + (regular (= :version)))) + +(package + (name bap-frontc) + (synopsis "A BAP C language fronted based on FrontC") + (tags (bap bap-plugin c)) + (depends + (bap-c (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (FrontC (>= 4.1.0)) + (bap-common (= :version)))) + +(package + (name bap-future) + (synopsis "A library for asynchronous values") + (description "\ +A library for reasoning about state based dynamic systems. This can \ +be seen as a common denominator between Lwt and Async libraries.") + (tags (bap future)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)))) + +(package + (name bap-ghidra) + (synopsis "The BAP NSA Ghidra backend") + (tags (bap ghidra disassembler)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (bap-common (= :version)) + (bap-std (= :version)) + (bap-main (= :version)))) + +(package + (name bap-glibc-runtime) + (synopsis "The BAP Glibc Runtime support package") + (tags (bap bap-plugin)) + (depends + (bap-abi (= :version)) + (bap-c (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ogre (= :version)))) + +(package (name bap-ida) + (synopsis "BAP IDA Pro integration") + (tags (bap bap-library ida-pro)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (regular (= :version)) + fileutils + (bap-common (= :version)) + (bap-std (= :version)) + (re (and (>= 1.0) (< 2.0))))) + +(package + (name bap-ida-plugin) + (synopsis "BAP IDA Pro integration") + (tags (bap bap-plugin bap-ida ida-pro)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-knowledge) + (synopsis "Knowledge Reasoning and Representation Framework") + (tags (bap bap-library knowledge)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (bap-common (= :version)) + (monads (= :version)))) + +(package + (name bap-llvm) + (synopsis "BAP LLVM backend") + (tags (bap bap-plugin llvm)) + (depends + (bap-std (= :version)) + (conf-bap-llvm (>= 1.8)) + (core_kernel (and (>= v0.14) (< v0.16))) + mmap + (monads (= :version)) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-main) + (synopsis "The BAP Framework Configuration Library") + (tags (bap bap-library)) + (depends + (bap-build (= :version)) + (bap-future (= :version)) + (bap-plugins (= :version)) + (bap-recipe (= :version)) + (base (and (>= v0.14) (< v0.16))) + (cmdliner (and (>= 1.0) (< 2.0))) + (bap-common (= :version)) + (stdio (and (>= v0.14) (< v0.16))))) + +(package + (name bap-mc) + (synopsis "BAP Machine Code Playground (BAP's llvm-mc)") + (tags (bap bap-command)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-microx) + (synopsis "BAP Legacy Microexecution Framework") + (tags (bap bap-plugin)) + (depends + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-mips) + (synopsis "BAP MIPS Semantics") + (tags (bap bap-plugin mips)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + zarith)) + +(package + (name bap-objdump) + (synopsis "Extracts symbols from a binary using binutils objdump") + (tags (bap bap-plugin)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (conf-binutils (>= 0.3)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (re (and (>= 1.0) (< 2.0))))) + +(package + (name bap-optimization) + (synopsis "A BAP IR optimization pass") + (tags (bap bap-plugin bap-pass)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (bap-std (= :version)) + (regular (= :version)) + (graphlib (= :version)))) + +(package + (name bap-patterns) + (synopsis "Applies semantic actions to the matching byte patterns") + (tags (bap bap-plugin bap-command)) + (depends + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bitvec-binprot (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + (bap-common (= :version)) + (ppx_bap (= :version)) + (uri (>= 4.2.0)) + (xmlm (>= 1.3.0)))) + +(package + (name bap-phoenix) + (synopsis "Dumps BAP project in the phoenix format") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-std (= :version)) + cmdliner + (cmdliner (and (>= 1.0) (< 2.0))) + (core_kernel (and (>= v0.14) (< v0.16))) + ezjsonm + (graphlib (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + (text-tags (= :version)))) + +(package + (name bap-piqi) + (synopsis "Serializes BAP Project in various formats using piqi") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (piqi (>= 0.7.8)))) + +(package + (name bap-plugins) + (synopsis "BAP Plugin management library") + (tags (bap bap-library)) + (depends + (bap-common (= :version)) + (bap-bundle (= :version)) + (bap-future (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + ocamlfind + (ppx_bap (= :version)) + uri)) + +(package + (name bap-powerpc) + (synopsis "BAP PowerPC semantics") + (tags (bap bap-plugin powerpc)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + zarith)) + +(package + (name bap-primus) + (synopsis "BAP Microexecution Framework") + (tags (bap bap-library bap-primus)) + (depends + (bap-abi (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-future (= :version)) + (bap-knowledge (= :version)) + (bap-std (= :version)) + (bap-strings (= :version)) + (bitvec-binprot (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (monads (= :version)) + (parsexp (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (regular (= :version)) + (uuidm (>= 0.9.7)))) + +(package + (name bap-primus-dictionary) + (synopsis "Provides dictionary data structure to Primus Lisp") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-exploring-scheduler) + (synopsis "A BAP Primus scheduler") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-greedy-scheduler) + (synopsis "A BAP Primus scheduler") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-limit) + (synopsis "Enables BAP Primus interpreter termination ") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-lisp) + (synopsis "BAP Primus Lisp runtime") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (regular (= :version)))) + +(package + (name bap-primus-loader) + (synopsis "BAP Primus loader") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)))) + +(package + (name bap-primus-mark-visited) + (synopsis "A BAP Primus coverage tracker") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus-track-visited (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-powerpc) + (synopsis "A BAP Primus PowerPC support module") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-print) + (synopsis "A BAP Primus state and observations printer") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-future (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bare (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-promiscuous) + (synopsis "A BAP Primus promiscuous executor") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-propagate-taint) + (synopsis "A BAP Primus legacy taint engine compatibility layer") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bap-taint (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-random) + (synopsis "A BAP Primus value randomizer") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + zarith)) + +(package + (name bap-primus-region) + (synopsis "A BAP Primus Lisp regions library") + (tags (bap bap-primus bap-primus-lisp)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-round-robin-scheduler) + (synopsis "A BAP Primus scheduler") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-symbolic-executor) + (synopsis "A BAP Primus symbolic executor") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-primus-track-visited (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (regular (= :version)) + (bitvec (= :version)) + zarith + (z3 (and (>= 4.8.8-1) (< 4.8.13))))) + +(package + (name bap-primus-systems) + (synopsis "A BAP Primus systems repository") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-taint) + (synopsis "A BAP Primus taint analysis framework") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-taint (= :version)))) + +(package + (name bap-primus-test) + (synopsis "A BAP Primus testing and program verification framework") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-track-visited) + (synopsis "A BAP Primus coverage tracker library") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-primus-wandering-scheduler) + (synopsis "A BAP Primus scheduler") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)))) + +(package + (name bap-primus-x86) + (synopsis "A BAP Primus X86 support package") + (tags (bap bap-primus)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-x86 (= :version)))) + +(package + (name bap-print) + (synopsis "Prints BAP project in various human-readable formats") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-demangle (= :version)) + (bap-knowledge (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)) + (re (and (>= 1.0) (< 2.0))) + (regular (= :version)) + (text-tags (= :version)))) + +(package + (name bap-radare2) + (synopsis "BAP Radare2 integration") + (tags (bap bap-plugin radare2)) + (depends + (bap-abi (= :version)) + (bap-arm (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-future (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + conf-radare2 + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)) + (ppx_bap (= :version)) + (re (and (>= 1.0) (< 2.0))) + yojson + zarith)) + +(package + (name bap-raw) + (synopsis "BAP raw files loader") + (tags (bap bap-plugin)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)) + (bap-std (= :version)) + (bap-main (= :version)))) + +(package + (name bap-recipe) + (synopsis "Bundles together command-line options and resources") + (description + "A recipe is either a single file or a directory (optionally zipped) \ +that contains a parametrized specification of command-line parameters \ +and support files if necessary.") + (tags (bap bap-tool command-line)) + (depends + (bap-common (= :version)) + (parsexp (and (>= v0.14) (< v0.16))) + (stdio (and (>= v0.14) (< v0.16))) + stdlib-shims + (uuidm (>= 0.9.7)))) + +(package + (name bap-recipe-command) + (synopsis "Manages BAP recipes") + (tags (bap bap-command bap-tool)) + (depends + (bap-common (= :version)) + (bap-main (= :version)) + (bap-recipe (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-relation) + (synopsis "A set of relations (bimap) ") + (tags (bap data-structure)) + (description "\ +A relation between two sets is a set of pairs made from the \ +elements of these sets. This library implements a bidirectional mapping \ +between two sets and computes their matching that defines bijections \ +between the sets.") + (depends (bap-common (= :version)))) + +(package + (name bap-relocatable) + (synopsis "BAP plugin that manages symbol relocations") + (tags (bap bap-plugin)) + (depends + (bap-abi (= :version)) + (bap-arm (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-powerpc (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bap-x86 (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-report) + (synopsis "BAP plugin for reporting progress bars and statuses") + (tags (bap bap-plugin)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (bap-std (= :version)))) + +(package + (name bap-riscv) + (synopsis "BAP RISCV support package") + (tags (bap bap-plugin riscv)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-knowledge (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-run) + (synopsis "BAP Primus Framework frontend") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (monads (= :version)) + (regular (= :version)))) + +(package + (name bap-specification) + (synopsis "Extracts meta information from binaries") + (tags (bap bap-command)) + (depends + (bap-common (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)))) + +(package + (name bap-ssa) + (synopsis "Translates program into the SSA form") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-std) + (synopsis "BAP Standard Library") + (tags (bap bap-library)) + (depends + (bap-common (= :version)) + (bap-bundle (= :version)) + (bap-core-theory (= :version)) + (bap-future (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-plugins (= :version)) + (bap-relation (= :version)) + base-unix + (bitvec-order (= :version)) + (bitvec (= :version)) + (camlzip (and (>= 1.07) (< 2.0))) + cmdliner + (core_kernel (and (>= v0.14) (< v0.16))) + fileutils + (graphlib (= :version)) + mmap + (monads (= :version)) + (ocamlfind (and (>= 1.5.6) (< 2.0.0))) + (ogre (= :version)) + ounit + (ppx_bap (= :version)) + (regular (= :version)) + result + uri + (utop (>= 2.0.0)) + uuidm + zarith)) + +(package + (name bap-strings) + (synopsis "Text utilities useful in Binary Analysis and Reverse Engineering") + (tags (bap bap-library)) + (description "\ +The library provides several algorithms: + +- Detector - that uses a maximum aposteriori likelihood estimator + (MAP) to detect code that operates with textual data (aka Bayesian + inference). + +- Unscrambler - that is capable of finding all possible words, that + can be built from a bag of letters in O(1). + +- Scanner - a generic algorithm for finding strings of characters (a + library variant of strings tool)") + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-beagle-strings) + (synopsis "Finds strings in binaries using microexecution") + (tags (bap bap-plugin)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (bap-beagle (= :version)) + (ppx_bap (= :version)) + (bap-std (= :version)) + (bap-strings (= :version)) + (regular (= :version)))) + +(package + (name bap-stub-resolver) + (synopsis "Relinks stubs to their implementations") + (tags (bap bap-plugin)) + (depends + (bap-abi (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-relation (= :version)) + (bap-std (= :version)) + (bitvec-order (= :version)) + (bitvec-sexp (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-symbol-reader) + (synopsis "Reads symbol information from a file") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-relation (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))))) + +(package + (name bap-systemz) + (synopsis "BAP Systemz support package") + (tags (bap bap-plugins)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-taint) + (synopsis "BAP Taint Analysis Framework") + (tags (bap bap-library)) + (depends + (bap-common (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bap-strings (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (monads (= :version)) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-taint-propagator) + (synopsis "BAP Legacy Taint propagation engine") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-microx (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (graphlib (= :version)) + (monads (= :version)) + (regular (= :version)))) + +(package + (name bap-term-mapper) + (synopsis "BAP program transformation DSL") + (tags (bap bap-plugin)) + (depends + (bap-bml (= :version)) + (bap-common (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name bap-thumb) + (synopsis "BAP Thumb support package") + (tags (bap bap-plugin)) + (depends + (bap-arm (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-knowledge (= :version)) + (bap-main (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)) + (ppx_bap (= :version)))) + +(package + (name bap-toplevel) + (synopsis "BAP toplevel, baptop") + (tags (bap toplevel)) + (allow_empty) + (description "\ +The utop-enhanced bap toplevel interpreter. \ +Run `baptop` and start using bap right away. Or use it \ +as the interpreter for your BAP scripts, e.g., `baptop myprog.ml`") + (depends + (bap-common (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + ocamlfind)) + +(package + (name bap-trace) + (synopsis "BAP plugin for loading and inspecting execution traces") + (tags (bap bap-plugin)) + (depends + (bap-common (= :version)) + (bap-future (= :version)) + (bap-plugins (= :version)) + (bap-std (= :version)) + (bap-traces (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (regular (= :version)) + uri)) + +(package + (name bap-traces) + (synopsis "BAP execution traces abstractions") + (tags (bap bap-library)) + (depends + (bap-common (= :version)) + (bap-std (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)) + (regular (= :version)) + (uri (>= 1.9.0)) + uuidm)) + +(package + (name bap-trivial-condition-form) + (synopsis "Eliminates complex branch conditions") + (tags (bap bap-plugin)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (bap-std (= :version)))) + +(package + (name bap-warn-unused) + (synopsis "Warns if an unused argument may cause an issue") + (tags (bap bap-plugin)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (bap-std (= :version)))) + +(package + (name bap-x86) + (deprecated_package_names bap-x86-cpu) + (synopsis "BAP x86/x86-64 support package") + (tags (bap bap-plugin bap-library x86 x86-64)) + (depends + (bap-abi (= :version)) + (bap-api (= :version)) + (bap-common (= :version)) + (bap-core-theory (= :version)) + (bap-c (= :version)) + (bap-demangle (= :version)) + (bap-future (= :version)) + (bap-knowledge (= :version)) + (bap-llvm (= :version)) + (bap-main (= :version)) + (bap-primus (= :version)) + (bap-std (= :version)) + (bitvec (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ogre (= :version)) + (ppx_bap (= :version)) + (regular (= :version)) + zarith)) + +(package + (name bare) + (synopsis "BAP Rule Engine") + (description "\ +BARE is a library that provides the non-linear pattern matching on streams \ +of facts that are represented as s-expressions.") + (tags (bap bap-library)) + (depends + (bap-common (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (parsexp (and (>= v0.14) (< v0.16))))) + +(package + (name bitvec) + (synopsis "Fixed-size bitvectors and modular arithmetic, based on Zarith") + (tags (bap bap-library)) + (depends (zarith (>= 1.4)))) + +(package + (name bitvec-binprot) + (synopsis "Janestreet's Binprot serialization for Bitvec") + (tags (bap)) + (depends + (bin_prot (and (>= v0.14) (< v0.16))) + (bitvec (= :version)) + (ppx_bap (= :version)))) + +(package + (name bitvec-order) + (synopsis "The Base-compatible comparators and orders for Bitvec ") + (tags (bap)) + (depends + (base (>= v0.14)) + (bitvec-sexp (= :version)) + (bitvec (= :version)))) + +(package + (name bitvec-sexp) + (synopsis "Sexp serializers for Bitvec") + (tags (bap sexp)) + (depends + (sexplib0 (>= v0.14)) + (bitvec (= :version)))) + +(package + (name graphlib) + (synopsis "Generic graph algorithms") + (description "\ +Graphlib is a generic library that extends the well-known OCamlGraph \ +library. Graphlib uses its own, richer, Graph interface that \ +is isomorphic to OCamlGraph's `Sigs.P` signature for persistant \ +graphs. Two functors witness the isomorphism of the interfaces: \ +`Graphlib.To_ocamlgraph` and `Graphlib.Of_ocamlgraph`. Thanks to \ +these functors, any algorithm written for OCamlGraph can be used on \ +`Graphlibs` graph and vice verse.") + (tags (bap graph)) + (depends + (bap-common (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + ocamlgraph + (ppx_bap (= :version)) + (regular (= :version)))) + +(package + (name monads) + (synopsis "Monads and Monad Transfomers") + (description "Provides monad transformers for common monads.") + (tags (bap monad)) + (depends + (bap-common (= :version)) + (core_kernel (and (>= v0.14) (< v0.16))) + (ppx_bap (= :version)))) + +(package + (name ogre) + (synopsis "Pure OCaml Open Generic REpresentation NoSQL Database") + (description "\ +OGRE is a NoSQL document-style database that uses sexp for data \ +representation and provides a type safe monadic interface for quering \ +and updating documents") + (tags (bap sexp)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (monads (= :version)))) + +(package + (name ppx_bap) + (synopsis "BAP-blessed ppx rewriters") + (tags (bap ppx)) + (depends + (ppx_assert (and (>= v0.14) (< v0.16))) + (ppx_bench (and (>= v0.14) (< v0.16))) + (ppx_bin_prot (and (>= v0.14) (< v0.16))) + (ppx_cold (and (>= v0.14) (< v0.16))) + (ppx_compare (and (>= v0.14) (< v0.16))) + (ppx_enumerate (and (>= v0.14) (< v0.16))) + (ppx_fields_conv (and (>= v0.14) (< v0.16))) + (ppx_hash (and (>= v0.14) (< v0.16))) + (ppx_here (and (>= v0.14) (< v0.16))) + (ppxlib (>= 0.15.0)) + (ppx_optcomp (and (>= v0.14) (< v0.16))) + (ppx_sexp_conv (and (>= v0.14) (< v0.16))) + (ppx_sexp_value (and (>= v0.14) (< v0.16))) + (ppx_variants_conv (and (>= v0.14) (< v0.16))))) + +(package + (name regular) + (synopsis "Regular Data Types") + (tags (bap data-structure)) + (description "\ +Provides functors and typeclasses implementing functionality expected \ +for a regular data type, like i/o, containers, printing, etc. \ + \ +In particular, the library includes: \ + \ +- module Data that adds generic i/o routines for each regular data type. \ +- module Cache that adds caching service for data types \ +- module Regular that glues everything together \ +- module Opaque for regular but opaque data types \ +- module Seq that extends Core_kernel's sequence module \ +- module Bytes that provides a rich core-like interface for Bytes data type.") + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)) + (ppx_bap (= :version)))) + +(package + (name text-tags) + (synopsis "A library for rich formatting using semantic tags") + (tags (bap)) + (depends + (core_kernel (and (>= v0.14) (< v0.16))) + (bap-common (= :version)))) + +(generate_opam_files true) diff --git a/graphlib.opam b/graphlib.opam new file mode 100644 index 000000000..db28362d1 --- /dev/null +++ b/graphlib.opam @@ -0,0 +1,38 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Generic graph algorithms" +description: + "Graphlib is a generic library that extends the well-known OCamlGraph library. Graphlib uses its own, richer, Graph interface that is isomorphic to OCamlGraph's `Sigs.P` signature for persistant graphs. Two functors witness the isomorphism of the interfaces: `Graphlib.To_ocamlgraph` and `Graphlib.Of_ocamlgraph`. Thanks to these functors, any algorithm written for OCamlGraph can be used on `Graphlibs` graph and vice verse." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "graph"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ocamlgraph" + "ppx_bap" {= version} + "regular" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/lib/arm/.merlin b/lib/arm/.merlin deleted file mode 100644 index a5aa29dc1..000000000 --- a/lib/arm/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -REC -B ../../_build/lib/arm -B ../../_build/lib/bap_c -B ../../_build/lib/bap_api -S ../../lib/bap_c \ No newline at end of file diff --git a/lib/arm/dune b/lib/arm/dune new file mode 100644 index 000000000..93dadcb7e --- /dev/null +++ b/lib/arm/dune @@ -0,0 +1,16 @@ +(library + (name bap_arm) + (public_name bap-arm) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries + bap + bap-core-theory + bap-knowledge + bap-primus + bap-traces + bitvec + bitvec-order + core_kernel + ogre + regular)) diff --git a/lib/bap/.merlin b/lib/bap/.merlin deleted file mode 100644 index bda004da0..000000000 --- a/lib/bap/.merlin +++ /dev/null @@ -1,11 +0,0 @@ -PKG compiler-libs -PKG findlib -PKG cmdliner -B ../../_build/lib/bap_types -B ../../_build/lib/bap_image -B ../../_build/lib/bap_disasm -B ../../_build/lib/bap_sema -B ../../_build/lib/bap_bundle -B ../../_build/lib/knowledge - -REC diff --git a/lib/bap/bap.mli b/lib/bap/bap.mli index 7c02e6662..f9d94dbc2 100644 --- a/lib/bap/bap.mli +++ b/lib/bap/bap.mli @@ -11614,11 +11614,33 @@ module Std : sig (** A witness that can read configured params *) type reader = {get : 'a. 'a param -> 'a} + (** [declare_extension ~features ~provides ~doc when_ready] + declares a BAP extension. + + This function is a wrapper for {!Bap_main.Extension.declare} + that simplifies transition from the old (this one) + configuration system to the modern {!Bap_main.Extension}. + + It acts as {!when_ready} but you can also specify feature + tags and documentation, see {!Bap_main.Extension.declare} for more + information. + + @since 2.6.0 + *) + val declare_extension : + ?features:string list -> + ?provides:string list -> + ?doc:string -> + (reader -> unit) -> + unit + + (** [when_ready f] requests the system to call function [f] once configuration parameters are established and stabilized. An access function will be passed to the function [f], that can be used to safely dereference parameters. *) val when_ready : (reader -> unit) -> unit + [@@deprecated "[since 2022-09] use declare_extension"] (** The type for a block of man page text. diff --git a/lib/bap/bap_init_toplevel.ml b/lib/bap/bap_init_toplevel.ml index 10d312b8e..eb579b898 100644 --- a/lib/bap/bap_init_toplevel.ml +++ b/lib/bap/bap_init_toplevel.ml @@ -15,9 +15,10 @@ let main () = let module Core_kernel_is_required = Core_kernel[@warning "-D"] in let loader = Topdirs.dir_load Format.err_formatter in setup_dynamic_loader loader; - install_printers (); match Bap_main.init ~argv: [|"baptop"|] () with - | Ok () -> () + | Ok () -> + install_printers (); + () | Error failed -> Format.eprintf "Failed to initialize BAP: %a@\n%!" Bap_main.Extension.Error.pp failed; diff --git a/lib/bap/bap_self.ml b/lib/bap/bap_self.ml index 8fbf96bbc..f972f2dd4 100644 --- a/lib/bap/bap_self.ml +++ b/lib/bap/bap_self.ml @@ -10,17 +10,12 @@ module Buffer = Caml.Buffer module Sys = Caml.Sys module Create() = struct - let bundle = main_bundle () - let main = let base = Filename.basename Sys.executable_name in try Filename.chop_extension base with _ -> base - let manifest = - try Bundle.manifest bundle - with _exn -> Manifest.create main - + let manifest = Manifest.current () let name = Manifest.name manifest let version = Manifest.version manifest let doc = Manifest.desc manifest @@ -123,12 +118,14 @@ module Create() = struct Configuration.determined let determined x = x - let when_ready f = declare @@ fun _ -> + let declare_extension ?features ?provides ?doc f = + declare ?features ?provides ?doc @@ fun _ -> try Ok (f {get = fun x -> Future.peek_exn x}) with | Invalid_argument s -> Error (Error.Invalid s) | exn -> let backtrace = Caml.Printexc.get_backtrace () in Error (Error.Bug (exn,backtrace)) + let when_ready f = declare_extension f let manpage (ps : manpage_block list) = let open Format in diff --git a/lib/bap/bap_self.mli b/lib/bap/bap_self.mli index 4b55d7d44..6c4733367 100644 --- a/lib/bap/bap_self.mli +++ b/lib/bap/bap_self.mli @@ -62,6 +62,11 @@ module Create() : sig val determined : 'a param -> 'a future + val declare_extension : + ?features:string list -> + ?provides:string list -> + ?doc:string -> + (reader -> unit) -> unit val when_ready : (reader -> unit) -> unit type manpage_block = [ diff --git a/lib/bap/dune b/lib/bap/dune new file mode 100644 index 000000000..d648a3aa0 --- /dev/null +++ b/lib/bap/dune @@ -0,0 +1,42 @@ +(library + (name bap) + (public_name bap-std) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap-bundle + bap-core-theory + bap_disasm + bap-future + bap_image + bap-knowledge + bap-main + bap_sema + bap_types + bitvec + bitvec-binprot + bitvec-order + bitvec-sexp + core_kernel + core_kernel.caml_unix + fileutils + graphlib + monads + ogre + regular) + (modules bap bap_project bap_self) + (private_modules bap_project bap_self)) + + +(library + (name bap_init_toplevel) + (public_name bap.top) + (modes byte) + (modules bap_init_toplevel) + (optional) + (libraries + bap + bap-main + dune-site.toplevel ; to disable when toplevel support is not present + compiler-libs + compiler-libs.common)) diff --git a/lib/bap_abi/dune b/lib/bap_abi/dune new file mode 100644 index 000000000..57db3b5aa --- /dev/null +++ b/lib/bap_abi/dune @@ -0,0 +1,6 @@ +(library + (name bap_abi) + (public_name bap-abi) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel)) diff --git a/lib/bap_api/.merlin b/lib/bap_api/.merlin deleted file mode 100644 index 5af9ccf66..000000000 --- a/lib/bap_api/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_api \ No newline at end of file diff --git a/lib/bap_api/bap_api_abi.ml b/lib/bap_api/bap_api_abi.ml deleted file mode 100644 index fc266412e..000000000 --- a/lib/bap_api/bap_api_abi.ml +++ /dev/null @@ -1,39 +0,0 @@ -open Core_kernel[@@warning "-D"] -open Regular.Std -open Bap.Std -open Bap_api - -type t = { - arch : arch; - name : string; -} [@@deriving bin_io, compare, sexp] - -module Abi = Regular.Make(struct - type nonrec t = t [@@deriving bin_io, compare, sexp] - let version = "1.0.0" - let module_name = Some "Bap_api_abi" - let hash = Hashtbl.hash - let pp ppf {arch;name} = - Format.fprintf ppf "%a-%s" Arch.pp arch name - end) - -type resolver = string -> attr list -> string - -let abis : (pos -> exp) Abi.Table.t = Abi.Table.create () -let resolvers : resolver Arch.Table.t = Arch.Table.create () -let register arch name f = Hashtbl.set abis ~key:{arch;name} ~data:f -let override_resolver arch f = Hashtbl.set resolvers ~key:arch ~data:f - -let resolve arch attr name = match Hashtbl.find resolvers arch with - | Some f -> {arch; name = f attr name} - | None -> {arch; name = "unknown"} - -let apply abi pos = match Hashtbl.find abis abi with - | Some abi -> abi pos - | None -> - let width = Arch.addr_size abi.arch |> Size.in_bits in - Bil.unknown "unknown abi" (Type.Imm width) - -let known_abi arch = - Hashtbl.keys abis|> List.filter_map ~f:(fun abi -> - Option.some_if (abi.arch = arch) abi.name) diff --git a/lib/bap_api/bap_api_abi.mli b/lib/bap_api/bap_api_abi.mli deleted file mode 100644 index 404d9d9d7..000000000 --- a/lib/bap_api/bap_api_abi.mli +++ /dev/null @@ -1,51 +0,0 @@ -open Core_kernel[@@warning "-D"] -open Regular.Std -open Bap.Std -open Bap_api - -(** ABI dispatching interface. - - - ABI object consolidates knowledge about a transformation from - higher level language abstractions to a lower level - representation, that uses bitvectors, stack frames, etc. - - The ABI resolving is split into two phases, first an ABI should - be determined, second it is applied. - - In the resolvinig phase we're trying to figure out what ABI is - used by a particular function. Some common architectures, e.g., - x86, are allowing to pinpoint a specific calling convention for a - function, using function attributes. Some architectures have - a different default ABI depending on a target. That's why we're - allowing to override ABI for each function. If no resolver is - registered for a given architecture, then the default resolver - will be used, that will pick the first available abi for the - architecture. If no abi is registered, then the ["unknown"] abi is - returned. -*) - - -type 'a language - - -(** [register arch name f] registers an abi function [f] for abi with - the given [name] and [arch]. If an abi for the given pair is - already registered, then it will be overridden. *) - -type 'a t = 'a language -> sub term -> sub term -val register : 'a language -> arch -> string -> 'a t -> unit - -(** [override_resolver arch resolve] overrides resolver for the given - architecture. For each function having a [name] and a list of - [attrubutes] a [resolve name attributes] must evaluate to - [abi_name]. *) -val override_resolver : 'a language -> arch -> ('a -> string) -> unit - -(** [apply arch proto sub] returns a right hand side expression representing - positional argument at the given position [pos] *) -val apply : 'a language -> arch -> 'a t - -(** [known_abi arch] is a list of names of ABI currently registered for the given - architecture [arch] *) -val known_abi : 'a language -> arch -> string list diff --git a/lib/bap_api/bap_api_attr.mli b/lib/bap_api/bap_api_attr.mli deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/bap_api/dune b/lib/bap_api/dune new file mode 100644 index 000000000..5f0052e73 --- /dev/null +++ b/lib/bap_api/dune @@ -0,0 +1,6 @@ +(library + (name bap_api) + (public_name bap-api) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel)) \ No newline at end of file diff --git a/lib/bap_bml/dune b/lib/bap_bml/dune new file mode 100644 index 000000000..05322bf76 --- /dev/null +++ b/lib/bap_bml/dune @@ -0,0 +1,6 @@ +(library + (name bap_bml) + (public_name bap-bml) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel)) diff --git a/lib/bap_build/.merlin b/lib/bap_build/.merlin deleted file mode 100644 index e3faa8ab0..000000000 --- a/lib/bap_build/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -PKG ocamlbuild -PKG findlib -REC \ No newline at end of file diff --git a/lib/bap_build/dune b/lib/bap_build/dune new file mode 100644 index 000000000..e9d4a4801 --- /dev/null +++ b/lib/bap_build/dune @@ -0,0 +1,5 @@ +(library + (name bap_build) + (public_name bap-build) + (wrapped false) + (libraries findlib ocamlbuild)) \ No newline at end of file diff --git a/lib/bap_bundle/bap_bundle.ml b/lib/bap_bundle/bap_bundle.ml index 26bf2f790..28d092dbf 100644 --- a/lib/bap_bundle/bap_bundle.ml +++ b/lib/bap_bundle/bap_bundle.ml @@ -62,6 +62,14 @@ module Std = struct let of_string s = t_of_sexp (Sexp.of_string s) + let manifest = + let name = Filename.basename Sys.executable_name in + ref (create name) + + let update m = manifest := m + let switch m = let old = !manifest in manifest := m; old + let current () = !manifest + end type manifest = Manifest.t @@ -233,6 +241,14 @@ module Std = struct end type bundle = Bundle.t - let set_main_bundle bundle = Bundle.main := bundle + + let set_manifest_of_bundle bundle = + try Manifest.update (Bundle.manifest bundle) + with _ -> () + + let set_main_bundle bundle = + Bundle.main := bundle; + set_manifest_of_bundle bundle + let main_bundle () = Bundle.main.contents end diff --git a/lib/bap_bundle/bap_bundle.mli b/lib/bap_bundle/bap_bundle.mli index d2e7cbf5e..78be08ed2 100644 --- a/lib/bap_bundle/bap_bundle.mli +++ b/lib/bap_bundle/bap_bundle.mli @@ -11,6 +11,7 @@ module Std : sig [Sys.executable_name] with a [bundle] extension. *) val main_bundle : unit -> bundle + (**/**) (* For internal usage only. @@ -58,11 +59,16 @@ module Std : sig ?cons:string list -> string -> t include Stringable with type t := t + + val current : unit -> t + val update : t -> unit + val switch : t -> t end type manifest = Manifest.t + (** Program Bundle. Bundle is a collection of data associated with a program. To diff --git a/lib/bap_bundle/dune b/lib/bap_bundle/dune new file mode 100644 index 000000000..93b424109 --- /dev/null +++ b/lib/bap_bundle/dune @@ -0,0 +1,15 @@ +(library + (name bap_bundle) + (public_name bap-bundle) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries uri camlzip unix core_kernel core_kernel.caml_unix)) + +(rule + (target bap_bundle_config.ml) + (deps bap_bundle_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/lib/bap_byteweight/dune b/lib/bap_byteweight/dune new file mode 100644 index 000000000..65d1da90e --- /dev/null +++ b/lib/bap_byteweight/dune @@ -0,0 +1,7 @@ +(library + (name bap_byteweight) + (public_name bap-byteweight) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-main bap-core-theory bap-knowledge + core_kernel uri camlzip)) diff --git a/lib/bap_c/.merlin b/lib/bap_c/.merlin deleted file mode 100644 index ce894b330..000000000 --- a/lib/bap_c/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_c -B ../../_build/lib/bap_api \ No newline at end of file diff --git a/lib/bap_c/bap_c_abi.ml b/lib/bap_c/bap_c_abi.ml index 418d8a868..c9740b134 100644 --- a/lib/bap_c/bap_c_abi.ml +++ b/lib/bap_c/bap_c_abi.ml @@ -282,7 +282,7 @@ let apply abi size attrs t sub = let create_api_processor size abi : Bap_api.t = let stage1 gamma = object(self) - inherit Term.mapper as super + inherit Term.mapper method! map_sub sub = if Term.has_attr sub Attrs.proto then sub else self#apply_proto sub diff --git a/lib/bap_c/bap_c_type.ml b/lib/bap_c/bap_c_type.ml index 09bec9ff0..64ae41362 100644 --- a/lib/bap_c/bap_c_type.ml +++ b/lib/bap_c/bap_c_type.ml @@ -310,7 +310,7 @@ let pp_enum_value ppf = function let pp_enum_field ppf (name,value) = Format.fprintf ppf "@,%s%a," name pp_enum_value value -let rec pp_enum_fields ppf = +let pp_enum_fields ppf = List.iter ~f:(pp_enum_field ppf) let string_of_basic t = match (t : basic) with diff --git a/lib/bap_c/dune b/lib/bap_c/dune new file mode 100644 index 000000000..3871b2c14 --- /dev/null +++ b/lib/bap_c/dune @@ -0,0 +1,13 @@ +(library + (name bap_c) + (public_name bap-c) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-core-theory + bap-knowledge + core_kernel + monads + regular)) \ No newline at end of file diff --git a/lib/bap_core_theory/.merlin b/lib/bap_core_theory/.merlin deleted file mode 100644 index 093ce10a1..000000000 --- a/lib/bap_core_theory/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_core_theory -B ../../_build/lib/knowledge diff --git a/lib/bap_core_theory/dune b/lib/bap_core_theory/dune new file mode 100644 index 000000000..fa935d55e --- /dev/null +++ b/lib/bap_core_theory/dune @@ -0,0 +1,7 @@ +(library + (name bap_core_theory) + (public_name bap-core-theory) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap-knowledge core_kernel core_kernel.caml_unix + bitvec bitvec-order bitvec-sexp bitvec-binprot)) \ No newline at end of file diff --git a/lib/bap_demangle/dune b/lib/bap_demangle/dune new file mode 100644 index 000000000..fc59b0a93 --- /dev/null +++ b/lib/bap_demangle/dune @@ -0,0 +1,4 @@ +(library + (name bap_demangle) + (public_name bap-demangle) + (libraries bap-core-theory bap-knowledge core_kernel)) diff --git a/lib/bap_disasm/.merlin b/lib/bap_disasm/.merlin deleted file mode 100644 index 2575fd4b8..000000000 --- a/lib/bap_disasm/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG zarith diff --git a/lib/bap_disasm/bap_disasm_stub_lifter.mli b/lib/bap_disasm/bap_disasm_stub_lifter.mli deleted file mode 100644 index 53762e628..000000000 --- a/lib/bap_disasm/bap_disasm_stub_lifter.mli +++ /dev/null @@ -1,15 +0,0 @@ -open Core_kernel[@@warning "-D"] -open Bap_types.Std -open Bap_image_std -open Bap_disasm_types -open Bap_disasm_abi - -val lift : mem -> ('a,'k) Basic.insn -> stmt list Or_error.t - -module CPU : CPU - -module ABI : sig - val register : abi_constructor -> unit - val create : ?merge:(abi list -> abi) -> abi_constructor - include module type of Bap_disasm_abi_helpers -end diff --git a/lib/bap_disasm/dune b/lib/bap_disasm/dune new file mode 100644 index 000000000..ee66443d2 --- /dev/null +++ b/lib/bap_disasm/dune @@ -0,0 +1,38 @@ +(library + (name bap_disasm) + (public_name bap-std.disasm) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap-core-theory + bap-future + bap-knowledge + bap-main + bap-relation + bap_image + bap_types + bitvec + bitvec-order + camlzip + core_kernel + graphlib + monads + ocamlgraph + ogre + regular + zarith) + (foreign_stubs + (language cxx) + (names disasm) + (extra_deps (glob_files *.hpp)) + (flags -std=c++11 -fPIC -O3)) + (foreign_stubs + (language c) + (names disasm_stubs) + (flags -O3)) + (c_library_flags -lstdc++)) + +(install + (package bap-std) + (section lib) + (files disasm.h disasm.hpp)) diff --git a/lib/bap_dwarf/dune b/lib/bap_dwarf/dune new file mode 100644 index 000000000..a200e9906 --- /dev/null +++ b/lib/bap_dwarf/dune @@ -0,0 +1,6 @@ +(library + (name bap_dwarf) + (public_name bap-dwarf) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel core_kernel.binary_packing regular)) diff --git a/lib/bap_dwarf/dwarf_fbi.ml b/lib/bap_dwarf/dwarf_fbi.ml index 4221ab6b2..0bf00e12d 100644 --- a/lib/bap_dwarf/dwarf_fbi.ml +++ b/lib/bap_dwarf/dwarf_fbi.ml @@ -139,7 +139,7 @@ let read_scheme s str_sec action str ~pos_ref = loop (emit attr form :: acc) in loop [] -let rec create_table s str_sec str ~pos_ref = +let create_table s str_sec str ~pos_ref = let abbrs : table = Table.create () in let rec fill () = Input.code str ~pos_ref >>= function @@ -204,7 +204,7 @@ let create data : t Or_error.t = create_table s str_sec abbr ~pos_ref:abbr_pos >>= fun abbrs -> return (abbrs, cu_end) in - let rec read_unit () = + let read_unit () = read_header () >>| fun init -> Sequence.unfold_step ~init ~f:(fun (abbrs,cu_end) -> let open Sequence.Step in diff --git a/lib/bap_elementary/.merlin b/lib/bap_elementary/.merlin deleted file mode 100644 index e31611c23..000000000 --- a/lib/bap_elementary/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -REC -B ../../_build/lib/bap_core_theory -B ../../_build/lib/knowledge -S . \ No newline at end of file diff --git a/lib/bap_elementary/dune b/lib/bap_elementary/dune new file mode 100644 index 000000000..04417ae8e --- /dev/null +++ b/lib/bap_elementary/dune @@ -0,0 +1,5 @@ +(library + (name bap_elementary) + (public_name bap-elementary) + (wrapped false) + (libraries bap bap-core-theory bap-knowledge bitvec core_kernel)) diff --git a/lib/bap_elf/.merlin b/lib/bap_elf/.merlin deleted file mode 100644 index 3e4172100..000000000 --- a/lib/bap_elf/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG bitstring -REC diff --git a/lib/bap_elf/dune b/lib/bap_elf/dune new file mode 100644 index 000000000..6cd913cf3 --- /dev/null +++ b/lib/bap_elf/dune @@ -0,0 +1,6 @@ +(library + (name bap_elf) + (public_name bap-elf) + (preprocess (pps ppx_bap ppx_bitstring)) + (wrapped false) + (libraries bap bitstring core_kernel regular)) diff --git a/lib/bap_future/bap_future.ml b/lib/bap_future/bap_future.ml index e24d989b4..4e9915883 100644 --- a/lib/bap_future/bap_future.ml +++ b/lib/bap_future/bap_future.ml @@ -517,7 +517,7 @@ module Std = struct let rec drop n = if n < num then match Queue.peek q with | Some _ -> - Queue.dequeue_exn q; + ignore (Queue.dequeue_exn q); drop (n + 1) | _ -> n else n in diff --git a/lib/bap_future/dune b/lib/bap_future/dune new file mode 100644 index 000000000..3be5833eb --- /dev/null +++ b/lib/bap_future/dune @@ -0,0 +1,5 @@ +(library + (name bap_future) + (public_name bap-future) + (wrapped false) + (libraries core_kernel monads)) \ No newline at end of file diff --git a/lib/bap_ghidra/dune b/lib/bap_ghidra/dune new file mode 100644 index 000000000..edc47904d --- /dev/null +++ b/lib/bap_ghidra/dune @@ -0,0 +1,15 @@ +(library + (name bap_ghidra) + (public_name bap-ghidra) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel mmap) + (foreign_stubs + (language cxx) + (names ghidra_disasm) + (extra_deps (glob_files *.hpp)) + (flags :standard -fPIC)) + (foreign_stubs + (language c) + (names ghidra_stubs)) + (c_library_flags :standard -L/usr/lib/ghidra -ldecomp)) diff --git a/lib/bap_ida/.merlin b/lib/bap_ida/.merlin deleted file mode 100644 index b9dbfdb85..000000000 --- a/lib/bap_ida/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_ida \ No newline at end of file diff --git a/lib/bap_ida/dune b/lib/bap_ida/dune new file mode 100644 index 000000000..a9f9cc3dd --- /dev/null +++ b/lib/bap_ida/dune @@ -0,0 +1,6 @@ +(library + (name bap_ida) + (public_name bap-ida) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries core_kernel fileutils re.posix)) diff --git a/lib/bap_image/dune b/lib/bap_image/dune new file mode 100644 index 000000000..d311785be --- /dev/null +++ b/lib/bap_image/dune @@ -0,0 +1,15 @@ +(library + (name bap_image) + (public_name bap-std.image) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap-core-theory + bap-knowledge + bap_types + core_kernel + core_kernel.caml_unix + mmap + monads + ogre + regular)) \ No newline at end of file diff --git a/lib/bap_llvm/config/dune b/lib/bap_llvm/config/dune new file mode 100644 index 000000000..614ac03ff --- /dev/null +++ b/lib/bap_llvm/config/dune @@ -0,0 +1,12 @@ +(executable + (name llvm_configurator) + (libraries base stdio dune-configurator)) + +(rule + (target llvm_config.ml) + (deps llvm_config.ml.ab (alias ../../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/lib/bap_llvm/config/llvm_config.ml.ab b/lib/bap_llvm/config/llvm_config.ml.ab new file mode 100644 index 000000000..c4b0158bb --- /dev/null +++ b/lib/bap_llvm/config/llvm_config.ml.ab @@ -0,0 +1 @@ +let llvm_config = "${llvm-config}" \ No newline at end of file diff --git a/lib/bap_llvm/config/llvm_configurator.ml b/lib/bap_llvm/config/llvm_configurator.ml new file mode 100644 index 000000000..9c229c64a --- /dev/null +++ b/lib/bap_llvm/config/llvm_configurator.ml @@ -0,0 +1,55 @@ +open Base +open Stdio + +module C = Configurator.V1 +module Buf = Caml.Buffer +module Arg = Caml.Arg +module Filename = Caml.Filename +open Llvm_config + +let llvm_components = [ + "all-targets"; + "binaryformat"; + "core"; + "mc"; + "debuginfodwarf"; + "debuginfomsf"; + "debuginfopdb" +] + +let llvm self opts = + C.Process.run_capture_exn self llvm_config opts |> + String.strip |> + C.Flags.extract_blank_separated_words + +let filename = ref "" +let args = [ + "-filename", Arg.Set_string filename, "NAME the name of the file"; +] + + + +let () = C.main ~args ~name:"bap-llvm" @@ fun self -> + C.Flags.write_sexp "link.flags" @@ List.concat [ + llvm self ["--link-static"; "--ldflags"]; + llvm self (["--link-static"; "--libs"] @ llvm_components); + ["-lstdc++"; "-lcurses"]; + ]; + C.Flags.write_sexp "cxx.flags" @@ List.concat [ + ["-fPIC"]; + llvm self ["--cxxflags"]; + ]; + let version = + String.strip @@ + C.Process.run_capture_exn self llvm_config ["--version"] in + let src = !filename in + let dst = Caml.Filename.chop_extension src in + In_channel.with_file src ~f:(fun input -> + Out_channel.with_file dst ~f:(fun output -> + In_channel.iter_lines input ~f:(fun line -> + let buf = Buffer.create (String.length line + 1) in + Buf.add_substitute buf (function + | "llvm_version" -> version + | s -> s) line; + Buf.add_char buf '\n'; + Buf.output_buffer output buf))) diff --git a/lib/bap_llvm/dune b/lib/bap_llvm/dune new file mode 100644 index 000000000..ad7fc43a2 --- /dev/null +++ b/lib/bap_llvm/dune @@ -0,0 +1,29 @@ +(library + (name bap_llvm) + (public_name bap-llvm) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap + core_kernel + core_kernel.caml_unix + mmap + monads + ogre) + (foreign_stubs + (language cxx) + (names llvm_disasm llvm_error_or llvm_primitives + llvm_loader llvm_loader_utils + llvm_coff_loader llvm_elf_loader + llvm_macho_loader llvm_pdb_loader) + (extra_deps (glob_files *.hpp)) + (flags -I. :standard (:include cxx.flags))) + (foreign_stubs + (language c) + (names llvm_stubs llvm_loader_stubs)) + (c_library_flags (:include link.flags))) + +(rule + (targets cxx.flags link.flags bap_llvm_config.ml) + (deps bap_llvm_config.ml.ab) + (action (run ./config/llvm_configurator.exe -filename %{deps}))) diff --git a/lib/bap_main/.merlin b/lib/bap_main/.merlin deleted file mode 100644 index 3ab7aadd8..000000000 --- a/lib/bap_main/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -REC -PKG base -PKG stdio -PKG cmdliner -B ../../_build/lib/bap_main diff --git a/lib/bap_main/bap_load_plugins.ml b/lib/bap_main/bap_load_plugins.ml deleted file mode 100644 index a28af87e7..000000000 --- a/lib/bap_main/bap_load_plugins.ml +++ /dev/null @@ -1,6 +0,0 @@ -open Bap_plugins.Std - -let () = - let loader = Topdirs.dir_load Format.std_formatter in - setup_dynamic_loader loader; - Plugins.load () |> ignore diff --git a/lib/bap_main/bap_load_plugins.mli b/lib/bap_main/bap_load_plugins.mli deleted file mode 100644 index 6e92144ef..000000000 --- a/lib/bap_main/bap_load_plugins.mli +++ /dev/null @@ -1 +0,0 @@ -(* autoloads plugins into toplevel *) diff --git a/lib/bap_main/bap_main.ml b/lib/bap_main/bap_main.ml index f1bcf53db..726d4c802 100644 --- a/lib/bap_main/bap_main.ml +++ b/lib/bap_main/bap_main.ml @@ -1,6 +1,8 @@ (* Base kills exn, so we have to do it before opening *) type error = exn = .. +[@@@warning "-D"] + open Base open Stdio open Bap_future.Std @@ -873,8 +875,7 @@ end = struct let update_from_bundle info plugin = - let b = Plugin.bundle plugin in - let {Manifest.tags; cons; desc} = Bundle.manifest b in + let {Manifest.tags; cons; desc} = Plugin.manifest plugin in match info with | None -> {docs = desc; tags; cons} | Some info -> { @@ -1004,11 +1005,8 @@ end = struct Caml.Filename.basename (Caml.Sys.executable_name) - let switch_bundle name = - let was = main_bundle () in - let now = Hashtbl.find_exn plugins name in - set_main_bundle (Plugin.bundle now); - was + let with_context name ~f = + Plugin.with_context (Hashtbl.find_exn plugins name) ~f let try_eval f x = try f x with | Invalid_argument s -> Error (Error.Invalid s) @@ -1031,10 +1029,8 @@ end = struct | Ok () -> if not (Set.mem disabled name) then - let old = switch_bundle name in - let res = try_eval code ctxt in - set_main_bundle old; - res + with_context name ~f:(fun () -> + try_eval code ctxt) else Ok ()) let no_plugin_options plugins = diff --git a/lib/bap_main/dune b/lib/bap_main/dune new file mode 100644 index 000000000..99b30948b --- /dev/null +++ b/lib/bap_main/dune @@ -0,0 +1,24 @@ +(library + (name bap_main) + (public_name bap-main) + (wrapped false) + (libraries stdlib-shims + base stdio + cmdliner + core_kernel + core_kernel.caml_unix + fileutils + bap-future + bap-bundle + bap-plugins + bap-recipe) + (private_modules bap_main_log)) + +(rule + (target bap_main_config.ml) + (deps bap_main_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/lib/bap_mips/dune b/lib/bap_mips/dune new file mode 100644 index 000000000..ad865e33d --- /dev/null +++ b/lib/bap_mips/dune @@ -0,0 +1,6 @@ +(library + (name bap_mips) + (public_name bap-mips) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-core-theory bap-knowledge core_kernel ogre)) diff --git a/lib/bap_piqi/bil_piqi.ml b/lib/bap_piqi/bil_piqi.ml index 3245c24c6..c54ecd0d5 100644 --- a/lib/bap_piqi/bil_piqi.ml +++ b/lib/bap_piqi/bil_piqi.ml @@ -67,12 +67,12 @@ let binop_of_piqi = function | `slt -> SLT | `sle -> SLE -let rec type_to_piqi : typ -> Stmt_piqi.typ = function +let type_to_piqi : typ -> Stmt_piqi.typ = function | Imm s -> `imm s | Mem (t, t') -> `mem {Stmt_piqi.Mem.index_type = t; element_type = t';} | Unk -> `unk -let rec type_of_piqi = function +let type_of_piqi = function | `imm n -> Imm n | `mem {P.Mem.index_type; element_type} -> Mem (index_type, element_type) | `unk -> Type.Unk diff --git a/lib/bap_piqi/dune b/lib/bap_piqi/dune new file mode 100644 index 000000000..a2d231e8b --- /dev/null +++ b/lib/bap_piqi/dune @@ -0,0 +1,27 @@ +(library + (name bap_piqi) + (public_name bap-piqi) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap piqirun.pb piqirun.ext) + (private_modules stmt_piqi stmt_piqi_ext ir_piqi ir_piqi_ext)) + +(rule + (targets type__piqi.ml type__piqi_ext.ml) + (deps type.piqi) + (action (run piqic-ocaml --multi-format %{deps}))) + +(rule + (targets stmt_piqi.ml stmt_piqi_ext.ml) + (deps stmt.piqi) + (action (run piqic-ocaml --multi-format %{deps}))) + +(rule + (targets exp_piqi.ml exp_piqi_ext.ml) + (deps exp.piqi) + (action (run piqic-ocaml --multi-format %{deps}))) + +(rule + (targets ir_piqi.ml ir_piqi_ext.ml) + (deps ir.piqi) + (action (run piqic-ocaml --multi-format %{deps}))) diff --git a/lib/bap_piqi/test/.merlin b/lib/bap_piqi/test/.merlin deleted file mode 100644 index 81815fc14..000000000 --- a/lib/bap_piqi/test/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -S . -PKG oUnit -REC \ No newline at end of file diff --git a/lib/bap_plugins/.merlin b/lib/bap_plugins/.merlin deleted file mode 100644 index eb593272b..000000000 --- a/lib/bap_plugins/.merlin +++ /dev/null @@ -1,6 +0,0 @@ -PKG findlib -B ../../_build/lib/bap_config -B ../bap_bundle -B ../bap_future - -REC diff --git a/lib/bap_plugins/bap_common.ml b/lib/bap_plugins/bap_common.ml new file mode 100644 index 000000000..0a513eeb1 --- /dev/null +++ b/lib/bap_plugins/bap_common.ml @@ -0,0 +1,45 @@ +open Base +open Stdio + +open Caml.Scanf +module Sys = Caml.Sys +module Package = Bap_plugins_package +module Config = Bap_plugins_config +module Units = Bap_plugins_units.Make() +open Bap_plugins_loader_backend + +let requires str = + try Some (sscanf str "requires = %S" Fn.id) with _ -> None + +let parse_meta path = + In_channel.read_lines path |> + List.find_map ~f:requires + +let collect_plugins plugindir = + if Sys.file_exists plugindir && + Sys.is_directory plugindir then + Sys.readdir plugindir |> + Array.to_list |> + List.filter_map ~f:(fun path -> + let meta = plugindir ^ "/" ^ path ^ "/" ^ "META" in + if Sys.file_exists meta then parse_meta meta + else None) + else [] + + +module Plugins = struct + let paths = [Config.plugindir ^ "/plugins"] + let list () = List.concat_map paths ~f:collect_plugins + let load name = + match Units.lookup name with + | Some _ -> () + | None -> + match Package.resolve name with + | None -> invalid_arg ("unknown package " ^ name) + | Some lib -> + Units.record name (`Requested_by name); + load lib + let load_all () = + list () |> List.iter ~f:load + +end diff --git a/lib/bap_plugins/bap_common.ml.ab b/lib/bap_plugins/bap_common.ml.ab new file mode 100644 index 000000000..0a513eeb1 --- /dev/null +++ b/lib/bap_plugins/bap_common.ml.ab @@ -0,0 +1,45 @@ +open Base +open Stdio + +open Caml.Scanf +module Sys = Caml.Sys +module Package = Bap_plugins_package +module Config = Bap_plugins_config +module Units = Bap_plugins_units.Make() +open Bap_plugins_loader_backend + +let requires str = + try Some (sscanf str "requires = %S" Fn.id) with _ -> None + +let parse_meta path = + In_channel.read_lines path |> + List.find_map ~f:requires + +let collect_plugins plugindir = + if Sys.file_exists plugindir && + Sys.is_directory plugindir then + Sys.readdir plugindir |> + Array.to_list |> + List.filter_map ~f:(fun path -> + let meta = plugindir ^ "/" ^ path ^ "/" ^ "META" in + if Sys.file_exists meta then parse_meta meta + else None) + else [] + + +module Plugins = struct + let paths = [Config.plugindir ^ "/plugins"] + let list () = List.concat_map paths ~f:collect_plugins + let load name = + match Units.lookup name with + | Some _ -> () + | None -> + match Package.resolve name with + | None -> invalid_arg ("unknown package " ^ name) + | Some lib -> + Units.record name (`Requested_by name); + load lib + let load_all () = + list () |> List.iter ~f:load + +end diff --git a/lib/bap_plugins/bap_plugins.ml b/lib/bap_plugins/bap_plugins.ml index 48cca3b1b..651b15969 100644 --- a/lib/bap_plugins/bap_plugins.ml +++ b/lib/bap_plugins/bap_plugins.ml @@ -4,6 +4,7 @@ open Bap_future.Std open Or_error.Monad_infix module Units = Bap_plugins_units.Make() +module Package = Bap_plugins_package module Filename = Caml.Filename module Sys = Caml.Sys @@ -15,15 +16,21 @@ module Plugin = struct let argv () = !args + type body = + | Bundle of { + path : string; + bundle : bundle; + } + | Package + type t = { - path : string; name : string; - bundle : bundle; + body : body; loaded : unit future; finish : unit promise; - } [@@deriving fields] + } - let sexp_of_t {path} = sexp_of_string path + let sexp_of_t {name} = sexp_of_string name type system_event = [ | `Opening of string @@ -37,10 +44,9 @@ module Plugin = struct let system_events,event = Stream.create () let notify (value : system_event) = Signal.send event value - let load = ref Dynlink.loadfile + let load = Bap_plugins_loader_backend.load + let setup_dynamic_loader = Bap_plugins_loader_backend.install - let setup_dynamic_loader loader = - load := loader let init = lazy (Units.init ()) @@ -50,33 +56,33 @@ module Plugin = struct let bundle = Bundle.of_uri (Uri.of_string path) in let name = Bundle.manifest bundle |> Manifest.name in let loaded,finish = Future.create () in - {name; path; bundle; loaded; finish} + {name; body = Bundle {path; bundle}; loaded; finish} with exn -> let err = Error.of_exn exn in notify (`Errored (path,err)); raise exn - let manifest p = Bundle.manifest p.bundle - let name p = manifest p |> Manifest.name + let is_bundled = function + | {body=Bundle _} -> true + | _ -> false + + let of_package name = + let loaded,finish = Future.create () in + {name; body = Package; loaded; finish;} + + let manifest p = match p.body with + | Bundle {bundle} -> Bundle.manifest bundle + | Package -> Manifest.create p.name + + let name p = p.name let desc p = manifest p |> Manifest.desc let tags p = manifest p |> Manifest.tags let cons p = manifest p |> Manifest.cons - let find_library_exn name = - let dir = Findlib.package_directory name in - let nat = if Dynlink.is_native then "native" else "byte" in - let pre = ["plugin"; nat ] in - let cmx = Findlib.package_property pre name "archive" in - let file = Dynlink.adapt_filename cmx in - Findlib.resolve_path ~base:dir file - - let find_library name = - try Some (find_library_exn name) with _ -> None - let load_unit ~reason ~name pkg : unit or_error = try notify (`Linking name); - !load pkg; + load pkg; Units.record name reason; Ok () with @@ -88,6 +94,16 @@ module Plugin = struct let is_debugging () = try String.(Sys.getenv "BAP_DEBUG" <> "0") with Caml.Not_found -> false + let bundle = function {body=Bundle {bundle}} -> bundle + | _ -> assert false + + let path = function {body=Bundle {path}} -> path + | {name} -> sprintf "package:%s" name + + + let loaded p = p.loaded + + let do_if_not_debugging f x = if is_debugging () then () else f x @@ -123,13 +139,13 @@ module Plugin = struct let reason = if main then `Provided_by plugin.name else `Requested_by plugin.name in - Bundle.get_file ~name:dst plugin.bundle path |> function + Bundle.get_file ~name:dst (bundle plugin) path |> function | Some uri -> let path = Uri.to_string uri in let result = load_unit ~reason ~name path in do_if_not_debugging Sys.remove path; result - | None -> match find_library name with + | None -> match Package.resolve name with | Some lib -> let name = Filename.(basename name |> chop_extension) in load_unit ~reason ~name lib @@ -160,25 +176,51 @@ module Plugin = struct let is_missing dep = Option.is_none (Units.lookup dep) - let try_load (plugin : t) = - if Future.is_decided plugin.loaded - then Ok () - else - let lazy () = init in - notify (`Loading plugin); - let m = manifest plugin in - let mains = Manifest.provides m in - validate_provided plugin mains >>= fun () -> - let reqs = Manifest.requires m |> List.filter ~f:is_missing in - let main = Manifest.main m in - let old_bundle = main_bundle () in - set_main_bundle (bundle plugin); - load_entries plugin reqs >>= fun () -> - load_entry ~main:true plugin main >>| fun () -> - Promise.fulfill plugin.finish (); - notify (`Loaded plugin); - set_main_bundle old_bundle - + type context = unit -> unit + let enter p = match p.body with + | Bundle {bundle} -> + let old = main_bundle () in + set_main_bundle bundle; + fun () -> set_main_bundle old + | Package -> + let old = Manifest.switch (Manifest.create p.name) in + fun () -> Manifest.update old + + let leave f = f () + + let with_context p ~f = + let finally = enter p in + protect ~f ~finally + + + let try_load_bundled (plugin : t) = + let lazy () = init in + notify (`Loading plugin); + let m = manifest plugin in + let mains = Manifest.provides m in + validate_provided plugin mains >>= fun () -> + let reqs = Manifest.requires m |> List.filter ~f:is_missing in + let main = Manifest.main m in + let old_bundle = main_bundle () in + set_main_bundle (bundle plugin); + load_entries plugin reqs >>= fun () -> + load_entry ~main:true plugin main >>| fun () -> + Promise.fulfill plugin.finish (); + notify (`Loaded plugin); + set_main_bundle old_bundle + + let try_load plugin = match plugin.body with + | Bundle _ -> try_load_bundled plugin + | Package -> + try + notify (`Loading plugin); + with_context plugin ~f:(fun () -> + Bap_common.Plugins.load plugin.name; + Promise.fulfill plugin.finish (); + notify (`Loaded plugin); + Ok ()) + with exn -> + Or_error.of_exn exn let with_argv argv f = match argv with | None -> f () @@ -194,13 +236,15 @@ module Plugin = struct args := old; raise exn - let do_load plugin = - match try_load plugin with - | Error err as result -> - notify (`Errored (plugin.name,err)); - result - | result -> result + if Future.is_decided plugin.loaded + then Ok () + else + match try_load plugin with + | Error err as result -> + notify (`Errored (plugin.name,err)); + result + | result -> result let load ?argv plugin = with_argv argv (fun () -> do_load plugin) @@ -237,7 +281,7 @@ module Plugins = struct | Ok p -> Plugin.name p | Error (name,_) -> name - let collect ?env ?provides ?(library=[]) () = + let collect_bundles ?env ?provides ?(library=[]) () = let (/) x y = x ^ "/" ^ y in let strset = Set.of_list (module String) in let provides = Option.map provides ~f:strset in @@ -257,11 +301,23 @@ module Plugins = struct String.compare (plugin_name x) (plugin_name y)) - let list ?env ?provides ?library () = - collect ?env ?provides ?library () |> List.filter_map ~f:(function + let list_bundles ?env ?provides ?library () = + collect_bundles ?env ?provides ?library () |> List.filter_map ~f:(function | Ok p -> Some p | Error _ -> None) + let list_packages () = + Bap_common.Plugins.list () |> + List.map ~f:Plugin.of_package + + let list ?env ?provides ?library () = + list_bundles ?env ?provides ?library () @ + list_packages () + + let collect ?env ?provides ?library () = + collect_bundles ?env ?provides ?library () @ + List.map ~f:Result.return @@list_packages () + let loaded,finished = Future.create () let load ?argv ?env ?provides ?library ?(exclude=[]) () = diff --git a/lib/bap_plugins/bap_plugins.mli b/lib/bap_plugins/bap_plugins.mli index 6dec507cd..eb8d922fd 100644 --- a/lib/bap_plugins/bap_plugins.mli +++ b/lib/bap_plugins/bap_plugins.mli @@ -8,10 +8,8 @@ open Bap_future.Std (** Interface to the plugin subsystem. *) module Std : sig - type plugin - (** Plugin - a loadable self-contained piece of code. Plugin is a bundle, that contains code, data and meta @@ -25,18 +23,50 @@ module Std : sig (** [of_path path] creates a plugin of a give [path] *) val of_path : string -> t - (** [path plugin] is a plugin's path *) + (** [of_package] creates a lightweight plugin from a package. + + The created plugin doesn't bundle any dependencies and + corresponds to a META file that contains the required + libraries. + + @since 2.6.0 *) + val of_package : string -> t + + + (** [is_bundled plugin] is [true] if the plugin was created of a bundle. + + @since 2.6.0 *) + val is_bundled : t -> bool + + (** [path plugin] is a plugin's path. + + + For plugins that represent packages, returns package:. + *) val path : t -> string (** [name plugin] is a plugin's name *) val name : t -> string - (** [desc plugin] returns plugin description *) + (** [desc plugin] returns plugin description.*) val desc : t -> string - (** [bundle plugin] returns a plugin's bundle *) + (** [bundle p] returns the plugin [p] bundle. + + @raises Invalid_arg if not [is_bundled p]. + @since 2.6.0 raises an exception for packaged plugins + *) val bundle : t -> bundle + (** [manifest p] returns the embedded manifest. + + @since 2.6.0 *) + val manifest : t -> manifest + + + (** [] *) + val with_context : t -> f:(unit -> 'a) -> 'a + (** [load plugin] load all unsatisfied dependencies of a [plugin], and then load the [plugin] itself. If it is already loaded, then do nothing. diff --git a/lib/bap_plugins/bap_plugins_loader_backend.ml b/lib/bap_plugins/bap_plugins_loader_backend.ml new file mode 100644 index 000000000..9df7087b5 --- /dev/null +++ b/lib/bap_plugins/bap_plugins_loader_backend.ml @@ -0,0 +1,4 @@ +let load = ref Dynlink.loadfile + +let install loader = load := loader +let load x = !load x diff --git a/lib/bap_plugins/bap_plugins_loader_backend.mli b/lib/bap_plugins/bap_plugins_loader_backend.mli new file mode 100644 index 000000000..31bf4349f --- /dev/null +++ b/lib/bap_plugins/bap_plugins_loader_backend.mli @@ -0,0 +1,2 @@ +val install : (string -> unit) -> unit +val load : string -> unit diff --git a/lib/bap_plugins/bap_plugins_package.ml b/lib/bap_plugins/bap_plugins_package.ml new file mode 100644 index 000000000..634b8876d --- /dev/null +++ b/lib/bap_plugins/bap_plugins_package.ml @@ -0,0 +1,12 @@ +let find_exn name = + let dir = Findlib.package_directory name in + let nat = if Dynlink.is_native then "native" else "byte" in + let pre = ["plugin"; nat ] in + let cmx = Findlib.package_property pre name "archive" in + let file = Dynlink.adapt_filename cmx in + Findlib.resolve_path ~base:dir file + +let resolve name = + try Some (find_exn name) with _ -> None + +let list () = Findlib.list_packages' () diff --git a/lib/bap_plugins/bap_plugins_package.mli b/lib/bap_plugins/bap_plugins_package.mli new file mode 100644 index 000000000..19b28f742 --- /dev/null +++ b/lib/bap_plugins/bap_plugins_package.mli @@ -0,0 +1,2 @@ +val resolve : string -> string option +val list : unit -> string list diff --git a/lib/bap_plugins/dune b/lib/bap_plugins/dune new file mode 100644 index 000000000..994bc1bcd --- /dev/null +++ b/lib/bap_plugins/dune @@ -0,0 +1,25 @@ +(library + (name bap_plugins) + (public_name bap-plugins) + (wrapped false) + (modules :standard \ bap_common) + (private_modules + bap_plugins_config + bap_plugins_loader_backend + bap_plugins_package + bap_plugins_units) + (preprocess (pps ppx_bap)) + (libraries core_kernel dynlink fileutils findlib uri + bap-bundle bap-common bap-future + dune-site + dune-site.plugins + compiler-libs.common)) + +(rule + (target bap_plugins_config.ml) + (deps bap_plugins_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/lib/bap_powerpc/dune b/lib/bap_powerpc/dune new file mode 100644 index 000000000..cf36170ec --- /dev/null +++ b/lib/bap_powerpc/dune @@ -0,0 +1,6 @@ +(library + (name bap_powerpc) + (public_name bap-powerpc) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-knowledge bap-core-theory core_kernel ogre)) diff --git a/lib/bap_primus/.merlin b/lib/bap_primus/.merlin deleted file mode 100644 index 73b2dc662..000000000 --- a/lib/bap_primus/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG zarith -REC diff --git a/lib/bap_primus/bap_primus_lisp_resolve.ml b/lib/bap_primus/bap_primus_lisp_resolve.ml index 55c52b87a..a5b264574 100644 --- a/lib/bap_primus/bap_primus_lisp_resolve.ml +++ b/lib/bap_primus/bap_primus_lisp_resolve.ml @@ -33,8 +33,6 @@ type ('t,'a,'b) one = ('t,'a,'t Def.t * 'b) resolver type ('t,'a,'b) many = ('t,'a,('t Def.t * 'b) list) resolver -type exn += Failed of string * Context.t * resolution - let has_name d name = String.equal (Def.name d) name (* all definitions with the given name *) diff --git a/lib/bap_primus/bap_primus_system.ml b/lib/bap_primus/bap_primus_system.ml index f4a8b6a66..9c0701cc5 100644 --- a/lib/bap_primus/bap_primus_system.ml +++ b/lib/bap_primus/bap_primus_system.ml @@ -39,8 +39,6 @@ type system = t module Repository = struct let self = Hashtbl.create (module Name) - exception Not_found - let add sys = if Hashtbl.mem self sys.name then invalid_argf "System named %s is already present in the repository" diff --git a/lib/bap_primus/dune b/lib/bap_primus/dune new file mode 100644 index 000000000..b4df0a7d9 --- /dev/null +++ b/lib/bap_primus/dune @@ -0,0 +1,22 @@ +(library + (name bap_primus) + (public_name bap-primus) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries + bap + bap-abi + bap-c + bap-core-theory + bap-future + bap-knowledge + bap-strings + bitvec + bitvec-binprot + core_kernel + graphlib + monads + parsexp + regular + uuidm + zarith)) \ No newline at end of file diff --git a/lib/bap_primus_track_visited/dune b/lib/bap_primus_track_visited/dune new file mode 100644 index 000000000..3ee82aea7 --- /dev/null +++ b/lib/bap_primus_track_visited/dune @@ -0,0 +1,6 @@ +(library + (name bap_primus_track_visited) + (public_name bap-primus-track-visited) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-primus core_kernel)) diff --git a/lib/bap_recipe/dune b/lib/bap_recipe/dune new file mode 100644 index 000000000..1b3a3059a --- /dev/null +++ b/lib/bap_recipe/dune @@ -0,0 +1,5 @@ +(library + (name bap_recipe) + (public_name bap-recipe) + (wrapped false) + (libraries stdlib-shims base stdio parsexp fileutils camlzip uuidm)) \ No newline at end of file diff --git a/lib/bap_relation/bap_relation.mli b/lib/bap_relation/bap_relation.mli index ebfb7f65d..132bc88a9 100644 --- a/lib/bap_relation/bap_relation.mli +++ b/lib/bap_relation/bap_relation.mli @@ -1,7 +1,7 @@ (** A representation of relations between two sets. A relation between two sets is a set of pairs made from the - elements of these sets. The precise mathematical defition is given + elements of these sets. The precise mathematical definition is given below. This module implements a bidirectional mapping between two sets and computes their matching that defines bijections between the sets. diff --git a/lib/bap_relation/dune b/lib/bap_relation/dune new file mode 100644 index 000000000..1c81a5605 --- /dev/null +++ b/lib/bap_relation/dune @@ -0,0 +1,4 @@ +(library + (name bap_relation) + (public_name bap-relation) + (libraries base)) diff --git a/lib/bap_riscv/dune b/lib/bap_riscv/dune new file mode 100644 index 000000000..6d0c74eab --- /dev/null +++ b/lib/bap_riscv/dune @@ -0,0 +1,6 @@ +(library + (name bap_riscv) + (public_name bap-riscv) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap-core-theory bap-knowledge core_kernel )) diff --git a/lib/bap_sema/bap_sema_abi.mli b/lib/bap_sema/bap_sema_abi.mli deleted file mode 100644 index fc8c5355d..000000000 --- a/lib/bap_sema/bap_sema_abi.mli +++ /dev/null @@ -1,4 +0,0 @@ -open Bap_types.Std -open Bap_ir - -val infer_args : sub term -> arch -> sub term diff --git a/lib/bap_sema/bap_sema_ssa.ml b/lib/bap_sema/bap_sema_ssa.ml index f8744702e..e025f6cc0 100644 --- a/lib/bap_sema/bap_sema_ssa.ml +++ b/lib/bap_sema/bap_sema_ssa.ml @@ -89,7 +89,7 @@ let blocks_that_define_var var sub : tid list = of the variable to a top value of a stack for this variable, if it is not empty *) let substitute vars = (object - inherit Exp.mapper as super + inherit Exp.mapper method! map_sym z = match Hashtbl.find vars z with | None | Some [] -> z diff --git a/lib/bap_sema/dune b/lib/bap_sema/dune new file mode 100644 index 000000000..dc1b44259 --- /dev/null +++ b/lib/bap_sema/dune @@ -0,0 +1,15 @@ +(library + (name bap_sema) + (public_name bap-std.sema) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap-core-theory + bap_disasm + bap_image + bap-knowledge + bap_types + core_kernel + graphlib + monads + regular)) \ No newline at end of file diff --git a/lib/bap_strings/dune b/lib/bap_strings/dune new file mode 100644 index 000000000..c8d6a9e5b --- /dev/null +++ b/lib/bap_strings/dune @@ -0,0 +1,6 @@ +(library + (name bap_strings) + (public_name bap-strings) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries core_kernel)) \ No newline at end of file diff --git a/lib/bap_systemz/dune b/lib/bap_systemz/dune new file mode 100644 index 000000000..08de847f6 --- /dev/null +++ b/lib/bap_systemz/dune @@ -0,0 +1,5 @@ +(library + (name bap_systemz) + (public_name bap-systemz) + (wrapped false) + (libraries bap-core-theory bap-knowledge core_kernel)) diff --git a/lib/bap_taint/.merlin b/lib/bap_taint/.merlin deleted file mode 100644 index 78f484151..000000000 --- a/lib/bap_taint/.merlin +++ /dev/null @@ -1,7 +0,0 @@ -REC - -B ../../_build/lib/bap_primus -B ../../_build/lib/bap_strings - -B ../bap_primus -B ../bap_strings diff --git a/lib/bap_taint/bap_taint.ml b/lib/bap_taint/bap_taint.ml index 8db983daf..5396b9412 100644 --- a/lib/bap_taint/bap_taint.ml +++ b/lib/bap_taint/bap_taint.ml @@ -268,8 +268,6 @@ module Taint = struct Machine.Local.put tainter {s with indirect} >>| fun () -> taint - exception Bad_object of Primus.value - let kill_objects kill = Map.filter_map ~f:(fun objects -> match Set.diff objects kill with diff --git a/lib/bap_taint/dune b/lib/bap_taint/dune new file mode 100644 index 000000000..9a27edffd --- /dev/null +++ b/lib/bap_taint/dune @@ -0,0 +1,6 @@ +(library + (name bap_taint) + (public_name bap-taint) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-primus bap-strings core_kernel monads regular)) diff --git a/lib/bap_traces/.merlin b/lib/bap_traces/.merlin deleted file mode 100644 index df88fce81..000000000 --- a/lib/bap_traces/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_traces \ No newline at end of file diff --git a/lib/bap_traces/bap_trace.ml b/lib/bap_traces/bap_trace.ml index 98eab0690..4e2c76596 100644 --- a/lib/bap_traces/bap_trace.ml +++ b/lib/bap_traces/bap_trace.ml @@ -82,7 +82,7 @@ let protos : (module P) Tab.t = mk_tab () let readers: (Uri.t -> id -> (reader, io_error) Result.t) Tab.t = mk_tab () let writers: (Uri.t -> t -> (unit, io_error) Result.t) Tab.t = mk_tab () -let make_id () = Bap_trace_id.create `V4 +let make_id () = Bap_trace_id.v `V4 let make_error (#error as r) = Error r diff --git a/lib/bap_traces/dune b/lib/bap_traces/dune new file mode 100644 index 000000000..c9bee6954 --- /dev/null +++ b/lib/bap_traces/dune @@ -0,0 +1,14 @@ +(library + (name bap_traces) + (public_name bap-traces) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries + bap + bap-core-theory + bap-knowledge + core_kernel + core_kernel.caml_unix + regular + uri + uuidm)) diff --git a/lib/bap_types/.merlin b/lib/bap_types/.merlin deleted file mode 100644 index 343687aeb..000000000 --- a/lib/bap_types/.merlin +++ /dev/null @@ -1,6 +0,0 @@ -PKG zarith -PKG uuidm -REC - -B ../../_build/lib/bap_types -B ../../_build/lib/knowledge diff --git a/lib/bap_types/bap_addr.ml b/lib/bap_types/bap_addr.ml index 1f3216196..ddea23dd1 100644 --- a/lib/bap_types/bap_addr.ml +++ b/lib/bap_types/bap_addr.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types let memref ?(disp=0) ?(index=0) ?(scale=`r8) addr = diff --git a/lib/bap_types/bap_addr.mli b/lib/bap_types/bap_addr.mli index 6f1939db4..a18c783d2 100644 --- a/lib/bap_types/bap_addr.mli +++ b/lib/bap_types/bap_addr.mli @@ -9,7 +9,7 @@ *) open Core_kernel[@@warning "-D"] -open Bap_common +open Bap_common_types val memref : ?disp:int -> ?index:int -> ?scale:size -> addr -> addr (** Address arithmetic *) diff --git a/lib/bap_types/bap_arch.ml b/lib/bap_types/bap_arch.ml index 2f846770f..56445c0dd 100644 --- a/lib/bap_types/bap_arch.ml +++ b/lib/bap_types/bap_arch.ml @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std -open Bap_common +open Bap_common_types module T = struct open Arch diff --git a/lib/bap_types/bap_arch.mli b/lib/bap_types/bap_arch.mli index 3395de5ca..87afeda59 100644 --- a/lib/bap_types/bap_arch.mli +++ b/lib/bap_types/bap_arch.mli @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std -open Bap_common +open Bap_common_types val of_string : string -> arch option diff --git a/lib/bap_types/bap_bil.ml b/lib/bap_types/bap_bil.ml index e0d1c5f6a..d746166bc 100644 --- a/lib/bap_types/bap_bil.ml +++ b/lib/bap_types/bap_bil.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types type var = Bap_var.t [@@deriving bin_io, compare, sexp] diff --git a/lib/bap_types/bap_bil_adt.ml b/lib/bap_types/bap_bil_adt.ml index b286d7bea..b34aed93f 100644 --- a/lib/bap_types/bap_bil_adt.ml +++ b/lib/bap_types/bap_bil_adt.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types open Bap_bil module Word = Bitvector diff --git a/lib/bap_types/bap_bil_adt.mli b/lib/bap_types/bap_bil_adt.mli index 73a7b92f3..ad9ee5af1 100644 --- a/lib/bap_types/bap_bil_adt.mli +++ b/lib/bap_types/bap_bil_adt.mli @@ -1,5 +1,5 @@ open Core_kernel[@@warning "-D"] -open Bap_common +open Bap_common_types open Bap_bil open Format diff --git a/lib/bap_types/bap_bil_optimizations.ml b/lib/bap_types/bap_bil_optimizations.ml index b0a6f25e9..4adfd1a59 100644 --- a/lib/bap_types/bap_bil_optimizations.ml +++ b/lib/bap_types/bap_bil_optimizations.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_visitor diff --git a/lib/bap_types/bap_bili.ml b/lib/bap_types/bap_bili.ml index 447748c89..36e64413a 100644 --- a/lib/bap_types/bap_bili.ml +++ b/lib/bap_types/bap_bili.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_result open Bap_bili_types diff --git a/lib/bap_types/bap_biri.ml b/lib/bap_types/bap_biri.ml index b5397ed92..2fa70f747 100644 --- a/lib/bap_types/bap_biri.ml +++ b/lib/bap_types/bap_biri.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_ir open Bap_result diff --git a/lib/bap_types/bap_common.ml b/lib/bap_types/bap_common_types.ml similarity index 100% rename from lib/bap_types/bap_common.ml rename to lib/bap_types/bap_common_types.ml diff --git a/lib/bap_types/bap_context.ml b/lib/bap_types/bap_context.ml index cfa90e2c1..83c4f8bc3 100644 --- a/lib/bap_types/bap_context.ml +++ b/lib/bap_types/bap_context.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Bap_result -open Bap_common +open Bap_common_types open Bap_bil type delta = result Bap_var.Map.t diff --git a/lib/bap_types/bap_context.mli b/lib/bap_types/bap_context.mli index f445d2853..9d438e80c 100644 --- a/lib/bap_types/bap_context.mli +++ b/lib/bap_types/bap_context.mli @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Bap_result -open Bap_common +open Bap_common_types open Bap_bil class t : object('s) diff --git a/lib/bap_types/bap_core_theory_bil_parser.ml b/lib/bap_types/bap_core_theory_bil_parser.ml index 35980b233..f80c55ba3 100644 --- a/lib/bap_types/bap_core_theory_bil_parser.ml +++ b/lib/bap_types/bap_core_theory_bil_parser.ml @@ -7,7 +7,7 @@ include Bap_main.Loggers() module Exp = Bap_exp.Exp module Bil = Bap_bil module Word = Bap_bitvector -module Type = Bap_common.Type +module Type = Bap_common_types.Type module Size = Bap_size module Stmt = Bap_stmt.Stmt diff --git a/lib/bap_types/bap_eval.ml b/lib/bap_types/bap_eval.ml index 24141153f..e0fbd3982 100644 --- a/lib/bap_types/bap_eval.ml +++ b/lib/bap_types/bap_eval.ml @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Monads.Std open Regular.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_eval_types diff --git a/lib/bap_types/bap_eval_types.ml b/lib/bap_types/bap_eval_types.ml index db4b95f40..138b3b734 100644 --- a/lib/bap_types/bap_eval_types.ml +++ b/lib/bap_types/bap_eval_types.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_result open Bap_bil open Bap_type_error diff --git a/lib/bap_types/bap_exp.ml b/lib/bap_types/bap_exp.ml index 24199f462..06fb03f8f 100644 --- a/lib/bap_types/bap_exp.ml +++ b/lib/bap_types/bap_exp.ml @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Bap_knowledge open Bap_core_theory -open Bap_common +open Bap_common_types open Format open Bap_bil diff --git a/lib/bap_types/bap_exp.mli b/lib/bap_types/bap_exp.mli index 72bc4eaa4..efc068d84 100644 --- a/lib/bap_types/bap_exp.mli +++ b/lib/bap_types/bap_exp.mli @@ -3,7 +3,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std open Bap_knowledge -open Bap_common +open Bap_common_types open Bap_bil open Format diff --git a/lib/bap_types/bap_expi.mli b/lib/bap_types/bap_expi.mli index 21ef7f339..e2992f37d 100644 --- a/lib/bap_types/bap_expi.mli +++ b/lib/bap_types/bap_expi.mli @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_result open Bap_type_error diff --git a/lib/bap_types/bap_expi_types.ml b/lib/bap_types/bap_expi_types.ml index 3ad8c29cd..574c00c1e 100644 --- a/lib/bap_types/bap_expi_types.ml +++ b/lib/bap_types/bap_expi_types.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Bap_result -open Bap_common +open Bap_common_types open Bap_bil open Bap_type_error open Bap_eval_types diff --git a/lib/bap_types/bap_helpers.ml b/lib/bap_types/bap_helpers.ml index 6cac36cc7..0e4a813b7 100644 --- a/lib/bap_types/bap_helpers.ml +++ b/lib/bap_types/bap_helpers.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Monads.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_visitor diff --git a/lib/bap_types/bap_helpers.mli b/lib/bap_types/bap_helpers.mli index 4e2e64caa..a6b16553b 100644 --- a/lib/bap_types/bap_helpers.mli +++ b/lib/bap_types/bap_helpers.mli @@ -1,7 +1,7 @@ (** BIL high level functions. *) open Core_kernel[@@warning "-D"] open Bap_core_theory -open Bap_common +open Bap_common_types open Bap_bil open Bap_visitor open Bap_result diff --git a/lib/bap_types/bap_ir.ml b/lib/bap_types/bap_ir.ml index cced611cc..d17fbb7ba 100644 --- a/lib/bap_types/bap_ir.ml +++ b/lib/bap_types/bap_ir.ml @@ -3,7 +3,7 @@ let package = "bap" open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_knowledge diff --git a/lib/bap_types/bap_ir.mli b/lib/bap_types/bap_ir.mli index 1e80229f6..7641e809a 100644 --- a/lib/bap_types/bap_ir.mli +++ b/lib/bap_types/bap_ir.mli @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Bap_core_theory -open Bap_common +open Bap_common_types open Bap_bil open Bap_value open Bap_visitor diff --git a/lib/bap_types/bap_ir_callgraph.ml b/lib/bap_types/bap_ir_callgraph.ml index eacfda552..ed0e5b626 100644 --- a/lib/bap_types/bap_ir_callgraph.ml +++ b/lib/bap_types/bap_ir_callgraph.ml @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Graphlib.Std open Bap_ir -open Bap_common +open Bap_common_types module G = Graphlib.Make(Tid)(struct type t = jmp term list end) diff --git a/lib/bap_types/bap_ir_graph.ml b/lib/bap_types/bap_ir_graph.ml index 5d6be98e8..bb8117ba4 100644 --- a/lib/bap_types/bap_ir_graph.ml +++ b/lib/bap_types/bap_ir_graph.ml @@ -4,7 +4,7 @@ open Graphlib.Std open Option.Monad_infix open Bap_bil -open Bap_common +open Bap_common_types open Bap_ir module Jmp = Ir_jmp module Blk = Ir_blk diff --git a/lib/bap_types/bap_ir_graph.mli b/lib/bap_types/bap_ir_graph.mli index 9512786b0..c00ed5f0e 100644 --- a/lib/bap_types/bap_ir_graph.mli +++ b/lib/bap_types/bap_ir_graph.mli @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Graphlib.Std -open Bap_common +open Bap_common_types open Bap_bil open Bap_ir diff --git a/lib/bap_types/bap_result.ml b/lib/bap_types/bap_result.ml index ccc591c44..b653d0d4d 100644 --- a/lib/bap_types/bap_result.ml +++ b/lib/bap_types/bap_result.ml @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Monads.Std open Regular.Std -open Bap_common +open Bap_common_types class type storage = object('s) method load : addr -> word option diff --git a/lib/bap_types/bap_result.mli b/lib/bap_types/bap_result.mli index 606466fe2..05ec939f1 100644 --- a/lib/bap_types/bap_result.mli +++ b/lib/bap_types/bap_result.mli @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Monads.Std open Regular.Std -open Bap_common +open Bap_common_types class type storage = object('s) method load : addr -> word option diff --git a/lib/bap_types/bap_size.ml b/lib/bap_types/bap_size.ml index ea0242708..1183687c4 100644 --- a/lib/bap_types/bap_size.ml +++ b/lib/bap_types/bap_size.ml @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Or_error -open Bap_common +open Bap_common_types let in_bits : 'a -> int = function | `r8 -> 8 diff --git a/lib/bap_types/bap_size.mli b/lib/bap_types/bap_size.mli index ce89fc5f4..c692d17d1 100644 --- a/lib/bap_types/bap_size.mli +++ b/lib/bap_types/bap_size.mli @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types (** {2 Lifting from int} *) diff --git a/lib/bap_types/bap_stmt.ml b/lib/bap_types/bap_stmt.ml index 09134e12b..6f3c366f9 100644 --- a/lib/bap_types/bap_stmt.ml +++ b/lib/bap_types/bap_stmt.ml @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Bap_knowledge open Regular.Std -open Bap_common +open Bap_common_types open Format open Bap_bil diff --git a/lib/bap_types/bap_stmt.mli b/lib/bap_types/bap_stmt.mli index 6f73e6bac..10f70625c 100644 --- a/lib/bap_types/bap_stmt.mli +++ b/lib/bap_types/bap_stmt.mli @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Bap_knowledge open Regular.Std -open Bap_common +open Bap_common_types open Bap_bil diff --git a/lib/bap_types/bap_type.ml b/lib/bap_types/bap_type.ml index 947353aa6..bd0ed2a7a 100644 --- a/lib/bap_types/bap_type.ml +++ b/lib/bap_types/bap_type.ml @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std open Format -open Bap_common +open Bap_common_types open Type module T = struct diff --git a/lib/bap_types/bap_type.mli b/lib/bap_types/bap_type.mli index 9eb89e819..ec1ccb7eb 100644 --- a/lib/bap_types/bap_type.mli +++ b/lib/bap_types/bap_type.mli @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types module Export : sig val bool_t : typ diff --git a/lib/bap_types/bap_type_error.ml b/lib/bap_types/bap_type_error.ml index 47bd7a894..a5b569b2a 100644 --- a/lib/bap_types/bap_type_error.ml +++ b/lib/bap_types/bap_type_error.ml @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types type t = [ | `bad_kind of [`mem | `imm] diff --git a/lib/bap_types/bap_type_error.mli b/lib/bap_types/bap_type_error.mli index 25f9715bc..8ad3e9fe5 100644 --- a/lib/bap_types/bap_type_error.mli +++ b/lib/bap_types/bap_type_error.mli @@ -1,6 +1,6 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types type t = [ diff --git a/lib/bap_types/bap_types.ml b/lib/bap_types/bap_types.ml index d5ad5e1ec..28163a344 100644 --- a/lib/bap_types/bap_types.ml +++ b/lib/bap_types/bap_types.ml @@ -7,7 +7,7 @@ open Core_kernel[@@warning "-D"] open Regular.Std -open Bap_common +open Bap_common_types open Bap_knowledge (** This module is included into [Bap.Std], you need to open it @@ -193,7 +193,7 @@ module Std = struct (** Byte endian. This is the only not first class type in a bap-types. Sorry, no maps and tables for this type. *) - type endian = Bap_common.endian = LittleEndian | BigEndian + type endian = Bap_common_types.endian = LittleEndian | BigEndian [@@deriving sexp, bin_io, compare] (** {2 Type abbreviations} @@ -209,7 +209,7 @@ module Std = struct (** [addr_size] is a subset of sizes that contains only two instances [`r32] and [`r64] *) - type nonrec addr_size = Bap_common.addr_size + type nonrec addr_size = Bap_common_types.addr_size [@@deriving bin_io, compare, sexp] type addr = Addr.t [@@deriving bin_io, compare, sexp] diff --git a/lib/bap_types/bap_var.ml b/lib/bap_types/bap_var.ml index 5ea904ddf..724f4557c 100644 --- a/lib/bap_types/bap_var.ml +++ b/lib/bap_types/bap_var.ml @@ -1,7 +1,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std -open Bap_common +open Bap_common_types type var = Var : 'a Theory.Var.t -> var diff --git a/lib/bap_types/bap_var.mli b/lib/bap_types/bap_var.mli index 16ee71b41..ddb94ab53 100644 --- a/lib/bap_types/bap_var.mli +++ b/lib/bap_types/bap_var.mli @@ -2,7 +2,7 @@ open Core_kernel[@@warning "-D"] open Bap_core_theory open Regular.Std -open Bap_common +open Bap_common_types type t include Regular.S with type t := t diff --git a/lib/bap_types/bap_visitor.ml b/lib/bap_types/bap_visitor.ml index ec5857c4f..ba5bb5dfe 100644 --- a/lib/bap_types/bap_visitor.ml +++ b/lib/bap_types/bap_visitor.ml @@ -1,5 +1,5 @@ open Core_kernel[@@warning "-D"] -open Bap_common +open Bap_common_types open Bap_bil @@ -191,8 +191,6 @@ class ['a] bil_visitor = object (self : 's) self#leave_stmt stmt x end -exception Found - class ['a] exp_finder = object(self) inherit ['a option return] exp_visitor method find exp : 'a option = diff --git a/lib/bap_types/bap_visitor.mli b/lib/bap_types/bap_visitor.mli index 0393eb77b..1ccd065f9 100644 --- a/lib/bap_types/bap_visitor.mli +++ b/lib/bap_types/bap_visitor.mli @@ -1,5 +1,5 @@ open Core_kernel[@@warning "-D"] -open Bap_common +open Bap_common_types open Bap_bil class exp_state : object diff --git a/lib/bap_types/dune b/lib/bap_types/dune new file mode 100644 index 000000000..44f950277 --- /dev/null +++ b/lib/bap_types/dune @@ -0,0 +1,19 @@ +(library + (name bap_types) + (public_name bap-std.types) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries + bap-core-theory + bap-knowledge + bap-main + bitvec + bitvec-order + bitvec-sexp + core_kernel + graphlib + monads + ogre + regular + uuidm + zarith)) \ No newline at end of file diff --git a/lib/bare/bare.ml b/lib/bare/bare.ml index 2b766b062..c935c166a 100644 --- a/lib/bare/bare.ml +++ b/lib/bare/bare.ml @@ -69,7 +69,7 @@ module Rule = struct let empty = String.Map.empty let binding x rhs = String.Map.singleton x rhs - let rec sexp_fold_atoms ~get_pos ~init ~f sexp = + let sexp_fold_atoms ~get_pos ~init ~f sexp = let rec loop init s = match s with | Sexp.Atom x -> f init (get_pos s) x | Sexp.List xs -> List.fold ~init ~f:loop xs in diff --git a/lib/bare/dune b/lib/bare/dune new file mode 100644 index 000000000..6bc0e966c --- /dev/null +++ b/lib/bare/dune @@ -0,0 +1,5 @@ +(library + (name bare) + (public_name bare) + (wrapped false) + (libraries core_kernel parsexp)) diff --git a/lib/beagle/dune b/lib/beagle/dune new file mode 100644 index 000000000..2594e4483 --- /dev/null +++ b/lib/beagle/dune @@ -0,0 +1,6 @@ +(library + (name bap_beagle_prey) + (public_name bap-beagle) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap bap-primus core_kernel monads regular)) diff --git a/lib/bitvec/.merlin b/lib/bitvec/.merlin deleted file mode 100644 index 2575fd4b8..000000000 --- a/lib/bitvec/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG zarith diff --git a/lib/bitvec/dune b/lib/bitvec/dune new file mode 100644 index 000000000..705c8a3c9 --- /dev/null +++ b/lib/bitvec/dune @@ -0,0 +1,5 @@ +(library + (name bitvec) + (public_name bitvec) + (wrapped false) + (libraries zarith)) \ No newline at end of file diff --git a/lib/bitvec_binprot/dune b/lib/bitvec_binprot/dune new file mode 100644 index 000000000..884c9d4c2 --- /dev/null +++ b/lib/bitvec_binprot/dune @@ -0,0 +1,6 @@ +(library + (name bitvec_binprot) + (public_name bitvec-binprot) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bitvec bin_prot)) \ No newline at end of file diff --git a/lib/bitvec_order/dune b/lib/bitvec_order/dune new file mode 100644 index 000000000..d0cb422e0 --- /dev/null +++ b/lib/bitvec_order/dune @@ -0,0 +1,5 @@ +(library + (name bitvec_order) + (public_name bitvec-order) + (wrapped false) + (libraries base bitvec bitvec-sexp)) \ No newline at end of file diff --git a/lib/bitvec_sexp/dune b/lib/bitvec_sexp/dune new file mode 100644 index 000000000..a6dcd2c69 --- /dev/null +++ b/lib/bitvec_sexp/dune @@ -0,0 +1,5 @@ +(library + (name bitvec_sexp) + (public_name bitvec-sexp) + (wrapped false) + (libraries bitvec sexplib0)) \ No newline at end of file diff --git a/lib/common/bap_common.ml b/lib/common/bap_common.ml new file mode 100644 index 000000000..040412196 --- /dev/null +++ b/lib/common/bap_common.ml @@ -0,0 +1,14 @@ + +module Plugins = Bap_common_private_sites.Plugins.Plugins + +open Bap_common_private_sites.Sites +let sites = function + | "api" -> api + | "lisp" -> lisp + | "plugins" -> plugins + | "primus" -> primus + | "semantics" -> semantics + | "signatures" -> signatures + | "site-lisp" | "site_lisp" -> site_lisp + | unknown -> + failwith ("Invalid site: " ^ unknown) diff --git a/lib/common/bap_common.mli b/lib/common/bap_common.mli new file mode 100644 index 000000000..311dde409 --- /dev/null +++ b/lib/common/bap_common.mli @@ -0,0 +1,10 @@ + + +val sites : string -> string list + +module Plugins : sig + val paths : string list + val list : unit -> string list + val load_all : unit -> unit + val load : string -> unit +end diff --git a/lib/common/dune b/lib/common/dune new file mode 100644 index 000000000..45db950db --- /dev/null +++ b/lib/common/dune @@ -0,0 +1,10 @@ +(library + (name bap_common) + (public_name bap-common) + (wrapped false) + (libraries dune-site dune-site.plugins)) + +(generate_sites_module + (module bap_common_private_sites) + (sites bap-common) + (plugins (bap-common plugins))) diff --git a/lib/graphlib/.merlin b/lib/graphlib/.merlin deleted file mode 100644 index 5a3cf98a5..000000000 --- a/lib/graphlib/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG ocamlgraph \ No newline at end of file diff --git a/lib/graphlib/dune b/lib/graphlib/dune new file mode 100644 index 000000000..040f732e0 --- /dev/null +++ b/lib/graphlib/dune @@ -0,0 +1,12 @@ +(library + (name graphlib) + (public_name graphlib) + (wrapped false) + (preprocess (pps ppx_bap)) + (private_modules graphlib_graph + graphlib_intf + graphlib_regular + graphlib_regular_intf + graphlib_pp) + (libraries core_kernel core_kernel.pairing_heap + regular ocamlgraph)) diff --git a/lib/knowledge/.merlin b/lib/knowledge/.merlin deleted file mode 100644 index d0549ecb5..000000000 --- a/lib/knowledge/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -PKG zarith -B ../../_build/lib/knowledge diff --git a/lib/knowledge/dune b/lib/knowledge/dune new file mode 100644 index 000000000..112a73209 --- /dev/null +++ b/lib/knowledge/dune @@ -0,0 +1,6 @@ +(library + (name knowledge) + (public_name bap-knowledge) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries core_kernel core_kernel.caml_unix monads)) \ No newline at end of file diff --git a/lib/microx/dune b/lib/microx/dune new file mode 100644 index 000000000..065519258 --- /dev/null +++ b/lib/microx/dune @@ -0,0 +1,6 @@ +(library + (name bap_microx) + (public_name bap-microx) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap monads core_kernel)) diff --git a/lib/monads/dune b/lib/monads/dune new file mode 100644 index 000000000..1977445b9 --- /dev/null +++ b/lib/monads/dune @@ -0,0 +1,7 @@ +(library + (name monads) + (public_name monads) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries core_kernel core_kernel.rope) + (private_modules monads_monad monads_monoid monads_types)) diff --git a/lib/monads/monads_monad.ml b/lib/monads/monads_monad.ml index 058f111ff..79c72fe68 100644 --- a/lib/monads/monads_monad.ml +++ b/lib/monads/monads_monad.ml @@ -112,6 +112,7 @@ module Monad = struct let expect ?(finally=Fn.nothing) ~f ~catch = let invoke f x = f x >>= fun x -> finally () >>= fun () -> return x in try invoke f () with exn -> invoke catch exn + [@@warning "-16"] end diff --git a/lib/ogre/dune b/lib/ogre/dune new file mode 100644 index 000000000..cff48c78c --- /dev/null +++ b/lib/ogre/dune @@ -0,0 +1,6 @@ +(library + (name ogre) + (public_name ogre) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries core_kernel monads)) \ No newline at end of file diff --git a/lib/regular/dune b/lib/regular/dune new file mode 100644 index 000000000..85fd215fa --- /dev/null +++ b/lib/regular/dune @@ -0,0 +1,16 @@ +(library + (name regular) + (public_name regular) + (wrapped false) + (preprocess (pps ppx_bap)) + (private_modules + regular_bytes + regular_cache + regular_data + regular_data_intf + regular_data_types + regular_data_write + regular_data_read + regular_opaque + regular_seq) + (libraries core_kernel)) diff --git a/lib/text_tags/dune b/lib/text_tags/dune new file mode 100644 index 000000000..4323c2016 --- /dev/null +++ b/lib/text_tags/dune @@ -0,0 +1,5 @@ +(library + (name text_tags) + (public_name text-tags) + (wrapped false) + (libraries core_kernel core_kernel.caml_unix)) diff --git a/lib/x86_cpu/.merlin b/lib/x86_cpu/.merlin deleted file mode 100644 index 237f6b11c..000000000 --- a/lib/x86_cpu/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../bap_demangle diff --git a/lib/x86_cpu/dune b/lib/x86_cpu/dune new file mode 100644 index 000000000..d9eefa79c --- /dev/null +++ b/lib/x86_cpu/dune @@ -0,0 +1,10 @@ +(library + (name bap_x86) + (public_name bap-x86) + (wrapped false) + (preprocess (pps ppx_bap)) + (libraries bap bap-c bap-demangle core_kernel)) + +(deprecated_library_name + (old_public_name bap-x86-cpu) + (new_public_name bap-x86)) diff --git a/lib_test/.merlin b/lib_test/.merlin deleted file mode 100644 index 32056be27..000000000 --- a/lib_test/.merlin +++ /dev/null @@ -1,25 +0,0 @@ -B ../_build/lib_test/bap_core -B ../_build/lib_test/bap_disasm -B ../_build/lib_test/bap_dwarf -B ../_build/lib_test/bap_elf -B ../_build/lib_test/bap_future -B ../_build/lib_test/bap_image -B ../_build/lib_test/bap_project -B ../_build/lib_test/bap_sema -B ../_build/lib_test/bap_trace -B ../_build/lib_test/bap_types -B ../_build/lib_test/x86 - -REC -S bap_core -S bap_disasm -S bap_dwarf -S bap_elf -S bap_future -S bap_image -S bap_project -S bap_sema -S bap_types -S bap_trace -S x86 -PKG oUnit \ No newline at end of file diff --git a/lib_test/bap/dune b/lib_test/bap/dune new file mode 100644 index 000000000..14b941294 --- /dev/null +++ b/lib_test/bap/dune @@ -0,0 +1,9 @@ +(test + (name run_tests) + (package bap) + (libraries bap bap-plugins ounit2 threads + test_types + test_image + test_disasm + test_sema + test_project)) diff --git a/lib/bap_api/bap_api_attr.ml b/lib_test/bap/run_tests.mli similarity index 100% rename from lib/bap_api/bap_api_attr.ml rename to lib_test/bap/run_tests.mli diff --git a/lib_test/bap_disasm/dune b/lib_test/bap_disasm/dune new file mode 100644 index 000000000..fd7a7faa6 --- /dev/null +++ b/lib_test/bap_disasm/dune @@ -0,0 +1,5 @@ +(library + (name test_disasm) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel ounit2 str)) diff --git a/lib_test/bap_image/dune b/lib_test/bap_image/dune new file mode 100644 index 000000000..7983bc67e --- /dev/null +++ b/lib_test/bap_image/dune @@ -0,0 +1,5 @@ +(library + (name test_image) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel ounit2)) diff --git a/lib_test/bap_image/test_llvm_loader.ml b/lib_test/bap_image/test_llvm_loader.ml deleted file mode 100644 index 7a2c20106..000000000 --- a/lib_test/bap_image/test_llvm_loader.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* This test compare llvm and native loader image - - By default it compare images created from /bin/ls binary in unix os_type. - It can be used with others files, for example: - - ./run_tests.native -only-test name -loader-binary path - - where - name = BAP:9:Image:0:llvm_loader - path - path to binary e.g. gcc_coreutils_64_O0_cat - - To make test over files in binary repository it can be used like this: - - find ../x86_64-binaries/elf/ -type f -name "gcc_*O0*" -exec \ - ./run_tests.native -only-test BAP:9:Image:0:llvm_loader -loader-binary '{}' \; -*) -open Core_kernel[@@warning "-D"] -open OUnit2 -open Or_error -open Bap_types.Std -open Image_backend - -(* According to llvm (ObjectFile.h line 186) - symbols type can be debug or function. - That's why we don't compare is_debug field *) -module SS = Set.Make( - struct - include Symbol - let compare t1 t2 = - let open Symbol in - let t2' = {t2 with is_debug = t1.is_debug} in - compare t1 t2' - end) - -let get_filename = - let default = match Sys.os_type with - | "Unix" -> "/bin/ls" - | "Win32" | "Cygwin" -> "" - | _ -> "" in - Conf.make_string "loader_binary" default - "native and llvm loaders compare test file path" - - -let run_test ctxt = - let file = get_filename ctxt in - if not (Sys.file_exists file) then skip_if true "file not found"; - let img1, img2 = - let img1_opt, img2_opt as images = - Bap_fileutils.readfile file |> Bap_native_loader.of_data, - Bap_fileutils.readfile file |> Bap_llvm_loader.of_data in - let () = match images with - | _ , None -> assert_string "llvm loader failed" - | None, _ -> skip_if true "elf loader failed" - | _ -> () in - Option.value_exn img1_opt, Option.value_exn img2_opt in - - assert_equal ~ctxt ~printer:Arch.to_string - ~msg:"loaders gives different arch" - (Img.arch img1) - (Img.arch img2); - - assert_equal ~ctxt ~printer:Addr.to_string - ~msg:"loaders gives different entry point" - (Img.entry img1) - (Img.entry img2); - - assert_equal ~ctxt ~printer:(fun e -> - List.sexp_of_t Segment.sexp_of_t e |> Sexp.to_string) - ~msg:"loaders gives different segments" - (Img.segments img1 |> (fun (e, ee) -> e::ee)) - (Img.segments img2 |> (fun (e, ee) -> e::ee)); - - assert_equal ~ctxt ~printer:(fun e -> - List.sexp_of_t Section.sexp_of_t e |> Sexp.to_string) - ~msg:"loaders gives different sections" - (Img.sections img1) - (Img.sections img2); - - let sym1, sym2 = - let symbols img = - Img.symbols img |> - SS.of_list in - symbols img1, symbols img2 in - - if not (SS.subset sym1 sym2) then - let string_of_set s = - SS.fold ~init:[] - ~f:(fun acc s -> (Symbol.sexp_of_t s |> Sexp.to_string)::acc) s |> - String.concat ~sep:"\n" in - let diff12 = - SS.diff sym1 sym2 |> - string_of_set in - let diff21 = - SS.diff sym2 sym1 |> - string_of_set in - - String.concat ~sep:"\n" - [file; - "llvm loader losted symbols:"; diff12; - "llvm loader surplused symbols:"; diff21] |> - assert_string - -let suite = "Image" >::: [ - "llvm_loader" >::run_test; - ] diff --git a/lib_test/bap_image/test_llvm_loader.mli b/lib_test/bap_image/test_llvm_loader.mli deleted file mode 100644 index caa5fd862..000000000 --- a/lib_test/bap_image/test_llvm_loader.mli +++ /dev/null @@ -1 +0,0 @@ -val suite : OUnit2.test diff --git a/lib_test/bap_project/dune b/lib_test/bap_project/dune new file mode 100644 index 000000000..cb93c5909 --- /dev/null +++ b/lib_test/bap_project/dune @@ -0,0 +1,5 @@ +(library + (name test_project) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel ounit2)) diff --git a/lib_test/bap_sema/dune b/lib_test/bap_sema/dune new file mode 100644 index 000000000..5e36ad13b --- /dev/null +++ b/lib_test/bap_sema/dune @@ -0,0 +1,5 @@ +(library + (name test_sema) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel ounit2)) diff --git a/lib_test/bap_types/dune b/lib_test/bap_types/dune new file mode 100644 index 000000000..be0a913da --- /dev/null +++ b/lib_test/bap_types/dune @@ -0,0 +1,5 @@ +(library + (name test_types) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries bap core_kernel ounit2)) diff --git a/lib_test/powerpc/.merlin b/lib_test/powerpc/.merlin deleted file mode 100644 index 68616e3b5..000000000 --- a/lib_test/powerpc/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -S . -B ../../_build/lib_test/powerpc -REC diff --git a/lib_test/powerpc/dune b/lib_test/powerpc/dune new file mode 100644 index 000000000..3300ae484 --- /dev/null +++ b/lib_test/powerpc/dune @@ -0,0 +1,4 @@ +(test + (name run_powerpc_tests) + (package bap) + (libraries bap bap-plugins ounit2 threads)) diff --git a/lib_test/stub_resolver/dune b/lib_test/stub_resolver/dune new file mode 100644 index 000000000..6e80245ce --- /dev/null +++ b/lib_test/stub_resolver/dune @@ -0,0 +1,4 @@ +(test + (name run_stub_resolver_tests) + (package bap-stub-resolver) + (libraries bap bap-main bap-core-theory bap-stub-resolver.plugin ounit2 threads)) diff --git a/plugins/stub_resolver/run_stub_resolver_tests.ml b/lib_test/stub_resolver/run_stub_resolver_tests.ml similarity index 100% rename from plugins/stub_resolver/run_stub_resolver_tests.ml rename to lib_test/stub_resolver/run_stub_resolver_tests.ml diff --git a/plugins/stub_resolver/stub_resolver_tests.ml b/lib_test/stub_resolver/stub_resolver_tests.ml similarity index 77% rename from plugins/stub_resolver/stub_resolver_tests.ml rename to lib_test/stub_resolver/stub_resolver_tests.ml index 85357f065..bf2eeb3cd 100644 --- a/plugins/stub_resolver/stub_resolver_tests.ml +++ b/lib_test/stub_resolver/stub_resolver_tests.ml @@ -66,24 +66,40 @@ let collect_stubs syms = then Set.add stubs name else stubs) -let provide_stubs syms = +let tag_stubs syms prog = let stubs = collect_stubs syms in - KB.promise (Value.Tag.slot Sub.stub) @@ fun label -> - KB.collect Theory.Label.name label >>| function - | Some name when Set.mem stubs name -> Some () - | _ -> None - -let provide_aliases syms = - KB.promise Theory.Label.aliases @@ fun label -> - KB.collect Theory.Label.name label >>| function - | None -> Set.empty (module String) - | Some name -> - match Map.find syms name with - | None -> Set.empty (module String) - | Some {aliases} -> Set.of_list (module String) aliases + let make_addr sub = + Addr.of_int64 @@ Int63.to_int64 @@ KB.Object.id (Term.tid sub) in + Term.map sub_t prog ~f:(fun sub -> + if Set.mem stubs (Sub.name sub) + then Term.set_attr sub Sub.stub () + else + let addressed = Term.set_attr sub address (make_addr sub) in + Term.set_attr addressed filename "test") + + let cfg_of_block b = Cfg.Node.insert b Cfg.empty +let tid_for_name_exn prog name = + Term.to_sequence sub_t prog |> + Seq.find_map + ~f:(fun s -> + if String.equal (Sub.name s) name + then Some (Term.tid s) + else None) |> function + | None -> failwithf "no tid for name %s" name () + | Some s -> s + +let provide_aliases prog syms = + Toplevel.exec begin + Map.to_sequence syms |> + KB.Seq.iter ~f:(fun (name,{aliases}) -> + let tid = tid_for_name_exn prog name in + let aliases = Set.of_list (module String) aliases in + KB.provide Theory.Label.aliases tid aliases) + end + let create_program syms = let nop = "\x66\x90" in let step = Addr.of_int64 2L in @@ -93,22 +109,19 @@ let create_program syms = let symtab = add_symbol symtab name addr nop in loop symtab Addr.(addr + step) names in let symtab = loop Symtab.empty (Addr.zero 64) (Map.keys syms) in - let prog = Program.lift symtab in - provide_stubs syms; - provide_aliases syms; + let prog = Program.lift symtab |> tag_stubs syms in + provide_aliases prog syms; prog -let tid_for_name_exn prog name = - Term.to_sequence sub_t prog |> - Seq.find_map - ~f:(fun s -> - if String.equal (Sub.name s) name - then Some (Term.tid s) - else None) |> function - | None -> failwithf "no tid for name %s" name () - | Some s -> s -let run name symbols expected should_fail _ctxt = +let string_of_tids tids = + let content = + Map.to_alist tids |> + List.map ~f:(fun (src,dst) -> + Format.asprintf "%s -> %s" (Tid.name src) (Tid.name dst)) in + Format.asprintf "(%s)" (String.concat ~sep:", " content) + +let run ?(skip=false) name symbols expected should_fail _ctxt = let syms = List.fold symbols ~init:(Map.empty (module String)) ~f:(fun syms (name,data) -> @@ -122,14 +135,21 @@ let run name symbols expected should_fail _ctxt = (tid_for_name_exn prog stub) (tid_for_name_exn prog impl)) in let pairs = Stub_resolver.(links@@run prog) in - let equal = Map.equal Tid.equal expected pairs in - assert_bool name (equal || should_fail) + let equal = Map.equal Tid.equal in + let equal = if should_fail then fun x y -> not (equal x y) else equal in + let msg = "the mappings shall " ^ + if should_fail then "differ" else "be the same" in + OUnit.skip_if skip "To be fixed"; + assert_equal expected pairs + ~cmp:equal + ~msg + ~printer:string_of_tids let real name aliases = name, {is_stub = false; aliases} let stub name aliases = name, {is_stub = true; aliases} -let test name ?(should_fail=false) ~expected symbols = - name >:: run name symbols expected should_fail +let test name ?skip ?(should_fail=false) ~expected symbols = + name >:: run ?skip name symbols expected should_fail let suite = "stub-resolver" >::: [ @@ -241,5 +261,4 @@ let suite = "stub-resolver" >::: [ "p4", "p5"; "p6", "p5"; ]; - ] diff --git a/lib_test/x86/.merlin b/lib_test/x86/.merlin deleted file mode 100644 index 4022e6100..000000000 --- a/lib_test/x86/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG bap-x86-cpu diff --git a/lib_test/x86/dune b/lib_test/x86/dune new file mode 100644 index 000000000..d74dcc3d7 --- /dev/null +++ b/lib_test/x86/dune @@ -0,0 +1,4 @@ +(test + (name run_x86_tests) + (package bap) + (libraries bap bap-x86 bap-plugins ounit2 threads)) diff --git a/monads.opam b/monads.opam new file mode 100644 index 000000000..8e3c1e227 --- /dev/null +++ b/monads.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Monads and Monad Transfomers" +description: "Provides monad transformers for common monads." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "monad"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "bap-common" {= version} + "core_kernel" {>= "v0.14" & < "v0.16"} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/oasis/api b/oasis/api index 9ceb976b9..631339d77 100644 --- a/oasis/api +++ b/oasis/api @@ -17,7 +17,7 @@ Library api_plugin FindlibName: bap-plugin-api CompiledObject: best BuildDepends: bap, bap-main, bap-api, fileutils, core_kernel, ppx_bap, regular - InternalModules: Api_main + InternalModules: Api_main, Api_sites XMETADescription: add parameters to subroutines based on known API DataFiles: api/c/*.h ($datadir/bap/api/c) XMETAExtraLines: tags="api, pass" diff --git a/oasis/api.files.ab.in b/oasis/api.files.ab.in new file mode 100644 index 000000000..2fc6a9299 --- /dev/null +++ b/oasis/api.files.ab.in @@ -0,0 +1 @@ + , plugins/api/api_sites.ml.ab \ No newline at end of file diff --git a/oasis/api.setup.ml.in b/oasis/api.setup.ml.in new file mode 100644 index 000000000..5f8564a8c --- /dev/null +++ b/oasis/api.setup.ml.in @@ -0,0 +1,6 @@ +let () = + add_variable ~doc:"additional sites for api files" + "site_api" + ~define:(function + | None -> "" + | Some xs -> xs) diff --git a/oasis/bap-std b/oasis/bap-std index 4dc6bdbd0..7834637b1 100644 --- a/oasis/bap-std +++ b/oasis/bap-std @@ -79,7 +79,7 @@ Library types Bap_biri, Bap_biri_types, Bap_bitvector, - Bap_common, + Bap_common_types, Bap_context, Bap_core_theory_bil_parser, Bap_eval, diff --git a/oasis/plugins b/oasis/plugins index d7c028234..3a904d0d5 100644 --- a/oasis/plugins +++ b/oasis/plugins @@ -9,6 +9,7 @@ Library bap_plugins Modules: Bap_plugins InternalModules: Bap_plugins_config, Bap_plugins_units, - Bap_plugins_units_intf + Bap_plugins_units_intf, + Bap_common BuildDepends: core_kernel, dynlink, fileutils, findlib, bap-bundle, bap-future, uri, ppx_bap diff --git a/oasis/plugins.files.ab.in b/oasis/plugins.files.ab.in index d9705fd8a..0a6de5fe0 100644 --- a/oasis/plugins.files.ab.in +++ b/oasis/plugins.files.ab.in @@ -1 +1,2 @@ , lib/bap_plugins/bap_plugins_config.ml.ab + , lib/bap_plugins/bap_common.ml.ab diff --git a/oasis/primus-lisp b/oasis/primus-lisp index da29616df..9caa9d9a0 100644 --- a/oasis/primus-lisp +++ b/oasis/primus-lisp @@ -17,7 +17,8 @@ Library primus_lisp_library_plugin Primus_lisp_io, Primus_lisp_show, Primus_lisp_run, - Primus_lisp_documentation + Primus_lisp_documentation, + Primus_lisp_config XMETADescription: install and load Primus lisp libraries DataFiles: lisp/*.lisp ($datadir/bap/primus/lisp), site-lisp/*.lisp ($datadir/bap/primus/site-lisp), diff --git a/oasis/primus-lisp.files.ab.in b/oasis/primus-lisp.files.ab.in new file mode 100644 index 000000000..2576089c6 --- /dev/null +++ b/oasis/primus-lisp.files.ab.in @@ -0,0 +1 @@ + , plugins/primus_lisp/primus_lisp_config.ml.ab \ No newline at end of file diff --git a/oasis/primus-lisp.setup.ml.in b/oasis/primus-lisp.setup.ml.in new file mode 100644 index 000000000..5c72903c6 --- /dev/null +++ b/oasis/primus-lisp.setup.ml.in @@ -0,0 +1,16 @@ +let () = + add_variable ~doc:"additional sites for lisp files" + "site_lisp" + ~define:(function + | None -> "" + | Some xs -> xs); + add_variable ~doc:"additional sites for site-lisp files" + "site_site_lisp" + ~define:(function + | None -> "" + | Some xs -> xs); + add_variable ~doc:"additional sites for semantics files" + "site_semantics" + ~define:(function + | None -> "" + | Some xs -> xs) diff --git a/oasis/stub-resolver b/oasis/stub-resolver index 3564cfa20..d095440e5 100644 --- a/oasis/stub-resolver +++ b/oasis/stub-resolver @@ -11,7 +11,7 @@ Library bap-plugin-stub_resolver FindlibName: bap-plugin-stub_resolver CompiledObject: best Modules: Stub_resolver - InternalModules: Stub_resolver_main + InternalModules: Stub_resolver_main, Stub_resolver_sites XMETADescription: Substitutes calls to stubs with calls to real functions XMETAExtraLines: tags="abi" DataFiles: signatures/*.stubs ($datadir/bap/signatures) diff --git a/oasis/stub-resolver.files.ab.in b/oasis/stub-resolver.files.ab.in new file mode 100644 index 000000000..841a824cb --- /dev/null +++ b/oasis/stub-resolver.files.ab.in @@ -0,0 +1 @@ + , plugins/stub_resolver/stub_resolver_sites.ml.ab \ No newline at end of file diff --git a/oasis/stub-resolver.setup.ml.in b/oasis/stub-resolver.setup.ml.in new file mode 100644 index 000000000..f6eb4e3ee --- /dev/null +++ b/oasis/stub-resolver.setup.ml.in @@ -0,0 +1,6 @@ +let () = + add_variable ~doc:"additional sites for signatures" + "site_signatures" + ~define:(function + | None -> "" + | Some xs -> xs) diff --git a/ogre.opam b/ogre.opam new file mode 100644 index 000000000..2153250da --- /dev/null +++ b/ogre.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Pure OCaml Open Generic REpresentation NoSQL Database" +description: + "OGRE is a NoSQL document-style database that uses sexp for data representation and provides a type safe monadic interface for quering and updating documents" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "sexp"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "monads" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/opam/opam b/opam/opam deleted file mode 100644 index 711a5adba..000000000 --- a/opam/opam +++ /dev/null @@ -1,331 +0,0 @@ -opam-version: "2.0" -name: "bap" -version: "master" -maintainer: "Ivan Gotovchits " -authors: "BAP Team" -license: "MIT" -homepage: "https://github.com/BinaryAnalysisPlatform/bap/" -bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" -depends: [ - "ocaml" {>= "4.07.0"} - "base-unix" - "ppx_bitstring" {>= "4.0.0"} - "camlzip" - "linenoise" {>= "1.1" & < "2.0"} - "cmdliner" {>= "1.0" & < "2.0"} - "ppx_bap" - "core_kernel" {>= "v0.14" & < "v0.16"} - "ezjsonm" - "fileutils" - "FrontC" {>= "4.1" & < "4.2"} - "oasis" {build & >= "0.4.10"} - "ounit" {build} - "ocamlgraph" {>= "1.8.6"} - "ocamlfind" {>= "1.5.6" & < "2.0"} - "ocurl" {>= "0.7.7"} - "re" - "uri" {>= "1.9.0"} - "utop" - "zarith" - "uuidm" - "piqi" {>= "0.7.4"} - "conf-bap-llvm" {>= "1.1"} - "parsexp" - "bap-signatures" - "z3" - "conf-radare2" - "yojson" - "result" - "mmap" -] -depopts: [ - "conf-ida" - "conf-binutils" {= "0.3"} -] -flags: light-uninstall -build: [ - [ - "./configure" - "--prefix=%{prefix}%" - "--with-cxx=`which clang++`" - "--with-llvm-version=%{conf-bap-llvm:package-version}%" - {conf-bap-llvm:installed} - "--with-llvm-config=%{conf-bap-llvm:config}%" {conf-bap-llvm:installed} - "--mandir=%{man}%" - "--enable-everything" - "--disable-ghidra" - "--enable-tests" {with-test} - "--%{conf-ida:enable}%-ida" - "--ida-path=%{conf-ida:path}%" {conf-ida:installed} - "--ida-headless=%{conf-ida:headless}%" {conf-ida:installed} - "--%{conf-binutils:enable}%-objdump" - "--objdump-paths=%{conf-binutils:objdumps}%" {conf-binutils:installed} - ] - [make] -] -install: [ - ["ocamlfind" "remove" "bap-main"] - ["ocamlfind" "remove" "bap-plugins"] - ["ocamlfind" "remove" "bap-bundle"] - ["ocamlfind" "remove" "bap-plugin-disassemble"] - ["ocamlfind" "remove" "bap-plugin-mc"] - ["ocamlfind" "remove" "bap-recipe"] - ["ocamlfind" "remove" "bap-plugin-recipe_command"] - ["ocamlfind" "remove" "bap"] - ["ocamlfind" "remove" "bap-arm"] - ["ocamlfind" "remove" "bap-beagle-prey"] - ["ocamlfind" "remove" "bap-build"] - ["ocamlfind" "remove" "bap-byteweight"] - ["ocamlfind" "remove" "bap-demangle"] - ["ocamlfind" "remove" "bap-dwarf"] - ["ocamlfind" "remove" "bap-elf"] - ["ocamlfind" "remove" "bap-future"] - ["ocamlfind" "remove" "bap-ida"] - ["ocamlfind" "remove" "bap-piqi"] - ["ocamlfind" "remove" "bap-primus"] - ["ocamlfind" "remove" "bap-plugin-arm"] - ["ocamlfind" "remove" "bap-plugin-api"] - ["ocamlfind" "remove" "bap-plugin-ssa"] - ["ocamlfind" "remove" "bap-plugin-optimization"] - ["ocamlfind" "remove" "bap-plugin-beagle"] - ["ocamlfind" "remove" "bap-plugin-bil"] - ["ocamlfind" "remove" "bap-plugin-byteweight"] - ["ocamlfind" "remove" "bap-plugin-cache"] - ["ocamlfind" "remove" "bap-plugin-dump_symbols"] - ["ocamlfind" "remove" "bap-plugin-elf_loader"] - ["ocamlfind" "remove" "bap-plugin-relocatable"] - ["ocamlfind" "remove" "bap-plugin-emit_ida_script"] - ["ocamlfind" "remove" "bap-plugin-ida"] - ["ocamlfind" "remove" "bap-plugin-glibc_runtime"] - ["ocamlfind" "remove" "bap-plugin-radare2"] - ["ocamlfind" "remove" "bap-plugin-objdump"] - ["ocamlfind" "remove" "bap-plugin-llvm"] - ["ocamlfind" "remove" "bap-plugin-legacy_llvm"] - ["ocamlfind" "remove" "bap-plugin-mips"] - ["ocamlfind" "remove" "bap-plugin-phoenix"] - ["ocamlfind" "remove" "bap-plugin-piqi_printers"] - ["ocamlfind" "remove" "bap-plugin-powerpc"] - ["ocamlfind" "remove" "bap-plugin-primus_x86"] - ["ocamlfind" "remove" "bap-plugin-primus_loader"] - ["ocamlfind" "remove" "bap-plugin-primus_lisp"] - ["ocamlfind" "remove" "bap-plugin-primus_mark_visited"] - ["ocamlfind" "remove" "bap-plugin-primus_limit"] - ["ocamlfind" "remove" "bap-plugin-primus_print"] - ["ocamlfind" "remove" "bap-plugin-primus_region"] - ["ocamlfind" "remove" "bap-plugin-primus_random"] - ["ocamlfind" "remove" "bap-plugin-primus_systems"] - ["ocamlfind" "remove" "bap-plugin-primus_taint"] - ["ocamlfind" "remove" "bap-plugin-primus_test"] - ["ocamlfind" "remove" "bap-plugin-constant_tracker"] - ["ocamlfind" "remove" "bap-plugin-primus_dictionary"] - ["ocamlfind" "remove" "bap-plugin-primus_greedy"] - ["ocamlfind" "remove" "bap-plugin-primus_exploring"] - ["ocamlfind" "remove" "bap-plugin-primus_promiscuous"] - ["ocamlfind" "remove" "bap-plugin-primus_propagate_taint"] - ["ocamlfind" "remove" "bap-plugin-primus_round_robin"] - ["ocamlfind" "remove" "bap-plugin-trivial_condition_form"] - ["ocamlfind" "remove" "bap-plugin-primus_wandering"] - ["ocamlfind" "remove" "bap-plugin-print"] - ["ocamlfind" "remove" "bap-plugin-report"] - ["ocamlfind" "remove" "bap-plugin-read_symbols"] - ["ocamlfind" "remove" "bap-plugin-stub_resolver"] - ["ocamlfind" "remove" "bap-plugin-x86"] - ["ocamlfind" "remove" "bap-traces"] - ["ocamlfind" "remove" "bap-taint"] - ["ocamlfind" "remove" "bap-plugin-trace"] - ["ocamlfind" "remove" "bap-x86-cpu"] - ["ocamlfind" "remove" "graphlib"] - ["ocamlfind" "remove" "regular"] - ["ocamlfind" "remove" "text-tags"] - ["ocamlfind" "remove" "bap-plugin-propagate_taint"] - ["ocamlfind" "remove" "bap-plugin-taint"] - ["ocamlfind" "remove" "bap-microx"] - ["ocamlfind" "remove" "bap-plugin-callsites"] - ["ocamlfind" "remove" "bap-plugin-warn_unused"] - ["ocamlfind" "remove" "bap-plugin-map_terms"] - ["ocamlfind" "remove" "bap-plugin-demangle"] - ["ocamlfind" "remove" "bap-plugin-frontc_parser"] - ["ocamlfind" "remove" "bap-plugin-cxxfilt"] - ["ocamlfind" "remove" "bap-plugin-abi"] - ["ocamlfind" "remove" "bap-c"] - ["ocamlfind" "remove" "bap-abi"] - ["ocamlfind" "remove" "bap-api"] - ["ocamlfind" "remove" "bap-bml"] - ["ocamlfind" "remove" "bap-llvm"] - ["ocamlfind" "remove" "bap-plugin-run"] - ["ocamlfind" "remove" "bap-plugin-strings"] - ["ocamlfind" "remove" "bap-strings"] - ["ocamlfind" "remove" "monads"] - ["ocamlfind" "remove" "ogre"] - ["ocamlfind" "remove" "bap-knowledge"] - ["ocamlfind" "remove" "bitvec"] - ["ocamlfind" "remove" "bitvec-order"] - ["ocamlfind" "remove" "bitvec-sexp"] - ["ocamlfind" "remove" "bitvec-binprot"] - ["ocamlfind" "remove" "bap-core-theory"] - ["ocamlfind" "remove" "bap-elementary"] - ["ocamlfind" "remove" "bap-lisp"] - ["ocamlfind" "remove" "bap-primus-machine"] - [make "reinstall"] - ["cp" "run_tests.native" "%{bin}%/bap_run_tests"] {with-test} - ["cp" "run_future_tests.native" "%{bin}%/bap_future_tests"] {with-test} - ["cp" "run_x86_tests.native" "%{bin}%/bap_x86_tests"] {with-test} - ["cp" "run_powerpc_tests.native" "%{bin}%/bap_powerpc_tests"] {with-test} - ["cp" "run_piqi_tests.native" "%{bin}%/bap_piqi_tests"] {with-test} - ["cp" "run_traces_tests.native" "%{bin}%/bap_traces_tests"] {with-test} - ["cp" "run_stub_resolver_tests.native" "%{bin}%/bap_stub_resolver_tests"] {with-test} -] -remove: [ - ["ocamlfind" "remove" "bap-main"] - ["ocamlfind" "remove" "bap-plugins"] - ["ocamlfind" "remove" "bap-bundle"] - ["ocamlfind" "remove" "bap-plugin-disassemble"] - ["ocamlfind" "remove" "bap-plugin-mc"] - ["ocamlfind" "remove" "bap-recipe"] - ["ocamlfind" "remove" "bap-plugin-recipe_command"] - ["ocamlfind" "remove" "bap"] - ["ocamlfind" "remove" "bap-arm"] - ["ocamlfind" "remove" "bap-beagle-prey"] - ["ocamlfind" "remove" "bap-build"] - ["ocamlfind" "remove" "bap-byteweight"] - ["ocamlfind" "remove" "bap-demangle"] - ["ocamlfind" "remove" "bap-dwarf"] - ["ocamlfind" "remove" "bap-elf"] - ["ocamlfind" "remove" "bap-future"] - ["ocamlfind" "remove" "bap-ida"] - ["ocamlfind" "remove" "bap-piqi"] - ["ocamlfind" "remove" "bap-primus"] - ["ocamlfind" "remove" "bap-plugin-arm"] - ["ocamlfind" "remove" "bap-plugin-api"] - ["ocamlfind" "remove" "bap-plugin-ssa"] - ["ocamlfind" "remove" "bap-plugin-optimization"] - ["ocamlfind" "remove" "bap-plugin-beagle"] - ["ocamlfind" "remove" "bap-plugin-bil"] - ["ocamlfind" "remove" "bap-plugin-byteweight"] - ["ocamlfind" "remove" "bap-plugin-cache"] - ["ocamlfind" "remove" "bap-plugin-dump_symbols"] - ["ocamlfind" "remove" "bap-plugin-elf_loader"] - ["ocamlfind" "remove" "bap-plugin-relocatable"] - ["ocamlfind" "remove" "bap-plugin-emit_ida_script"] - ["ocamlfind" "remove" "bap-plugin-ida"] - ["ocamlfind" "remove" "bap-plugin-glibc_runtime"] - ["ocamlfind" "remove" "bap-plugin-radare2"] - ["ocamlfind" "remove" "bap-plugin-objdump"] - ["ocamlfind" "remove" "bap-plugin-llvm"] - ["ocamlfind" "remove" "bap-plugin-legacy_llvm"] - ["ocamlfind" "remove" "bap-plugin-mips"] - ["ocamlfind" "remove" "bap-plugin-phoenix"] - ["ocamlfind" "remove" "bap-plugin-piqi_printers"] - ["ocamlfind" "remove" "bap-plugin-powerpc"] - ["ocamlfind" "remove" "bap-plugin-primus_powerpc"] - ["ocamlfind" "remove" "bap-plugin-primus_x86"] - ["ocamlfind" "remove" "bap-plugin-primus_loader"] - ["ocamlfind" "remove" "bap-plugin-primus_lisp"] - ["ocamlfind" "remove" "bap-plugin-primus_mark_visited"] - ["ocamlfind" "remove" "bap-plugin-primus_limit"] - ["ocamlfind" "remove" "bap-plugin-primus_print"] - ["ocamlfind" "remove" "bap-plugin-primus_region"] - ["ocamlfind" "remove" "bap-plugin-primus_random"] - ["ocamlfind" "remove" "bap-plugin-primus_systems"] - ["ocamlfind" "remove" "bap-plugin-primus_taint"] - ["ocamlfind" "remove" "bap-plugin-primus_test"] - ["ocamlfind" "remove" "bap-plugin-constant_tracker"] - ["ocamlfind" "remove" "bap-plugin-primus_dictionary"] - ["ocamlfind" "remove" "bap-plugin-primus_greedy"] - ["ocamlfind" "remove" "bap-plugin-primus_exploring"] - ["ocamlfind" "remove" "bap-plugin-primus_promiscuous"] - ["ocamlfind" "remove" "bap-plugin-primus_propagate_taint"] - ["ocamlfind" "remove" "bap-plugin-primus_round_robin"] - ["ocamlfind" "remove" "bap-plugin-trivial_condition_form"] - ["ocamlfind" "remove" "bap-plugin-primus_wandering"] - ["ocamlfind" "remove" "bap-plugin-print"] - ["ocamlfind" "remove" "bap-plugin-raw"] - ["ocamlfind" "remove" "bap-plugin-report"] - ["ocamlfind" "remove" "bap-plugin-read_symbols"] - ["ocamlfind" "remove" "bap-plugin-stub_resolver"] - ["ocamlfind" "remove" "bap-plugin-x86"] - ["ocamlfind" "remove" "bap-traces"] - ["ocamlfind" "remove" "bap-taint"] - ["ocamlfind" "remove" "bap-plugin-trace"] - ["ocamlfind" "remove" "bap-x86-cpu"] - ["ocamlfind" "remove" "graphlib"] - ["ocamlfind" "remove" "regular"] - ["ocamlfind" "remove" "text-tags"] - ["ocamlfind" "remove" "bap-plugin-propagate_taint"] - ["ocamlfind" "remove" "bap-plugin-taint"] - ["ocamlfind" "remove" "bap-microx"] - ["ocamlfind" "remove" "bap-plugin-callsites"] - ["ocamlfind" "remove" "bap-plugin-warn_unused"] - ["ocamlfind" "remove" "bap-plugin-map_terms"] - ["ocamlfind" "remove" "bap-plugin-demangle"] - ["ocamlfind" "remove" "bap-plugin-frontc_parser"] - ["ocamlfind" "remove" "bap-plugin-cxxfilt"] - ["ocamlfind" "remove" "bap-plugin-abi"] - ["ocamlfind" "remove" "bap-c"] - ["ocamlfind" "remove" "bap-abi"] - ["ocamlfind" "remove" "bap-api"] - ["ocamlfind" "remove" "bap-bml"] - ["ocamlfind" "remove" "bap-llvm"] - ["ocamlfind" "remove" "bap-plugin-run"] - ["ocamlfind" "remove" "bap-plugin-strings"] - ["ocamlfind" "remove" "bap-strings"] - ["ocamlfind" "remove" "monads"] - ["ocamlfind" "remove" "ogre"] - ["ocamlfind" "remove" "bare"] - ["ocamlfind" "remove" "bap-knowledge"] - ["ocamlfind" "remove" "bitvec"] - ["ocamlfind" "remove" "bitvec-order"] - ["ocamlfind" "remove" "bitvec-sexp"] - ["ocamlfind" "remove" "bitvec-binprot"] - ["ocamlfind" "remove" "bap-core-theory"] - ["ocamlfind" "remove" "bap-elementary"] - ["ocamlfind" "remove" "bap-lisp"] - ["ocamlfind" "remove" "bap-primus-machine"] - ["rm" "-f" "%{prefix}%/bin/baptop"] - ["rm" "-rf" "%{prefix}%/share/bap"] - ["rm" "-f" "%{man}%/man1/bap-mc.1"] - ["rm" "-f" "%{man}%/man1/bap.1"] - ["rm" "-f" "%{man}%/man1/bap-byteweight.1"] - ["rm" "-f" "%{bin}%/bap-mc"] - ["rm" "-f" "%{bin}%/bap"] - ["rm" "-f" "%{bin}%/bap-byteweight"] - ["rm" "-f" "%{bin}%/bapbuild"] - ["rm" "-f" "%{bin}%/baptop"] - ["rm" "-f" "%{bin}%/bap_run_tests"] - ["rm" "-f" "%{bin}%/bap_future_tests"] - ["rm" "-f" "%{bin}%/bap_x86_tests"] - ["rm" "-f" "%{bin}%/bap_powerpc_tests"] - ["rm" "-f" "%{bin}%/bap_piqi_tests"] - ["rm" "-f" "%{bin}%/bap_traces_tests"] - ["rm" "-f" "%{bin}%/bap_stub_resolver_tests"] - -] -depexts: [ - [ - "libgmp-dev" - "libzip-dev" - "libcurl4-gnutls-dev" - "time" - "clang" - "m4" - "dejagnu" - ] {os-distribution = "ubuntu"} - [ - "clang" - "curl" - "dejagnu" - "gmp" - "libzip" - "llvm-libs" - "m4" - "time" - ] {os-distribution = "archlinux"} - ["gmp" "llvm-9" "graphviz" "curl" "libzip"] - {os = "macos" & os-distribution = "macports"} - ["gmp" "llvm@9" "graphviz" "curl" "libzip" "dejagnu"] - {os = "macos" & os-distribution = "homebrew"} -] -dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap/" - -synopsis: "Binary Analysis Platform" -description: "Binary Analysis Platform" diff --git a/plugins/.merlin b/plugins/.merlin deleted file mode 100644 index a30d9fd73..000000000 --- a/plugins/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG cmdliner \ No newline at end of file diff --git a/plugins/abi/abi_main.ml b/plugins/abi/abi_main.ml index 944212be4..24c767401 100644 --- a/plugins/abi/abi_main.ml +++ b/plugins/abi/abi_main.ml @@ -1,16 +1,20 @@ -open Core_kernel[@@warning "-D"] +let provides = ["abi"; "pass"] +let doc = {| +# DESCRIPTION + +Runs ABI-specific passes. The passes are registered using +Bap_abi.register_pass function, by target-specific plugins, +depending on the binary architecture and command line options, +provided by a user. + +# SEE ALSO + +$(b,bap-plugin-x86)(1), $(b,bap-plugin-arm)(1), $(b,bap-abi)(3) +|} open Bap.Std -include Self() +open Bap_main -let () = Config.manpage [ - `S "DESCRIPTION"; - `P "Run ABI specific passes. The passes are registered using - Bap_abi.register_pass function, by target specific plugins, - depending on the binary architecture and command line options, - provided by a user."; - `S "SEE ALSO"; - `P "$(b,bap-plugin-x86)(1), $(b,bap-plugin-arm)(1), $(b,bap-abi)(3)" - ] -let () = Config.when_ready (fun _ -> - Project.register_pass ~autorun:true Bap_abi.pass) +let () = Extension.declare ~provides ~doc (fun _ -> + Project.register_pass ~autorun:true Bap_abi.pass; + Ok ()) diff --git a/plugins/abi/dune b/plugins/abi/dune new file mode 100644 index 000000000..b8b52e5d3 --- /dev/null +++ b/plugins/abi/dune @@ -0,0 +1,11 @@ +(library + (name abi) + (public_name bap-abi.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-abi bap-main)) + +(plugin + (name abi) + (package bap-abi) + (libraries bap-abi.plugin) + (site (bap-common plugins))) diff --git a/plugins/analyze/analyze_main.ml b/plugins/analyze/analyze_main.ml index da51a6d8b..2361f0385 100644 --- a/plugins/analyze/analyze_main.ml +++ b/plugins/analyze/analyze_main.ml @@ -356,3 +356,5 @@ let () = let () = Extension.Error.register_printer @@ function | Fail problem -> Some (string_of_problem problem) | _ -> None + +let () = Extension.declare ~doc @@ fun _ -> Ok () diff --git a/plugins/analyze/dune b/plugins/analyze/dune new file mode 100644 index 000000000..ff0a9447c --- /dev/null +++ b/plugins/analyze/dune @@ -0,0 +1,19 @@ +(library + (name bap_analyze) + (public_name bap-analyze.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + bitvec + core_kernel + linenoise + monads)) + +(plugin + (name analyze) + (package bap-analyze) + (libraries bap-analyze.plugin) + (site (bap-common plugins))) diff --git a/plugins/api/.merlin b/plugins/api/.merlin deleted file mode 100644 index 6b5d2024a..000000000 --- a/plugins/api/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -REC -PKG cmdliner - -B ../../_build/lib/bap_api -B ../../_build/plugins/api -S. - -FLG -short-paths \ No newline at end of file diff --git a/plugins/api/api/c/dune b/plugins/api/api/c/dune new file mode 100644 index 000000000..2a43aefbf --- /dev/null +++ b/plugins/api/api/c/dune @@ -0,0 +1,8 @@ +(install + (files + (android.h as c/android.h) + (posix.h as c/posix.h) + (windows.h as c/windows.h) + (gnu.h as c/gnu.h)) + (package bap-api) + (section (site (bap-common api)))) diff --git a/plugins/api/api_main.ml b/plugins/api/api_main.ml index f9b5ac099..c8dfec761 100644 --- a/plugins/api/api_main.ml +++ b/plugins/api/api_main.ml @@ -5,6 +5,7 @@ module Sys = Caml.Sys include Self() module Configuration = Bap_main.Extension.Configuration +module Sites = Api_sites let try_with f = match Result.try_with f with | Ok r -> Ok r @@ -235,6 +236,7 @@ let paths = List.map ~f:Api_path.of_string let all_paths o = List.rev@@List.concat [ paths@@Api_options.api_paths o; + paths Sites.paths; env_paths; paths@@Configuration.[ Filename.concat datadir "api"; @@ -288,17 +290,6 @@ let show_all_apis paths = List.iter ~f:print_lang (List.group ~break:(fun x y -> String.(x.desc.lang <> y.desc.lang)) apis); printf "Total number of available API: %d\n" (List.length apis) -let sanity_check paths = - let is_same api api' = - equal_api_descr api.desc api'.desc && - Path.compare api.path api'.path <> 0 in - let check_for_pair api apis = - match List.find ~f:(is_same api) apis with - | None -> () - | Some api' -> Api_error.sanity_fail api api' in - let all = api_of_paths paths in - List.iter ~f:(fun api -> check_for_pair api all) all - module Cmdline = struct let man = [ `S "DESCRIPTION"; @@ -389,7 +380,6 @@ module Cmdline = struct let dispatch o = let open Api_options in let paths = all_paths o in - sanity_check paths; dispatch_api_ops o; dispatch_flags o; Project.register_pass ~autorun:true ~deps:["abi"] (main paths) @@ -402,9 +392,11 @@ module Cmdline = struct let () = Config.manpage man; - Config.when_ready (fun {Config.get=(!)} -> - let paths = normalize_paths !path in - let o = create !add_api !remove_api - !list_paths !show_apis paths in - dispatch o) + Config.declare_extension ~doc:"inserts subroutines arg terms" + ~provides:["abi"; "api"; "pass"] @@ + fun {Config.get=(!)} -> + let paths = normalize_paths !path in + let o = create !add_api !remove_api + !list_paths !show_apis paths in + dispatch o end diff --git a/plugins/api/api_sites.ml.ab b/plugins/api/api_sites.ml.ab new file mode 100644 index 000000000..426dc2674 --- /dev/null +++ b/plugins/api/api_sites.ml.ab @@ -0,0 +1 @@ +let paths = [${site_api}] \ No newline at end of file diff --git a/plugins/api/dune b/plugins/api/dune new file mode 100644 index 000000000..1b0abd0c4 --- /dev/null +++ b/plugins/api/dune @@ -0,0 +1,26 @@ +(library + (name api) + (public_name bap-api.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-api + core_kernel + fileutils + regular)) + +(plugin + (name api) + (package bap-api) + (libraries bap-api.plugin) + (site (bap-common plugins))) + + +(rule + (target api_sites.ml) + (deps api_sites.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/arm/.merlin b/plugins/arm/.merlin deleted file mode 100644 index 52ff9457a..000000000 --- a/plugins/arm/.merlin +++ /dev/null @@ -1,18 +0,0 @@ -REC - -B ../../_build -B ../../_build/lib/bap_c -B ../../_build/lib/arm -B ../../_build/lib/bap_api -B ../../_build/lib/bap_abi - -B ../../lib/bap_c -B ../../lib/arm -B ../../lib/bap_api -B ../../lib/bap_abi -B ../../lib/bap_traces - -S ../../lib/bap_c -S ../../lib/arm -S ../../lib/bap_api -S ../../lib/bap_abi diff --git a/plugins/arm/dune b/plugins/arm/dune new file mode 100644 index 000000000..2f437b71d --- /dev/null +++ b/plugins/arm/dune @@ -0,0 +1,20 @@ +(library + (name bap_arm_plugin) + (public_name bap-arm.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-arm + bap-c + bap-core-theory + bap-main + core_kernel + monads)) + +(plugin + (name arm) + (package bap-arm) + (libraries bap-arm.plugin) + (site (bap-common plugins))) diff --git a/plugins/arm/semantics/dune b/plugins/arm/semantics/dune new file mode 100644 index 000000000..e58ac7224 --- /dev/null +++ b/plugins/arm/semantics/dune @@ -0,0 +1,17 @@ +(install + (package bap-primus-lisp) + (section (site (bap-common semantics))) + (files + aarch64-arithmetic.lisp + aarch64-atomic.lisp + aarch64-branch.lisp + aarch64-data-movement.lisp + aarch64-helper.lisp + aarch64.lisp + aarch64-logical.lisp + aarch64-pstate.lisp + aarch64-special.lisp + arm-bits.lisp + arm.lisp + thumb.lisp + thumb-patterns.lisp)) diff --git a/plugins/beagle/.merlin b/plugins/beagle/.merlin deleted file mode 100644 index ab4308432..000000000 --- a/plugins/beagle/.merlin +++ /dev/null @@ -1,6 +0,0 @@ -REC -B ../../_build/lib/microx -B ../../_build/lib/beagle -B ../../_build/lib/bap_primus -B ../../_build/lib/bap_strings -B ../../_build/plugins/beagle \ No newline at end of file diff --git a/plugins/beagle/beagle_main.ml b/plugins/beagle/beagle_main.ml index 78566ef53..5d38179dc 100644 --- a/plugins/beagle/beagle_main.ml +++ b/plugins/beagle/beagle_main.ml @@ -257,9 +257,12 @@ end let main _proj = Primus.Machine.add_component (module Hunter) [@warning "-D"] -let () = (Config.when_ready (fun _ -> - Primus.Components.register_generic "beagle-hunter" (module Hunter) - ~package:"bap" - ~desc:"Monitors execution and detects data that looks like \ - words from the provided dictionary."; - Project.register_pass' ~deps:["strings-collect"] main)) +let () = Config.declare_extension + ~doc:"microx-powered obfuscated string solver" + ~provides:["deobfuscator"; "microx"; "primus"; "pass"; "string"; "analysis"] + @@ fun _ -> + Primus.Components.register_generic "beagle-hunter" (module Hunter) + ~package:"bap" + ~desc:"Monitors execution and detects data that looks like \ + words from the provided dictionary."; + Project.register_pass' ~deps:["strings-collect"] main diff --git a/plugins/beagle/dune b/plugins/beagle/dune new file mode 100644 index 000000000..da3b4395a --- /dev/null +++ b/plugins/beagle/dune @@ -0,0 +1,20 @@ +(library + (name bap_beagle_plugin) + (public_name bap-beagle.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-beagle + bap-future + bap-microx + bap-primus + bap-strings + core_kernel + monads + regular)) + +(plugin + (name beagle) + (package bap-beagle) + (libraries bap-beagle.plugin) + (site (bap-common plugins))) diff --git a/plugins/bil/.merlin b/plugins/bil/.merlin deleted file mode 100644 index 28a83b472..000000000 --- a/plugins/bil/.merlin +++ /dev/null @@ -1,10 +0,0 @@ -REC -B ../../_build/plugins/bil -B ../../_build/lib/knowledge -B ../../_build/lib/bap_core_theory -FLG -open Bap_core_theory -PKG oUnit - -S . -B _build -FLG -short-paths \ No newline at end of file diff --git a/plugins/bil/bil_float_tests.ml b/plugins/bil/bil_float_tests.ml deleted file mode 100644 index 1779228c1..000000000 --- a/plugins/bil/bil_float_tests.ml +++ /dev/null @@ -1,480 +0,0 @@ -open Core_kernel[@@warning "-D"] -open OUnit2 -open Bap_plugins.Std -open Bap_primus.Std -open Bap.Std -open Monads.Std -open Bap_knowledge -open Bap_core_theory - -module G = Bil_float.Make(Theory.Manager) - -[@@@warning "-3"] - -let () = Plugins.run ~exclude:["bil"] () - -let () = Bil_semantics.init () - -let enum_bits w = - let bits = Word.(enum_bits w BigEndian) in - let b_len = Seq.length bits in - let w_len = Word.bitwidth w in - if b_len > w_len then - Seq.drop bits (b_len - w_len) - else bits - -let float_bits w = - let bits = enum_bits w in - let (@@) = sprintf "%s%d" in - Seq.fold bits ~init:"" ~f:(fun s x -> - if x then s @@ 1 - else s @@ 0) - -let float64_bits x = - let w = Word.of_int64 (Int64.bits_of_float x) in - let bits = enum_bits w in - let (@@) = sprintf "%s%d" in - Seq.foldi bits ~init:"" ~f:(fun i acc x -> - let a = - if i = 1 || i = 12 then "_" - else "" in - let s = sprintf "%s%s" acc a in - if x then s @@ 1 - else s @@ 0) - -let deconstruct x = - let wi = Word.to_int_exn in - let y = Int64.bits_of_float x in - let w = Word.of_int64 y in - let expn = Word.extract_exn ~hi:62 ~lo:52 w in - let bias = Word.of_int ~width:11 1023 in - let expn' = Word.(signed (expn - bias)) in - let frac = Word.extract_exn ~hi:51 w in - printf "ocaml %f: bits %s, 0x%LX\n" x (float64_bits x) y; - printf "ocaml %f: biased/unbiased expn %d/%d, coef 0x%x\n" - x (wi expn) (wi expn') (wi frac) - -type bits8 -type bits24 -type bits32 -type float32 = ((int,bits8,bits24) IEEE754.ieee754,bits32) format float sort - -type bits11 -type bits53 -type bits64 -type float64 = ((int,bits11,bits53) IEEE754.ieee754,bits64) format float sort - -type bits15 -type bits112 -type bits128 -type float128 = ((int,bits15,bits112) IEEE754.ieee754,bits128) format float sort - - -let exps_32 : bits8 bitv sort = Bits.define 8 -let sigs_32 : bits24 bitv sort = Bits.define 24 -let bitv_32 : bits32 bitv sort = Bits.define 32 -let fsort32 : float32 = IEEE754.(Sort.define binary32) - -let exps_64 : bits11 bitv sort = Bits.define 11 -let sigs_64 : bits53 bitv sort = Bits.define 53 -let bitv_64 : bits64 bitv sort = Bits.define 64 -let fsort64 : float64 = IEEE754.(Sort.define binary64) - -let exps_128 : bits15 bitv sort = Bits.define 15 -let sigs_128 : bits112 bitv sort = Bits.define 112 -let bitv_128 : bits128 bitv sort = Bits.define 128 -let fsort128 : float128 = IEEE754.(Sort.define binary128) - -type binop = [ - | `Add - | `Sub - | `Mul - | `Div -] [@@deriving sexp] - -type unop = [ - | `Sqrt - | `Rsqrt -] [@@deriving sexp] - -type cast_int = [ - | `Of_uint - | `Of_sint -] [@@deriving sexp] - -type cast_float = [ - | `Of_float -] [@@deriving sexp] - -type test = [ - binop | cast_int | cast_float -] [@@deriving sexp] - -let test_name op = Sexp.to_string (sexp_of_test (op :> test)) - - -module Machine = struct - type 'a m = 'a - include Primus.Machine.Make(Monad.Ident) -end -module Main = Primus.Machine.Main(Machine) -module Eval = Primus.Interpreter.Make(Machine) - -let proj = - let nil = Memmap.empty in - Project.Input.create `x86_64 "/bin/true" ~code:nil ~data:nil |> - Project.create |> - ok_exn - -let word_of_float x = Word.of_int64 (Int64.bits_of_float x) -let float_of_word x = Int64.float_of_bits (Word.to_int64_exn x) - -let exp x = - let open Knowledge.Syntax in - let x = x >>| Value.semantics in - match Knowledge.run x Knowledge.empty with - | Error _ -> assert false - | Ok (s,_) -> Semantics.get Bil.Domain.exp s - -let eval ?(name="") ~expected test _ctxt = - let open Machine.Syntax in - let float64_bits w = - let x = Word.signed w |> Word.to_int64_exn in - float64_bits (Int64.float_of_bits x) in - match exp test with - | None -> assert false - | Some e -> - let check = - Eval.exp e >>| fun r -> - let r = Primus.Value.to_word r in - let equal = Word.(r = expected) in - if not equal then - let () = printf "\nFAIL %s\n" name in - let () = printf "expected: %s\n" (float64_bits expected) in - printf "got : %s\n" (float64_bits r); - printf "got %s\n" (Word.to_string r); - assert_bool name equal in - match Main.run proj check with - | Primus.Normal,_ -> () - | _ -> raise (Failure "Something went wrong") - -let knowledge_of_word sort w = Theory.Manager.int sort w -let knowledge_of_float x = knowledge_of_word bitv_64 (word_of_float x) -let knowledge_of_int64 x = knowledge_of_word bitv_64 (Word.of_int64 x) - -let gfloat_of_int x = - let bits = Word.of_int ~width:64 x in - knowledge_of_word bitv_64 bits - -let binop op x y ctxt = - let bits = Int64.bits_of_float in - let name = sprintf "%Lx %s %Lx\n" (bits x) (test_name op) (bits y) in - let real, op = match op with - | `Add -> x +. y, G.fadd - | `Sub -> x -. y, G.fsub - | `Mul -> x *. y, G.fmul - | `Div -> x /. y, G.fdiv in - let test = op fsort64 G.rne (knowledge_of_float x) (knowledge_of_float y) in - eval ~name ~expected:(word_of_float real) test ctxt - -let cast_int cast x ctxt = - let name = sprintf "%s %d\n" (test_name cast) x in - let expected = word_of_float (float x) in - let op = match cast with - | `Of_uint -> G.cast_float - | `Of_sint -> G.cast_float_signed in - let test = op fsort64 G.rne (gfloat_of_int x) in - eval ~name ~expected test ctxt - -let cast_float x ctxt = - let name = sprintf "%s %g\n" (test_name `Of_float) x in - let expected = Word.of_int ~width:64 (int_of_float x) in - let test = G.cast_int fsort64 bitv_64 (knowledge_of_float x) in - eval ~name ~expected test ctxt - -let sqrt_exp x ctxt = - let name = sprintf "sqrt %g\n" x in - let expected = Float.sqrt x |> word_of_float in - let x = Theory.Manager.var (Var.define bitv_64 "x") in - let test = G.fsqrt fsort64 G.rne x in - eval ~name ~expected test ctxt - -let sqrt_ x ctxt = - let name = sprintf "sqrt %g %Lx %s" x (Int64.bits_of_float x) (float64_bits x) in - let expected = Float.sqrt x |> word_of_float in - let test = G.fsqrt fsort64 G.rne (knowledge_of_float x) in - eval ~name ~expected test ctxt - -let ( + ) = binop `Add -let ( - ) = binop `Sub -let ( * ) = binop `Mul -let ( / ) = binop `Div - -let of_uint = cast_int `Of_uint -let of_sint = cast_int `Of_sint -let to_int = cast_float - -let make_float s e c = - let s = Word.of_int ~width:1 s in - let e = Word.of_int ~width:11 e in - let c = Word.of_int ~width:52 c in - let w = Word.(concat (concat s e) c) in - Word.signed w |> Word.to_int64_exn |> Int64.float_of_bits - -let neg x = ~-. x -let nan = Float.nan -let inf = Float.infinity -let ninf = Float.neg_infinity -let smallest_nonzero = make_float 0 0 1 -let some_small = make_float 0 0 2 -let biggest_subnormal = make_float 0 0 0xFFFF_FFFF_FFFF_F -let smallest_normal = Float.(biggest_subnormal + smallest_nonzero) -let biggest_normal = make_float 0 2046 0xFFFF_FFFF_FFFF_F - -let () = Random.self_init () - -let random = Random.int -let random_elt xs = List.nth_exn xs @@ random (List.length xs) - -let random_int ~from ~to_ = - let open Caml in - let max = to_ - from in - let x = random max in - x + from - -let random_float () = - let expn () = random_int ~from:0 ~to_:2046 in - let frac () = Random.int 0xFFFFFFFFFFFFF in - let sign () = Random.int 2 in - let make () = - let expn = expn () in - let frac = frac () in - make_float (sign ()) expn frac in - let small () = - let x = Random.int 42 in - let y = Int64.of_int x in - Random.float (Int64.float_of_bits y) in - random_elt [make (); make (); small (); make (); make (); small (); make ()] - -let random_floats ~times ops = - List.init times ~f:(fun i -> - let f = - match random_elt ops with - | `Sqrt -> - let x = Float.abs @@ random_float () in - fun (ctxt : test_ctxt) -> sqrt_ x ctxt - | `Add | `Sub | `Mul | `Div as op -> - let x = random_float () in - let y = random_float () in - fun ctxt -> binop op x y ctxt in - (sprintf "random%d" i) >:: f) - -let of_bits = Int64.float_of_bits - -let convert_128_to_64 x expected _ctxt = - let open Machine.Syntax in - let from = fsort128 and to_ = fsort64 in - let expected = Word.of_int64 @@ Int64.bits_of_float expected in - match exp (G.convert from x G.rne to_) with - | None -> assert false - | Some e -> - let check = - Eval.exp e >>| fun r -> - let r = Primus.Value.to_word r in - let equal = Word.(r = expected) in - assert_bool "convert_64_to_32" equal in - match Main.run proj check with - | Primus.Normal,_ -> () - | _ -> raise (Failure "Something went wrong") - -let convert_64_to_32 x _ctxt = - let open Machine.Syntax in - let from = fsort64 and to_ = fsort32 in - let expected = Word.of_int32 @@ Int32.bits_of_float x in - let x = knowledge_of_float x in - match exp (G.convert from x G.rne to_) with - | None -> assert false - | Some e -> - let check = - Eval.exp e >>| fun r -> - let r = Primus.Value.to_word r in - let equal = Word.(r = expected) in - assert_bool "convert_64_to_32" equal in - match Main.run proj check with - | Primus.Normal,_ -> () - | _ -> raise (Failure "Something went wrong") - -let one_128 = - knowledge_of_word bitv_128 (Word.of_string "0x3fff0000000000000000000000000000:128u") - -let suite () = - - let almost_inf32 = of_bits 0x47EFFFFFeFFFFFFFL in - let shouldbe_inf32 = of_bits 0x47EFFFFFfFFFFFFFL in - - "Gfloat" >::: [ - - (* of uint *) - "of uint 42" >:: of_uint 42; - "of uint 0" >:: of_uint 0; - "of uint 1" >:: of_uint 1; - "of uint 2" >:: of_uint 2; - "of uint 10" >:: of_uint 10; - "of uint 13213" >:: of_uint 13213; - "of uint 45676" >:: of_uint 45667; - "of uint 98236723" >:: of_uint 98236723; - "of uint 0xFFFF_FFFF_FFFF_FFF" >:: of_uint 0xFFFF_FFFF_FFFF_FFF; - - (* of sint *) - "of sint -42" >:: of_sint (-42); - "of sint 0" >:: of_sint 0; - "of sint -1" >:: of_sint 1; - "of sint -2" >:: of_sint (-2); - "of sint -10" >:: of_sint (-10); - "of sint -13213" >:: of_sint (-13213); - "of sint -45676" >:: of_sint (-45667); - "of sint -98236723" >:: of_sint (-98236723); - - (* to int *) - "to int 42.42" >:: to_int 42.42; - "to int 0.42" >:: to_int 0.42; - "to int 0.99999999999" >:: to_int 0.99999999999; - "to int 13123120.98882344542" >:: to_int 13123120.98882344542; - "to int -42.42" >:: to_int (-42.42); - "to int -13123120.98882344542" >:: to_int (-13123120.98882344542); - - (* convert float to float *) - "convert almost inf32" >:: convert_64_to_32 almost_inf32; - "should be inf32" >:: convert_64_to_32 shouldbe_inf32; - "one128 to one64" >:: convert_128_to_64 one_128 1.0; - - (* add *) - "0.0 + 0.5" >:: 0.0 + 0.5; - "4.2 + 2.3" >:: 4.2 + 2.3; - "4.2 + 2.98" >:: 4.2 + 2.98; - "2.2 + 4.28" >:: 2.2 + 4.28; - "2.2 + 2.46" >:: 2.2 + 2.46; - "2.2 + -4.28" >:: 2.2 + (neg 4.28); - "-2.2 + 4.28" >:: (neg 2.2) + 4.28; - "0.0000001 + 0.00000002" >:: 0.0000001 + 0.00000002; - "123213123.23434 + 56757.05656549151" >:: 123213123.23434 + 56757.05656549151; - "nan + nan" >:: nan + nan; - "inf + inf" >:: inf + inf; - "-inf + -inf" >:: ninf + ninf; - "nan + -inf" >:: nan + ninf; - "-inf + nan" >:: ninf + nan; - "nan + inf" >:: nan + inf; - "inf + nan" >:: inf + nan; - "-inf + inf" >:: ninf + inf; - "inf + -inf" >:: inf + ninf; - "0.0 + small" >:: 0.0 + smallest_nonzero; - "small + small" >:: smallest_nonzero + some_small; - "biggest_sub + small" >:: biggest_subnormal + smallest_nonzero; - "biggest_normal + small" >:: biggest_normal + smallest_nonzero; - "biggest_normal + biggest_subnorm" >:: biggest_normal + biggest_subnormal; - "near inf case" >:: make_float 0 2046 0xFFFF_FFFF_FFFF_FFF + make_float 0 2046 1; - - (* sub *) - "4.2 - 2.28" >:: 4.2 - 2.28; - "4.28 - 2.2" >:: 4.28 - 2.2; - "2.2 - 4.28" >:: 2.2 - 4.28; - "2.2 - 2.6" >:: 2.2 - 2.6; - "0.0 - 0.0" >:: 0.0 - 0.0; - "4.2 - 4.2" >:: 4.2 - 4.2; - "2.2 - -4.28" >:: 2.2 - (neg 4.28); - "-2.2 - 2.46" >:: (neg 2.2) - 2.46; - "-2.2 - -2.46" >:: (neg 2.2) - (neg 2.46); - "2.0 - 2.0" >:: 2.0 - 2.0; - "-2.0 + 2.0" >:: (neg 2.0) + 2.0; - "0.0000001 - 0.00000002" >:: 0.0000001 - 0.00000002; - "0.0 - 0.00000001" >:: 0.0 - 0.0000001; - "123213123.23434 - 56757.05656549151" >:: 123213123.23434 - 56757.05656549151; - "nan - nan" >:: nan - nan; - "inf - inf" >:: inf - inf; - "-inf - -inf" >:: ninf - ninf; - "nan - -inf" >:: nan - ninf; - "-inf - nan" >:: ninf - nan; - "nan - inf" >:: nan - inf; - "inf - nan" >:: inf - nan; - "-inf - inf" >:: ninf - inf; - "inf - -inf" >:: inf - ninf; - "0.0 - small" >:: 0.0 - smallest_nonzero; - "small - 0.0" >:: smallest_nonzero - 0.0; - "small - small" >:: smallest_nonzero - smallest_nonzero; - "small - small'" >:: smallest_nonzero - some_small; - "small' - small" >:: some_small - smallest_nonzero; - "smalles_norm - small" >:: smallest_normal - smallest_nonzero; - "biggest_sub - small" >:: biggest_subnormal - smallest_nonzero; - "biggest_normal - small" >:: biggest_normal - smallest_nonzero; - "biggest_normal - biggest_subnorm" >:: biggest_normal - biggest_subnormal; - "biggest_subnorm - biggest_normal" >:: biggest_subnormal - biggest_normal; - "near inf case" >:: make_float 1 2046 0xFFFF_FFFF_FFFF_FFF - make_float 0 2046 1; - - (* mul *) - "1.0 * 2.5" >:: 1.0 * 2.5; - "2.5 * 0.5" >:: 2.5 * 0.5; - "4.2 * 3.4" >:: 4.2 * 3.4; - "0.01 * 0.02" >:: 0.01 * 0.02; - "1.0 * 0.5" >:: 1.0 * 0.5; - "1.0 * -0.5" >:: 1.0 * (neg 0.5); - "- 1.0 * -0.5" >:: (neg 1.0) * (neg 0.5); - "123734.86124324198 * 23967986786.4834517" >:: 123734.86124324198 * 23967986786.4834517; - "nan * nan" >:: nan * nan; - "inf * inf" >:: inf * inf; - "-inf * -inf" >:: ninf * ninf; - "nan * -inf" >:: nan * ninf; - "-inf * nan" >:: ninf * nan; - "nan * inf" >:: nan * inf; - "inf * nan" >:: inf * nan; - "-inf * inf" >:: ninf * inf; - "inf * -inf" >:: inf * ninf; - "0.0 * big" >:: 0.0 * biggest_normal; - "0.0 * small" >:: 0.0 * biggest_subnormal; - "0.0 * small'" >:: 0.0 * smallest_nonzero; - "2.0 * small" >:: 2.0 * smallest_nonzero; - "1123131.45355 * small" >:: 1123131.45355 * smallest_nonzero; - "small * small" >:: smallest_nonzero * some_small; - "smallest normal * small" >:: smallest_normal * smallest_nonzero; - "biggest subnormal * small" >:: biggest_subnormal * smallest_nonzero; - "biggest normal * small" >:: biggest_normal * smallest_nonzero; - "biggest normal * 2.0" >:: biggest_normal * 2.0; - "biggest normal * biggest subnormal" >:: biggest_normal * biggest_subnormal; - "biggest subnormal * small" >:: biggest_subnormal * smallest_nonzero; - "biggest subnormal * biggest subnormal" >:: biggest_subnormal * biggest_subnormal; - "biggest normal * biggest normal" >:: biggest_normal * biggest_normal; - "test with underflow" >:: of_bits 974381688320862858L * of_bits (-5590604654947855237L); - "test1" >:: of_bits 0xec9059c2619517d5L + of_bits 0x6c52387cdb6aefadL; - "test2" >:: of_bits 0xa10d89faaef35527L - of_bits 0xa130e0fee63e0e6fL; - "test3" >:: of_bits 0x400199999999999aL - of_bits 0x4004cccccccccccdL; - "test4" >:: of_bits 0x7fefffffffffffffL - of_bits 0xfffffffffffffL; - - (* div *) - "2.0 / 0.5" >:: 2.0 / 0.5; - "1.0 / 3.0" >:: 1.0 / 3.0; - "3.0 / 32.0" >:: 3.0 / 32.0; - "324.32423 / 1.2" >:: 324.32423 / 1.2; - "2.4 / 3.123131" >:: 2.4 / 3.123131; - "0.1313134 / 0.578465631" >:: 0.1313134 / 0.578465631; - "9991132.2131363434 / 2435.05656549153" >:: 9991132.2131363434 / 2435.05656549153; - "nan / nan" >:: nan / nan; - "inf / inf" >:: inf / inf; - "-inf / -inf" >:: ninf / ninf; - "nan / -inf" >:: nan / ninf; - "-inf / nan" >:: ninf / nan; - "nan / inf" >:: nan / inf; - "inf / nan" >:: inf / nan; - "-inf / inf" >:: ninf / inf; - "inf / -inf" >:: inf / ninf; - "0.0 / small" >:: 0.0 / smallest_nonzero; - "small / small'" >:: smallest_nonzero / some_small; - "small' / small" >:: some_small / smallest_nonzero; - "small / small" >:: smallest_nonzero / smallest_nonzero; - "smallest_norm / small" >:: smallest_normal / smallest_nonzero; - "biggest_sub / small" >:: biggest_subnormal / smallest_nonzero; - "biggest_normal / small" >:: biggest_normal / smallest_nonzero; - "biggest_normal / biggest_subnorm" >:: biggest_normal / biggest_subnormal; - "biggest_normal / smallest_normal" >:: biggest_normal / smallest_normal; - - ] @ random_floats ~times:100 [`Add; `Sub; `Mul; `Div; `Sqrt] - -let () = run_test_tt_main (suite ()) diff --git a/plugins/bil/bil_float_tests.mli b/plugins/bil/bil_float_tests.mli deleted file mode 100644 index 8b1378917..000000000 --- a/plugins/bil/bil_float_tests.mli +++ /dev/null @@ -1 +0,0 @@ - diff --git a/plugins/bil/bil_main.ml b/plugins/bil/bil_main.ml index 4af02568b..db6ca4d30 100644 --- a/plugins/bil/bil_main.ml +++ b/plugins/bil/bil_main.ml @@ -161,7 +161,7 @@ let () = all string comparisons are made case-insensitive. \ Example, $(b,:unknown,:special,asm:addsd,llvm:trap)." in - declare ~provides:["bil"; "core-theory"; "lifter"] @@ fun ctxt -> + declare ~doc ~provides:["bil"; "core-theory"; "lifter"] @@ fun ctxt -> let open Syntax in if ctxt-->list_passes then print_passes () else begin diff --git a/plugins/bil/dune b/plugins/bil/dune new file mode 100644 index 000000000..1928e64da --- /dev/null +++ b/plugins/bil/dune @@ -0,0 +1,21 @@ +(library + (name bap_bil_plugin) + (public_name bap-bil.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-future + bap-knowledge + bap-main + bitvec + bitvec-order + core_kernel + monads + ogre)) + +(plugin + (name bil) + (package bap-bil) + (libraries bap-bil.plugin) + (site (bap-common plugins))) diff --git a/plugins/byteweight/.merlin b/plugins/byteweight/.merlin deleted file mode 100644 index 16b3eec9a..000000000 --- a/plugins/byteweight/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_byteweight -B ../../lib/bap_byteweight \ No newline at end of file diff --git a/plugins/byteweight/dune b/plugins/byteweight/dune new file mode 100644 index 000000000..902e22377 --- /dev/null +++ b/plugins/byteweight/dune @@ -0,0 +1,19 @@ +(library + (name bap_byteweight_plugin) + (public_name bap-byteweight.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-byteweight + bap-core-theory + bap-knowledge + bap-main + bitvec + bitvec-order + core_kernel)) + +(plugin + (name byteweight) + (package bap-byteweight) + (libraries bap-byteweight.plugin) + (site (bap-common plugins))) diff --git a/plugins/cache/.merlin b/plugins/cache/.merlin deleted file mode 100644 index f7751ec49..000000000 --- a/plugins/cache/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -PKG cmdliner -PKG mmap -PKG fileutils - -S . -B ../../_build/plugins/cache - -REC \ No newline at end of file diff --git a/plugins/cache/bap_cache_main.ml b/plugins/cache/bap_cache_main.ml index 790afe108..9345a61a3 100644 --- a/plugins/cache/bap_cache_main.ml +++ b/plugins/cache/bap_cache_main.ml @@ -205,6 +205,7 @@ let print_command_options () = let _cmd = let doc = "provides options to control cache size and cache garbage collector." in + Extension.declare ~doc ~provides:["cache"] (fun _ -> Ok ()); Extension.Command.( begin declare ~doc "cache" diff --git a/plugins/cache/dune b/plugins/cache/dune new file mode 100644 index 000000000..73acf4057 --- /dev/null +++ b/plugins/cache/dune @@ -0,0 +1,19 @@ +(library + (name bap_cache_plugin) + (public_name bap-cache.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-main + core_kernel + core_kernel.caml_unix + fileutils + mmap + regular + uuidm)) + +(plugin + (name cache) + (package bap-cache) + (libraries bap-cache.plugin) + (site (bap-common plugins))) diff --git a/plugins/callgraph_collator/dune b/plugins/callgraph_collator/dune new file mode 100644 index 000000000..e78730ace --- /dev/null +++ b/plugins/callgraph_collator/dune @@ -0,0 +1,11 @@ +(library + (name bap_callgraph_collator_plugin) + (public_name bap-callgraph-collator.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-main core_kernel graphlib re.pcre)) + +(plugin + (name callgraph-collator) + (package bap-callgraph-collator) + (libraries bap-callgraph-collator.plugin) + (site (bap-common plugins))) diff --git a/plugins/callsites/callsites_main.ml b/plugins/callsites/callsites_main.ml index 64a105eb4..0a37f0bfa 100644 --- a/plugins/callsites/callsites_main.ml +++ b/plugins/callsites/callsites_main.ml @@ -109,4 +109,7 @@ let () = `S "SEE ALSO"; `P "$(b,bap-plugin-api)(1)" ]; - Config.when_ready (fun _ -> Project.register_pass ~deps:["abi"] main) + Config.declare_extension + ~doc:"annotates callsites with subroutines arguments" + ~provides:["pass"] + (fun _ -> Project.register_pass ~deps:["abi"] main) diff --git a/plugins/callsites/dune b/plugins/callsites/dune new file mode 100644 index 000000000..41eb963ca --- /dev/null +++ b/plugins/callsites/dune @@ -0,0 +1,10 @@ +(library + (name bap_callsites_plugin) + (public_name bap-callsites.plugin) + (libraries bap core_kernel)) + +(plugin + (name callsites) + (package bap-callsites) + (libraries bap-callsites.plugin) + (site (bap-common plugins))) diff --git a/plugins/constant_tracker/.merlin b/plugins/constant_tracker/.merlin deleted file mode 100644 index 26d8b94f2..000000000 --- a/plugins/constant_tracker/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -PKG bap -PKG bap-primus -FLG -short-paths,-open Bap.Std,-open Bap_primus.Std -REC \ No newline at end of file diff --git a/plugins/constant_tracker/constant_tracker_main.ml b/plugins/constant_tracker/constant_tracker_main.ml index b4b9fc1af..4ad9bf7b7 100644 --- a/plugins/constant_tracker/constant_tracker_main.ml +++ b/plugins/constant_tracker/constant_tracker_main.ml @@ -103,7 +103,10 @@ end let enable = Config.flag "enable" -let () = Config.when_ready @@ fun {Config.get} -> +let () = Config.declare_extension + ~doc:"a constant tracking analysis based on Primus" + ~provides:["primus"; "lisp"; "analysis"] + @@ fun {Config.get} -> Primus.Machine.add_component (module Primitives) [@warning "-D"]; Primus.Components.register_generic "constant-tracker-primitives" (module Primitives) diff --git a/plugins/constant_tracker/dune b/plugins/constant_tracker/dune new file mode 100644 index 000000000..e93209e55 --- /dev/null +++ b/plugins/constant_tracker/dune @@ -0,0 +1,11 @@ +(library + (name bap_constant_tracker_plugin) + (public_name bap-constant-tracker.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-primus core_kernel)) + +(plugin + (name constant-tracker) + (package bap-constant-tracker) + (libraries bap-constant-tracker.plugin) + (site (bap-common plugins))) diff --git a/plugins/constant_tracker/lisp/dune b/plugins/constant_tracker/lisp/dune new file mode 100644 index 000000000..6a8d2f528 --- /dev/null +++ b/plugins/constant_tracker/lisp/dune @@ -0,0 +1,4 @@ +(install + (files check-hardcoded-values.lisp check-null-pointers.lisp) + (package bap-constant-tracker) + (section (site (bap-common site_lisp)))) diff --git a/plugins/core_theory/core_theory_main.ml b/plugins/core_theory/core_theory_main.ml index 2840837cc..96d13f5f7 100644 --- a/plugins/core_theory/core_theory_main.ml +++ b/plugins/core_theory/core_theory_main.ml @@ -517,7 +517,9 @@ let enable_herbrand () = ~package:"core" ~name:"syntax" (KB.return (module Herbrand : Theory.Core)) -let () = Extension.declare @@ fun ctxt -> +let () = Extension.declare + ~doc:"provides core theory rules" + ~provides:["semantics"; "core-theory"] @@ fun ctxt -> if Extension.Configuration.get ctxt herbrand_enabled then enable_herbrand (); Ok () diff --git a/plugins/core_theory/dune b/plugins/core_theory/dune new file mode 100644 index 000000000..8be63032c --- /dev/null +++ b/plugins/core_theory/dune @@ -0,0 +1,12 @@ +(library + (name bap_core_theory_plugin) + (public_name bap-core-theory.plugin) + (preprocess (pps ppx_bap)) + (libraries bap-core-theory bap-knowledge bap-main + bitvec core_kernel monads)) + +(plugin + (name core-theory) + (package bap-core-theory) + (libraries bap-core-theory.plugin) + (site (bap-common plugins))) diff --git a/plugins/cxxfilt/cxxfilt_main.ml b/plugins/cxxfilt/cxxfilt_main.ml index 0df21bd51..30b40bd2a 100644 --- a/plugins/cxxfilt/cxxfilt_main.ml +++ b/plugins/cxxfilt/cxxfilt_main.ml @@ -29,5 +29,7 @@ let run name = let () = - Config.when_ready @@ fun _ -> + Config.declare_extension + ~doc:"provides a demangler that uses c++filt" + ~provides:["c++"; "demangler"; "c++filt"] @@ fun _ -> Demangler.declare ~package:"bap" "c++filt" run diff --git a/plugins/cxxfilt/dune b/plugins/cxxfilt/dune new file mode 100644 index 000000000..d5bd50932 --- /dev/null +++ b/plugins/cxxfilt/dune @@ -0,0 +1,19 @@ +(library + (name bap_cxxfilt_plugin) + (public_name bap-cxxfilt.plugin) + (libraries bap bap-demangle core_kernel core_kernel.caml_unix)) + +(plugin + (name cxxfilt) + (package bap-cxxfilt) + (libraries bap-cxxfilt.plugin) + (site (bap-common plugins))) + +(rule + (target cxxfilt_config.ml) + (deps cxxfilt_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/demangle/.merlin b/plugins/demangle/.merlin deleted file mode 100644 index b8e803629..000000000 --- a/plugins/demangle/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_demangle -B ../../lib/bap_demangle \ No newline at end of file diff --git a/plugins/demangle/demangle_main.ml b/plugins/demangle/demangle_main.ml index c4081ac30..7e8d3ad2c 100644 --- a/plugins/demangle/demangle_main.ml +++ b/plugins/demangle/demangle_main.ml @@ -12,6 +12,8 @@ Performs ABI-specific name resolution and demangling. let provides = [ "symbolizer"; "demangling"; + "demangler"; + "symbolizer"; ] let override = Extension.Configuration.parameter @@ -84,7 +86,7 @@ let decide_name_from_possible_name ?override () : unit = Option.map name ~f:(Demangler.run demangler) -let () = Extension.declare @@ fun ctxt -> +let () = Extension.declare ~provides ~doc @@ fun ctxt -> let override = Extension.Configuration.get ctxt override in decide_name_from_possible_name ?override (); Internal.install (); diff --git a/plugins/demangle/dune b/plugins/demangle/dune new file mode 100644 index 000000000..63a96b875 --- /dev/null +++ b/plugins/demangle/dune @@ -0,0 +1,15 @@ +(library + (name demangle) + (public_name bap-demangle.plugin) + (libraries + bap-core-theory + bap-demangle + bap-knowledge + bap-main + core_kernel)) + +(plugin + (name demangle) + (package bap-demangle) + (libraries bap-demangle.plugin) + (site (bap-common plugins))) diff --git a/plugins/dependencies/dependencies_main.ml b/plugins/dependencies/dependencies_main.ml index dea813e2f..cd7a69d8f 100644 --- a/plugins/dependencies/dependencies_main.ml +++ b/plugins/dependencies/dependencies_main.ml @@ -398,3 +398,9 @@ let () = Extension.Command.(begin let r = State.load ?root ?ldconfig ~recursive ~context paths input in Format.printf "%a@." (pp fmt) r; Ok () + + +let () = Extension.declare + ~doc + ~provides:["depedencies"; "command"] + (fun _ -> Ok ()) diff --git a/plugins/dependencies/dune b/plugins/dependencies/dune new file mode 100644 index 000000000..649a31af3 --- /dev/null +++ b/plugins/dependencies/dune @@ -0,0 +1,11 @@ +(library + (name bap_dependencies_plugin) + (public_name bap-dependencies.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-main core_kernel ogre regular)) + +(plugin + (name dependencies) + (package bap-dependencies) + (libraries bap-dependencies.plugin) + (site (bap-common plugins))) diff --git a/plugins/disassemble/.merlin b/plugins/disassemble/.merlin deleted file mode 100644 index 2ba616962..000000000 --- a/plugins/disassemble/.merlin +++ /dev/null @@ -1 +0,0 @@ -REC diff --git a/plugins/disassemble/disassemble_main.ml b/plugins/disassemble/disassemble_main.ml index 7a89b2acd..1e02a9ecd 100644 --- a/plugins/disassemble/disassemble_main.ml +++ b/plugins/disassemble/disassemble_main.ml @@ -685,3 +685,9 @@ let string_of_failure = function let () = Extension.Error.register_printer @@ function | Fail err -> Some (string_of_failure err) | _ -> None + + +let () = Extension.declare + ~doc:man + ~provides:["command"; "analysis"; "disassemble"] + (fun _ -> Ok ()) diff --git a/plugins/disassemble/dune b/plugins/disassemble/dune new file mode 100644 index 000000000..c73118f0e --- /dev/null +++ b/plugins/disassemble/dune @@ -0,0 +1,24 @@ +(library + (name disassemble) + (public_name bap-disassemble.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + bap-relation + bitvec + bitvec-binprot + bitvec-order + bitvec-sexp + core_kernel + monads + ogre + regular)) + +(plugin + (name disassemble) + (package bap-disassemble) + (libraries bap-disassemble.plugin) + (site (bap-common plugins))) diff --git a/plugins/dump_symbols/.merlin b/plugins/dump_symbols/.merlin deleted file mode 100644 index fa3483337..000000000 --- a/plugins/dump_symbols/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG cmdliner -REC \ No newline at end of file diff --git a/plugins/dump_symbols/dump_symbols_main.ml b/plugins/dump_symbols/dump_symbols_main.ml index 3056ded4d..59a1ba355 100644 --- a/plugins/dump_symbols/dump_symbols_main.ml +++ b/plugins/dump_symbols/dump_symbols_main.ml @@ -35,6 +35,9 @@ let () = ] in let file = Config.(param (some string) "file" ~docv:"FILE" ~doc:"Dump symbols to the specified $(docv)") in - Config.when_ready (fun {Config.get=(!)} -> - let main = main !file in - Project.register_pass' main) + Config.declare_extension + ~doc:"dumps functions as a sexp-list of blocks" + ~provides:["printer"; "pass"] + (fun {Config.get=(!)} -> + let main = main !file in + Project.register_pass' main) diff --git a/plugins/dump_symbols/dune b/plugins/dump_symbols/dune new file mode 100644 index 000000000..4eca3cb34 --- /dev/null +++ b/plugins/dump_symbols/dune @@ -0,0 +1,11 @@ +(library + (name bap_dump_symbols_plugin) + (public_name bap-dump-symbols.plugin) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel graphlib regular)) + +(plugin + (name dump-symbols) + (package bap-dump-symbols) + (libraries bap-dump-symbols.plugin) + (site (bap-common plugins))) diff --git a/plugins/elf_loader/dune b/plugins/elf_loader/dune new file mode 100644 index 000000000..e786f9406 --- /dev/null +++ b/plugins/elf_loader/dune @@ -0,0 +1,11 @@ +(library + (name bap_elf_loader_plugin) + (public_name bap-elf.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-elf bap-dwarf core_kernel regular)) + +(plugin + (name elf-loader) + (package bap-elf) + (libraries bap-elf.plugin) + (site (bap-common plugins))) diff --git a/plugins/elf_loader/elf_loader_main.ml b/plugins/elf_loader/elf_loader_main.ml index 5d391e05a..0135535f3 100644 --- a/plugins/elf_loader/elf_loader_main.ml +++ b/plugins/elf_loader/elf_loader_main.ml @@ -187,7 +187,9 @@ let of_data (data : Bigstring.t) : Img.t option = None let () = - Config.when_ready @@ fun _ -> + Config.declare_extension + ~doc:"provides an alternative ELF image loader" + ~provides:["elf"; "dwarf"; "loader"] @@ fun _ -> match Image.register_backend ~name of_data with | `Ok -> () | `Duplicate -> diff --git a/plugins/emit_ida_script/.merlin b/plugins/emit_ida_script/.merlin deleted file mode 100644 index fa3483337..000000000 --- a/plugins/emit_ida_script/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG cmdliner -REC \ No newline at end of file diff --git a/plugins/emit_ida_script/dune b/plugins/emit_ida_script/dune new file mode 100644 index 000000000..49aa6991e --- /dev/null +++ b/plugins/emit_ida_script/dune @@ -0,0 +1,11 @@ +(library + (name bap_emit_ida_script_plugin) + (public_name bap-ida-plugin.plugin) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel regular)) + +(plugin + (name emit-ida-script) + (package bap-ida-plugin) + (libraries bap-ida-plugin.plugin) + (site (bap-common plugins))) diff --git a/plugins/emit_ida_script/emit_ida_script_main.ml b/plugins/emit_ida_script/emit_ida_script_main.ml index 8e166c57b..5ce3a35f3 100644 --- a/plugins/emit_ida_script/emit_ida_script_main.ml +++ b/plugins/emit_ida_script/emit_ida_script_main.ml @@ -143,6 +143,8 @@ let () = let attrs = Config.(param_all string "attr" ~doc: "Emit specified BIR attribute. Can be specified multiple times.") in - Config.when_ready (fun {Config.get=(!)} -> - let main = main !dst !attrs in - Project.register_pass' main ) + Config.declare_extension ~doc:"generates IDA Python scripts" + ~provides:["ida"; "python"; "pass"] + (fun {Config.get=(!)} -> + let main = main !dst !attrs in + Project.register_pass' main ) diff --git a/plugins/flatten/.merlin b/plugins/flatten/.merlin deleted file mode 100644 index 2bb530b2a..000000000 --- a/plugins/flatten/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC - -B ../../_build diff --git a/plugins/flatten/dune b/plugins/flatten/dune new file mode 100644 index 000000000..cf7956119 --- /dev/null +++ b/plugins/flatten/dune @@ -0,0 +1,10 @@ +(library + (name bap_flatten_plugin) + (public_name bap-flatten.plugin) + (libraries bap bap-main)) + +(plugin + (name flatten) + (package bap-flatten) + (libraries bap-flatten.plugin) + (site (bap-common plugins))) diff --git a/plugins/flatten/flatten_main.ml b/plugins/flatten/flatten_main.ml index 78f901757..8f67a8159 100644 --- a/plugins/flatten/flatten_main.ml +++ b/plugins/flatten/flatten_main.ml @@ -1,24 +1,33 @@ -open Bap.Std -open Core_kernel[@@warning "-D"] +let provides = [ + "pass"; + "analysis"; + "flatten"; + "tac"; "3ac"; + "unroll" +] -include Self() +let doc = {| +# DESCRIPTION -let main = Project.map_program ~f:(Term.map sub_t ~f:Sub.flatten) +Flatten all BIR in the program. -;; -Config.manpage [ - `S "DESCRIPTION"; - `P "Flatten all AST in the program."; - `S "EXAMPLE"; - `Pre {| +# EXAMPLE + +``` ;; input #10 := 11 * (#9 + 13) - 17 ;; output #11 := #9 + 13 #12 := 11 * #11 #10 := #12 - 17 - |} +``` +|} -] -let () = Config.when_ready (fun _ -> Project.register_pass main);; +open Bap.Std + +let main = Project.map_program ~f:(Term.map sub_t ~f:Sub.flatten) + +let () = Bap_main.Extension.declare ~doc ~provides @@ fun _ -> + Project.register_pass main; + Ok () diff --git a/plugins/frontc_parser/.merlin b/plugins/frontc_parser/.merlin deleted file mode 100644 index 1930f47d3..000000000 --- a/plugins/frontc_parser/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -REC -PKG FrontC -PKG cmdliner - -B ../../_build/lib/bap_c diff --git a/plugins/frontc_parser/dune b/plugins/frontc_parser/dune new file mode 100644 index 000000000..8e8926587 --- /dev/null +++ b/plugins/frontc_parser/dune @@ -0,0 +1,11 @@ +(library + (name bap_frontc_parser_plugin) + (public_name bap-frontc.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-c FrontC core_kernel core_kernel.caml_unix)) + +(plugin + (name frontc-parser) + (package bap-frontc) + (libraries bap-frontc.plugin) + (site (bap-common plugins))) diff --git a/plugins/frontc_parser/frontc_parser_main.ml b/plugins/frontc_parser/frontc_parser_main.ml index 8a2dd198d..8820f69be 100644 --- a/plugins/frontc_parser/frontc_parser_main.ml +++ b/plugins/frontc_parser/frontc_parser_main.ml @@ -273,5 +273,8 @@ let cpp = Config.param Config.(some string) "preprocess" ~synonyms:["pp"] -let () = Config.when_ready @@ fun {get} -> +let () = Config.declare_extension + ~doc:"provides a C parser based on FrontC" + ~provides:["api"; "c"; "parser"] + @@ fun {get} -> C.Parser.provide (parser (get cpp)) diff --git a/plugins/ghidra/.merlin b/plugins/ghidra/.merlin deleted file mode 100644 index 9c6e6e537..000000000 --- a/plugins/ghidra/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../lib/bap_ghidra diff --git a/plugins/ghidra/dune b/plugins/ghidra/dune new file mode 100644 index 000000000..7422b3557 --- /dev/null +++ b/plugins/ghidra/dune @@ -0,0 +1,10 @@ +(library + (name bap_ghidra_plugin) + (public_name bap-ghidra.plugin) + (libraries bap bap-ghidra bap-main core_kernel)) + +(plugin + (name ghidra) + (package bap-ghidra) + (libraries bap-ghidra.plugin) + (site (bap-common plugins))) diff --git a/plugins/ghidra/ghidra_main.ml b/plugins/ghidra/ghidra_main.ml index 510f31310..154ec55ec 100644 --- a/plugins/ghidra/ghidra_main.ml +++ b/plugins/ghidra/ghidra_main.ml @@ -15,7 +15,10 @@ let show_targets = Extension.Configuration.flag "list-targets" let paths = Extension.Configuration.parameters Extension.Type.(list string) "path" -let () = Extension.declare @@ fun ctxt -> +let () = Extension.declare + ~doc:"provides loader, disassembler, and semantics using Ghidra Sleigh" + ~provides:["disassembler"; "ghidra"; "lifter"; "semantics"; "p-code"] + @@ fun ctxt -> let open Extension.Syntax in Bap_ghidra.init () ~paths:(List.concat (ctxt-->paths) @ default_paths) diff --git a/plugins/ghidra/semantics/dune b/plugins/ghidra/semantics/dune new file mode 100644 index 000000000..179d2f84b --- /dev/null +++ b/plugins/ghidra/semantics/dune @@ -0,0 +1,4 @@ +(install + (files pcode-cpuid.lisp pcode.lisp) + (package bap-ghidra) + (section (site (bap-common semantics)))) diff --git a/plugins/glibc_runtime/dune b/plugins/glibc_runtime/dune new file mode 100644 index 000000000..0a17b8fe2 --- /dev/null +++ b/plugins/glibc_runtime/dune @@ -0,0 +1,10 @@ +(library + (name bap_glibc_runtime_plugin) + (public_name bap-glibc-runtime.plugin) + (libraries bap bap-abi bap-c bap-core-theory bap-main core_kernel ogre)) + +(plugin + (name glibc-runtime) + (package bap-glibc-runtime) + (libraries bap-glibc-runtime.plugin) + (site (bap-common plugins))) diff --git a/plugins/ida/.merlin b/plugins/ida/.merlin deleted file mode 100644 index 05f2795ee..000000000 --- a/plugins/ida/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -PKG cmdliner -PKG bap-ida -PKG mmap -REC - -B ../../_build/lib/bap_ida -B ../../_build/plugins/ida -S . \ No newline at end of file diff --git a/plugins/ida/dune b/plugins/ida/dune new file mode 100644 index 000000000..10d45eb95 --- /dev/null +++ b/plugins/ida/dune @@ -0,0 +1,31 @@ +(library + (name bap_ida_plugin) + (public_name bap-ida.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-future + bap-ida + bap-knowledge + core_kernel + core_kernel.caml_unix + fileutils + graphlib + mmap + regular + re.posix)) + +(plugin + (name ida) + (package bap-ida) + (libraries bap-ida.plugin) + (site (bap-common plugins))) + +(rule + (target bap_ida_config.ml) + (deps bap_ida_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/ida/ida_main.ml b/plugins/ida/ida_main.ml index 7b963241d..598db1c50 100644 --- a/plugins/ida/ida_main.ml +++ b/plugins/ida/ida_main.ml @@ -299,11 +299,14 @@ module Cmdline = struct let mode = let doc = "Specify IDA mode." in Config.(param Mode.t "mode" ~default:None ~doc) in - Config.when_ready (fun {Config.get=(!)} -> - let is_headless = bool_of_headless !headless in - let ida_path = find_path !path in - match Info.create ida_path is_headless with - | Ok info -> Bap_ida_service.register info !mode; main () - | Error e -> - warning "%S. Service not registered." (Error.to_string_hum e)) + Config.declare_extension + ~doc:"uses IDA Pro to extract symbols and function starts" + ~provides:["ida"; "rooter"; "brancher"; "symbolizer"; "reconstuctor"] + (fun {Config.get=(!)} -> + let is_headless = bool_of_headless !headless in + let ida_path = find_path !path in + match Info.create ida_path is_headless with + | Ok info -> Bap_ida_service.register info !mode; main () + | Error e -> + warning "%S. Service not registered." (Error.to_string_hum e)) end diff --git a/plugins/llvm/.merlin b/plugins/llvm/.merlin deleted file mode 100644 index 070f8a88d..000000000 --- a/plugins/llvm/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -REC -PKG cmdliner -PKG bap-main -B ../../_build/plugins/llvm \ No newline at end of file diff --git a/plugins/llvm/dune b/plugins/llvm/dune new file mode 100644 index 000000000..08b56bcca --- /dev/null +++ b/plugins/llvm/dune @@ -0,0 +1,10 @@ +(library + (name llvm_plugin) + (public_name bap-llvm.plugin) + (libraries bap bap-llvm bap-main core_kernel)) + +(plugin + (name llvm) + (package bap-llvm) + (libraries bap-llvm.plugin) + (site (bap-common plugins))) diff --git a/plugins/llvm/llvm_main.ml b/plugins/llvm/llvm_main.ml index 57b5da9dc..a1ad63b93 100644 --- a/plugins/llvm/llvm_main.ml +++ b/plugins/llvm/llvm_main.ml @@ -1,3 +1,10 @@ +let provides = [ + "disassembler"; + "loader"; + "elf"; "macho"; "coff"; + "llvm" +] + open Core_kernel[@@warning "-D"] open Bap.Std open Bap_llvm.Std @@ -60,7 +67,7 @@ let version = let () = let open Syntax in - Extension.declare @@ fun ctxt -> + Extension.declare ~doc ~provides @@ fun ctxt -> let (!) x = ctxt --> x in if !version then print_version(); diff --git a/plugins/map_terms/.merlin b/plugins/map_terms/.merlin deleted file mode 100644 index 2367031df..000000000 --- a/plugins/map_terms/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_bml \ No newline at end of file diff --git a/plugins/map_terms/dune b/plugins/map_terms/dune new file mode 100644 index 000000000..0a73fdcf8 --- /dev/null +++ b/plugins/map_terms/dune @@ -0,0 +1,11 @@ +(library + (name bap_map_terms_plugin) + (public_name bap-term-mapper.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-bml bap-main core_kernel regular)) + +(plugin + (name map-terms) + (package bap-term-mapper) + (libraries bap-term-mapper.plugin) + (site (bap-common plugins))) diff --git a/plugins/map_terms/map_terms_main.ml b/plugins/map_terms/map_terms_main.ml index d8b2cadc4..72c501bda 100644 --- a/plugins/map_terms/map_terms_main.ml +++ b/plugins/map_terms/map_terms_main.ml @@ -41,7 +41,7 @@ module Scheme = struct | Ok parse_arg -> try Ok (parse_arg v) with | Parse_error msg -> Error msg - let rec parse_exp nns uns = function + let parse_exp nns uns = function | List [Atom tag] -> parse_exp0 nns uns tag | List [Atom tag; Atom v] -> parse_exp1 nns uns tag v | list -> error "expected got %s" @@ Sexp.to_string list @@ -105,7 +105,7 @@ class marker (patts : Scheme.t) = object(self) end let unmarker attr = object - inherit Term.mapper as super + inherit Term.mapper method! map_term cls t = let attrs = @@ -321,7 +321,10 @@ module Cmdline = struct let () = Config.manpage man; - Config.when_ready (fun {Config.get=(!)} -> - try Project.register_pass (main !scheme !file) with - | Parse_error msg -> eprintf "Parsing error: %s\n%!" msg) + Config.declare_extension + ~doc:"transforms program terms using the BAP Mapping Language (BML)" + ~provides:["pass"; "transformation"; "bml"] + (fun {Config.get=(!)} -> + try Project.register_pass (main !scheme !file) with + | Parse_error msg -> eprintf "Parsing error: %s\n%!" msg) end diff --git a/plugins/mc/dune b/plugins/mc/dune new file mode 100644 index 000000000..7490145c7 --- /dev/null +++ b/plugins/mc/dune @@ -0,0 +1,19 @@ +(library + (name mc_plugin) + (public_name bap-mc.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + bitvec + core_kernel + ogre + regular)) + +(plugin + (name mc) + (package bap-mc) + (libraries bap-mc.plugin) + (site (bap-common plugins))) diff --git a/plugins/mc/mc_main.ml b/plugins/mc/mc_main.ml index dd0318ee6..71c6a8dfa 100644 --- a/plugins/mc/mc_main.ml +++ b/plugins/mc/mc_main.ml @@ -78,7 +78,6 @@ open Core_kernel[@@warning "-D"] open Format open Regular.Std open Bap.Std -open Bap_plugins.Std open Bap_core_theory open Bap_main @@ -696,3 +695,8 @@ let string_of_failure = function let () = Extension.Error.register_printer @@ function | Fail err -> Some (string_of_failure err) | _ -> None + + +let () = Extension.declare + ~doc:"provides mc and objdump commands" + (fun _ -> Ok ()) diff --git a/plugins/mips/.merlin b/plugins/mips/.merlin deleted file mode 100644 index 29fc5883e..000000000 --- a/plugins/mips/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../lib/bap_mips diff --git a/plugins/mips/dune b/plugins/mips/dune new file mode 100644 index 000000000..7138da290 --- /dev/null +++ b/plugins/mips/dune @@ -0,0 +1,22 @@ +(library + (name bap_mips_plugin) + (public_name bap-mips.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-c + bap-core-theory + bap-knowledge + bap-main + bap-mips + core_kernel + regular + zarith)) + +(plugin + (name mips) + (package bap-mips) + (libraries bap-mips.plugin) + (site (bap-common plugins))) diff --git a/plugins/mips/mips_main.ml b/plugins/mips/mips_main.ml index efd0efe67..b16774627 100644 --- a/plugins/mips/mips_main.ml +++ b/plugins/mips/mips_main.ml @@ -41,11 +41,14 @@ let backend = Config.param Config.(some string) "backend" ~doc:"Specify which backend to use" let () = - Config.when_ready (fun {get} -> - Bap_mips_target.load ?backend:(get backend) (); - register_target `mips (module MIPS32); - register_target `mipsel (module MIPS32_le); - register_target `mips64 (module MIPS64); - register_target `mips64el (module MIPS64_le); - Mips.promise_delay_slots (); - Mips_abi.setup ()); + Config.declare_extension + ~doc:"provides MIPS semantics" + ~provides:["semantics"; "lifter"; "mips"] + (fun {get} -> + Bap_mips_target.load ?backend:(get backend) (); + register_target `mips (module MIPS32); + register_target `mipsel (module MIPS32_le); + register_target `mips64 (module MIPS64); + register_target `mips64el (module MIPS64_le); + Mips.promise_delay_slots (); + Mips_abi.setup ()); diff --git a/plugins/mips/mips_rtl.ml b/plugins/mips/mips_rtl.ml index d957362af..dbe667bad 100644 --- a/plugins/mips/mips_rtl.ml +++ b/plugins/mips/mips_rtl.ml @@ -311,7 +311,7 @@ module Translate = struct 3) [var1;var2; ...] := exp - equivalent to 2) 4) extract hi lo var := exp - change only certain bits of var 5) extract hi lo (var1 ^ var2 ... varN) := exp *) - let rec move lhs rhs = + let move lhs rhs = match Exp.body lhs with | Vars (v, []) -> let rhs = Exp.(cast rhs (width lhs) (sign lhs)) in diff --git a/plugins/objdump/.merlin b/plugins/objdump/.merlin deleted file mode 100644 index 69e91cd1e..000000000 --- a/plugins/objdump/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -PKG cmdliner -PKG re.pcre -B ../../_build/plugins/objdump -B ../../lib/bap_relation -REC diff --git a/plugins/objdump/dune b/plugins/objdump/dune new file mode 100644 index 000000000..fdbfa69c8 --- /dev/null +++ b/plugins/objdump/dune @@ -0,0 +1,30 @@ +(library + (name bap_objdump_plugin) + (public_name bap-objdump.plugin) + (libraries + bap-core-theory + bap-knowledge + bap-main + bap-relation + bitvec + bitvec-order + bitvec-sexp + core_kernel + core_kernel.caml_unix + re.pcre)) + +(plugin + (name objdump) + (package bap-objdump) + (libraries bap-objdump.plugin) + (site (bap-common plugins))) + + +(rule + (target objdump_config.ml) + (deps objdump_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/optimization/.merlin b/plugins/optimization/.merlin deleted file mode 100644 index 0c400ab0a..000000000 --- a/plugins/optimization/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -S . -B ../../_build/plugins/optimization - -REC \ No newline at end of file diff --git a/plugins/optimization/dune b/plugins/optimization/dune new file mode 100644 index 000000000..37bc3c98e --- /dev/null +++ b/plugins/optimization/dune @@ -0,0 +1,11 @@ +(library + (name bap_optimization_plugin) + (public_name bap-optimization.plugin) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel graphlib regular)) + +(plugin + (name optimization) + (package bap-optimization) + (libraries bap-optimization.plugin) + (site (bap-common plugins))) diff --git a/plugins/optimization/optimization_main.ml b/plugins/optimization/optimization_main.ml index 374c5678a..314534750 100644 --- a/plugins/optimization/optimization_main.ml +++ b/plugins/optimization/optimization_main.ml @@ -222,6 +222,9 @@ let () = Config.(param int ~default:0 ~doc "level") in - Config.when_ready (fun {Config.get=(!)} -> - if !level > 0 - then Project.register_pass ~deps:["api"] ~autorun:true (run !level)) + Config.declare_extension + ~doc:"removes dead code and propagates constants" + ~provides:["pass"; "optimization"; "analysis"; "simplification"] + (fun {Config.get=(!)} -> + if !level > 0 + then Project.register_pass ~deps:["api"] ~autorun:true (run !level)) diff --git a/plugins/patterns/.merlin b/plugins/patterns/.merlin deleted file mode 100644 index 73988e557..000000000 --- a/plugins/patterns/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -REC -PKG xmlm -PKG zarith -PKG fileutils -PKG uri \ No newline at end of file diff --git a/plugins/patterns/dune b/plugins/patterns/dune new file mode 100644 index 000000000..0297cfddd --- /dev/null +++ b/plugins/patterns/dune @@ -0,0 +1,26 @@ +(library + (name bap_patterns_plugin) + (public_name bap-patterns.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + bap-primus + bap-relation + bitvec + bitvec-binprot + bitvec-order + bitvec-sexp + core_kernel + fileutils + uri + xmlm + zarith)) + +(plugin + (name patterns) + (package bap-patterns) + (libraries bap-patterns.plugin) + (site (bap-common plugins))) diff --git a/plugins/patterns/semantics/dune b/plugins/patterns/semantics/dune new file mode 100644 index 000000000..416b99d8a --- /dev/null +++ b/plugins/patterns/semantics/dune @@ -0,0 +1,4 @@ +(install + (files pattern-actions.lisp) + (package bap-patterns) + (section (site (bap-common semantics)))) diff --git a/plugins/phoenix/.merlin b/plugins/phoenix/.merlin deleted file mode 100644 index f6b8809ad..000000000 --- a/plugins/phoenix/.merlin +++ /dev/null @@ -1,5 +0,0 @@ -B ../../_build/plugins/phoenix -PKG cmdliner -PKG ocamlgraph -PKG ezjsonm -REC \ No newline at end of file diff --git a/plugins/phoenix/dune b/plugins/phoenix/dune new file mode 100644 index 000000000..e457e92a5 --- /dev/null +++ b/plugins/phoenix/dune @@ -0,0 +1,19 @@ +(library + (name bap_phoenix_plugin) + (public_name bap-phoenix.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + core_kernel + core_kernel.caml_unix + ezjsonm + graphlib + ocamlgraph + regular + text-tags)) + +(plugin + (name phoenix) + (package bap-phoenix) + (libraries bap-phoenix.plugin) + (site (bap-common plugins))) diff --git a/plugins/phoenix/phoenix_helpers.ml b/plugins/phoenix/phoenix_helpers.ml index 47650b0d5..00793fd07 100644 --- a/plugins/phoenix/phoenix_helpers.ml +++ b/plugins/phoenix/phoenix_helpers.ml @@ -26,7 +26,7 @@ module Make(Env : sig | `r64 -> reg64_t in let make_var name = Bil.var (Var.create name jump_type) in - (object inherit Stmt.mapper as super + (object inherit Stmt.mapper method! map_int addr = Symtab.owners syms addr |> List.hd |> function | Some (sym,entry,_) -> diff --git a/plugins/phoenix/phoenix_main.ml b/plugins/phoenix/phoenix_main.ml index fc2a69b96..25d545d95 100644 --- a/plugins/phoenix/phoenix_main.ml +++ b/plugins/phoenix/phoenix_main.ml @@ -82,21 +82,24 @@ let man = [ let () = Config.manpage man; - Config.when_ready (fun {Config.get=(!)} -> - let cfg_format = - let deprecated_options = - [`with_name, !with_name; - `with_asm, !with_asm; - `with_bil, !with_bil] |> - List.filter ~f:snd |> - List.map ~f:fst in - deprecated_options @ !labels_with in - let options = create - !output_folder - cfg_format - !no_resolve - !keep_alive - !no_inline - !keep_consts - !no_optimizations in - Project.register_pass' (run options)) + Config.declare_extension + ~doc:"outputs the project in a phoenix format" + ~provides:["printer"] + (fun {Config.get=(!)} -> + let cfg_format = + let deprecated_options = + [`with_name, !with_name; + `with_asm, !with_asm; + `with_bil, !with_bil] |> + List.filter ~f:snd |> + List.map ~f:fst in + deprecated_options @ !labels_with in + let options = create + !output_folder + cfg_format + !no_resolve + !keep_alive + !no_inline + !keep_consts + !no_optimizations in + Project.register_pass' (run options)) diff --git a/plugins/piqi_printers/.merlin b/plugins/piqi_printers/.merlin deleted file mode 100644 index 57e491e2a..000000000 --- a/plugins/piqi_printers/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG bap-piqi -REC diff --git a/plugins/piqi_printers/dune b/plugins/piqi_printers/dune new file mode 100644 index 000000000..a4f90d49b --- /dev/null +++ b/plugins/piqi_printers/dune @@ -0,0 +1,12 @@ +(library + (name bap_piqi_printers_plugin) + (public_name bap-piqi.plugin) + (preprocess (pps ppx_bap)) + (libraries bap-piqi)) + +(plugin + (name piqi_printers) + (package bap-piqi) + (libraries bap-piqi.plugin) + (optional) + (site (bap-common plugins))) diff --git a/plugins/piqi_printers/piqi_printers_main.ml b/plugins/piqi_printers/piqi_printers_main.ml index 52f3f3994..e697573ac 100644 --- a/plugins/piqi_printers/piqi_printers_main.ml +++ b/plugins/piqi_printers/piqi_printers_main.ml @@ -65,4 +65,7 @@ module Bil = struct end -let () = Config.when_ready @@ fun _ -> Bil.register () +let () = Config.declare_extension + ~doc:"provides piqi-based serialization for BIL and BIR" + ~provides:["printer"; "serialization"; "xml"; "json"; "protobuf"] + @@ fun _ -> Bil.register () diff --git a/plugins/powerpc/.merlin b/plugins/powerpc/.merlin deleted file mode 100644 index c87033a76..000000000 --- a/plugins/powerpc/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -B ../../_build/plugins/powerpc -REC diff --git a/plugins/powerpc/dune b/plugins/powerpc/dune new file mode 100644 index 000000000..16bfea7e3 --- /dev/null +++ b/plugins/powerpc/dune @@ -0,0 +1,21 @@ +(library + (name bap_powerpc_plugin) + (public_name bap-powerpc.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-c + bap-core-theory + bap-powerpc + core_kernel + monads + regular + zarith)) + +(plugin + (name powerpc) + (package bap-powerpc) + (libraries bap-powerpc.plugin) + (site (bap-common plugins))) diff --git a/plugins/powerpc/powerpc.ml b/plugins/powerpc/powerpc.ml index 18d5e7053..af8ed1662 100644 --- a/plugins/powerpc/powerpc.ml +++ b/plugins/powerpc/powerpc.ml @@ -46,7 +46,18 @@ module Std = struct let register name lifter = Hashtbl.change lifters name ~f:(fun _ -> Some lifter) - let register_dot name lifter = register name (dot lifter) + + (* see https://reviews.llvm.org/D70758 *) + let rename_dot_to_rec old = + String.(chop_suffix_exn old ~suffix:"o" ^ "_rec") + + + let register_dot name lifter = + List.iter ~f:(fun name -> register name (dot lifter)) [ + name; + rename_dot_to_rec name; + ] + let (>|) = register let (>.) = register_dot diff --git a/plugins/powerpc/powerpc_logical.ml b/plugins/powerpc/powerpc_logical.ml index c225f6a97..5d7aa7e92 100644 --- a/plugins/powerpc/powerpc_logical.ml +++ b/plugins/powerpc/powerpc_logical.ml @@ -11,36 +11,22 @@ open Powerpc.Std Pages 92-98 of IBM Power ISATM Version 3.0 B examples: 71 2a 00 20 andi. r10,r9,32 *) -let andi_dot cpu ops = +let andi cpu ops = let ra = unsigned cpu.reg ops.(0) in let rs = unsigned cpu.reg ops.(1) in let im = unsigned imm ops.(2) in - let tm = signed var cpu.word_width in - RTL.[ - ra := rs land im; - tm := low cpu.word_width ra; - nth bit cpu.cr 0 := tm < zero; - nth bit cpu.cr 1 := tm > zero; - nth bit cpu.cr 2 := tm = zero - ] + RTL.[ra := rs land im;] (** Fixed-point AND Immediate Shifted Pages 92-98 of IBM Power ISATM Version 3.0 B examples: 75 2a 08 00 andis. r10,r9,2048 *) -let andis_dot cpu ops = +let andis cpu ops = let ra = unsigned cpu.reg ops.(0) in let rs = unsigned cpu.reg ops.(1) in let im = unsigned imm ops.(2) in let sh = unsigned const byte 16 in - let tm = signed var cpu.word_width in - RTL.[ - ra := rs land (im << sh); - tm := low cpu.word_width ra; - nth bit cpu.cr 0 := tm < zero; - nth bit cpu.cr 1 := tm > zero; - nth bit cpu.cr 2 := tm = zero; - ] + RTL.[ra := rs land (im << sh);] (** Fixed-point AND Pages 92-98 of IBM Power ISATM Version 3.0 B @@ -410,8 +396,8 @@ let neg cpu ops = RTL.[ rt := lnot ra + one ] let init () = - "ANDIo" >| andi_dot; - "ANDISo" >| andis_dot; + "ANDIo" >. andi; + "ANDISo" >. andis; "AND" >| and_; "ANDo" >. and_; "ANDC" >| andc; diff --git a/plugins/powerpc/powerpc_main.ml b/plugins/powerpc/powerpc_main.ml index 6d9427831..2f8c55939 100644 --- a/plugins/powerpc/powerpc_main.ml +++ b/plugins/powerpc/powerpc_main.ml @@ -40,23 +40,26 @@ module PowerPC64_le = Make(T64_le) let backend = Config.param Config.(some string) "backend" let () = - Config.when_ready (fun {get} -> - info "Providing PowerPC semantics in BIL"; - Bap_powerpc_target.load ?backend:(get backend)(); - Powerpc_add.init (); - Powerpc_branch.init (); - Powerpc_compare.init (); - Powerpc_cr.init (); - Powerpc_div.init (); - Powerpc_load.init (); - Powerpc_logical.init (); - Powerpc_move.init (); - Powerpc_mul.init (); - Powerpc_rotate.init (); - Powerpc_shift.init (); - Powerpc_store.init (); - Powerpc_sub.init (); - register_target `ppc (module PowerPC32); - register_target `ppc64 (module PowerPC64); - register_target `ppc64le (module PowerPC64_le); - Powerpc_abi.setup ()); + Config.declare_extension + ~doc:"provides the PowerPC lifter" + ~provides:["semantics"; "lifter"; "powerpc"] + (fun {get} -> + info "Providing PowerPC semantics in BIL"; + Bap_powerpc_target.load ?backend:(get backend)(); + Powerpc_add.init (); + Powerpc_branch.init (); + Powerpc_compare.init (); + Powerpc_cr.init (); + Powerpc_div.init (); + Powerpc_load.init (); + Powerpc_logical.init (); + Powerpc_move.init (); + Powerpc_mul.init (); + Powerpc_rotate.init (); + Powerpc_shift.init (); + Powerpc_store.init (); + Powerpc_sub.init (); + register_target `ppc (module PowerPC32); + register_target `ppc64 (module PowerPC64); + register_target `ppc64le (module PowerPC64_le); + Powerpc_abi.setup ()); diff --git a/plugins/powerpc/powerpc_rtl.ml b/plugins/powerpc/powerpc_rtl.ml index c2c62bd7b..cafa6645b 100644 --- a/plugins/powerpc/powerpc_rtl.ml +++ b/plugins/powerpc/powerpc_rtl.ml @@ -331,7 +331,7 @@ module Translate = struct 3) [var1;var2; ...] := exp - equivalent to 2) 4) extract hi lo var := exp - change only certain bits of var 5) extract hi lo (var1 ^ var2 ... varN) := exp *) - let rec move lhs rhs = + let move lhs rhs = match Exp.body lhs with | Vars (v, []) -> let rhs = Exp.(cast rhs (width lhs) (sign lhs)) in diff --git a/plugins/powerpc/semantics/dune b/plugins/powerpc/semantics/dune new file mode 100644 index 000000000..851898ae4 --- /dev/null +++ b/plugins/powerpc/semantics/dune @@ -0,0 +1,4 @@ +(install + (files powerpc.lisp) + (package bap-powerpc) + (section (site (bap-common semantics)))) diff --git a/plugins/primus_approximation/.merlin b/plugins/primus_approximation/.merlin deleted file mode 100644 index 28a83b472..000000000 --- a/plugins/primus_approximation/.merlin +++ /dev/null @@ -1,10 +0,0 @@ -REC -B ../../_build/plugins/bil -B ../../_build/lib/knowledge -B ../../_build/lib/bap_core_theory -FLG -open Bap_core_theory -PKG oUnit - -S . -B _build -FLG -short-paths \ No newline at end of file diff --git a/plugins/primus_dictionary/dune b/plugins/primus_dictionary/dune new file mode 100644 index 000000000..9009f4c84 --- /dev/null +++ b/plugins/primus_dictionary/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_dictionary_plugin) + (public_name bap-primus-dictionary.plugin) + (libraries bap bap-primus bap-core-theory core_kernel)) + +(plugin + (name primus-dictionary) + (package bap-primus-dictionary) + (libraries bap-primus-dictionary.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_dictionary/primus_dictionary_main.ml b/plugins/primus_dictionary/primus_dictionary_main.ml index d2b08421e..b026e0017 100644 --- a/plugins/primus_dictionary/primus_dictionary_main.ml +++ b/plugins/primus_dictionary/primus_dictionary_main.ml @@ -179,7 +179,10 @@ let () = Config.manpage [ `P desc; ] -let () = Config.when_ready @@ fun _ -> +let () = Config.declare_extension + ~doc:"provides a Primus Lisp key-value storage library" + ~provides:["primus"; "primus-library"; "dictionary"] + @@ fun _ -> Primus.Machine.add_component (module Main) [@warning "-D"]; Primus.Components.register_generic "lisp-dictionary" (module Main) ~package:"bap" diff --git a/plugins/primus_exploring/.merlin b/plugins/primus_exploring/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_exploring/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_exploring/dune b/plugins/primus_exploring/dune new file mode 100644 index 000000000..2e9b46be1 --- /dev/null +++ b/plugins/primus_exploring/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_exploring_plugin) + (public_name bap-primus-exploring-scheduler.plugin) + (libraries bap bap-primus monads core_kernel)) + +(plugin + (name primus-exploring) + (package bap-primus-exploring-scheduler) + (libraries bap-primus-exploring-scheduler.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_exploring/primus_exploring_main.ml b/plugins/primus_exploring/primus_exploring_main.ml index 7bdf710d8..4496cae98 100644 --- a/plugins/primus_exploring/primus_exploring_main.ml +++ b/plugins/primus_exploring/primus_exploring_main.ml @@ -112,4 +112,7 @@ manpage [ let enabled = flag "scheduler" ~doc:"Enable the scheduler." -let () = when_ready (fun {get=(!!)} -> register !!enabled) +let () = declare_extension + ~doc:"evaluates all Primus machines, prioritizing the least visited" + ~provides:["primus"; "scheduler"] + (fun {get=(!!)} -> register !!enabled) diff --git a/plugins/primus_greedy/dune b/plugins/primus_greedy/dune new file mode 100644 index 000000000..2354aa418 --- /dev/null +++ b/plugins/primus_greedy/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_greedy_plugin) + (public_name bap-primus-greedy-scheduler.plugin) + (libraries bap bap-primus monads core_kernel)) + +(plugin + (name primus-greedy) + (package bap-primus-greedy-scheduler) + (libraries bap-primus-greedy-scheduler.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_greedy/primus_greedy_main.ml b/plugins/primus_greedy/primus_greedy_main.ml index 6122bde54..f4521d4e8 100644 --- a/plugins/primus_greedy/primus_greedy_main.ml +++ b/plugins/primus_greedy/primus_greedy_main.ml @@ -93,4 +93,7 @@ let () = manpage [ let enabled = flag "scheduler" ~doc:"Enable the scheduler." -let () = when_ready (fun {get=(!!)} -> register !!enabled) +let () = declare_extension + ~doc:"schedules Primus machines in the DFS order" + ~provides:["primus"; "scheduler"] + (fun {get=(!!)} -> register !!enabled) diff --git a/plugins/primus_limit/.merlin b/plugins/primus_limit/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_limit/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_limit/dune b/plugins/primus_limit/dune new file mode 100644 index 000000000..1afdb00a2 --- /dev/null +++ b/plugins/primus_limit/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_limit_plugin) + (public_name bap-primus-limit.plugin) + (libraries bap bap-primus bap-future monads core_kernel regular)) + +(plugin + (name primus-limit) + (package bap-primus-limit) + (libraries bap-primus-limit.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_limit/primus_limit_main.ml b/plugins/primus_limit/primus_limit_main.ml index 750345cf1..2f7625542 100644 --- a/plugins/primus_limit/primus_limit_main.ml +++ b/plugins/primus_limit/primus_limit_main.ml @@ -155,11 +155,14 @@ module Main(Machine : Primus.Machine.S) = struct ] end -let () = Config.when_ready (fun {get} -> - if Option.is_some (get Cfg.max_length) || - Option.is_some (get Cfg.max_visited) - then Primus.Machine.add_component (module Main) [@warning "-D"]; - Primus.Components.register_generic "limit" (module Main) - ~package:"bap" - ~desc: "Enables program termination by limiting the maximum \ - life time of each Primus Machine.") +let () = Config.declare_extension + ~doc:"ensures termination by limiting Primus machines" + ~provides:["termination"; "primus"; "microexecution"; "microx"] + @@ fun {get} -> + if Option.is_some (get Cfg.max_length) || + Option.is_some (get Cfg.max_visited) + then Primus.Machine.add_component (module Main) [@warning "-D"]; + Primus.Components.register_generic "limit" (module Main) + ~package:"bap" + ~desc: "Enables program termination by limiting the maximum \ + life time of each Primus Machine." diff --git a/plugins/primus_lisp/.merlin b/plugins/primus_lisp/.merlin deleted file mode 100644 index 8a12bd54e..000000000 --- a/plugins/primus_lisp/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -REC -B ../../_build/lib/bap_primus -S ../../lib/bap_primus -B ../../_build/plugins/primus_lisp \ No newline at end of file diff --git a/plugins/primus_lisp/dune b/plugins/primus_lisp/dune new file mode 100644 index 000000000..af09985f8 --- /dev/null +++ b/plugins/primus_lisp/dune @@ -0,0 +1,29 @@ +(library + (name primus_lisp_library_plugin) + (public_name bap-primus-lisp.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + bap-primus + bitvec + core_kernel + monads + regular)) + +(plugin + (name primus-lisp) + (package bap-primus-lisp) + (libraries bap-primus-lisp.plugin) + (site (bap-common plugins))) + +(rule + (target primus_lisp_config.ml) + (deps primus_lisp_config.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/primus_lisp/lisp/dune b/plugins/primus_lisp/lisp/dune new file mode 100644 index 000000000..c005c9b91 --- /dev/null +++ b/plugins/primus_lisp/lisp/dune @@ -0,0 +1,4 @@ +(install + (files core.lisp init.lisp memory.lisp pointers.lisp) + (package bap-primus-lisp) + (section (site (bap-common lisp)))) diff --git a/plugins/primus_lisp/primus_lisp_config.ml.ab b/plugins/primus_lisp/primus_lisp_config.ml.ab index 2c00fdbeb..cad661783 100644 --- a/plugins/primus_lisp/primus_lisp_config.ml.ab +++ b/plugins/primus_lisp/primus_lisp_config.ml.ab @@ -1 +1,5 @@ -let library = "$primus_lisp_library_path" +module Sites = struct + let lisp = [${site_lisp}] + let site_lisp = [${site_site_lisp}] + let semantics = [${site_semantics}] +end diff --git a/plugins/primus_lisp/primus_lisp_main.ml b/plugins/primus_lisp/primus_lisp_main.ml index 6f57a2c7d..10c29b372 100644 --- a/plugins/primus_lisp/primus_lisp_main.ml +++ b/plugins/primus_lisp/primus_lisp_main.ml @@ -11,15 +11,19 @@ module Primitives = Primus_lisp_primitives module Semantics_primitives = Primus_lisp_semantic_primitives module Channels = Primus_lisp_io module Configuration = Bap_main.Extension.Configuration +module Local = Primus_lisp_config let is_folder p = Sys.file_exists p && Sys.is_directory p let library_paths = - let (/) = Filename.concat in Configuration.[ - datadir / "primus" / "lisp"; - sysdatadir / "primus" / "site-lisp"; - sysdatadir / "primus" / "lisp"; - ] |> List.filter ~f:is_folder + let (/) = Filename.concat in + Local.Sites.lisp @ + Local.Sites.site_lisp @ + Configuration.[ + datadir / "primus" / "lisp"; + sysdatadir / "primus" / "site-lisp"; + sysdatadir / "primus" / "lisp"; + ] |> List.filter ~f:is_folder let dump_program prog = let margin = get_margin () in @@ -320,7 +324,9 @@ module Semantics = struct Sys.readdir folder |> Array.to_list |> List.filter_map ~f:strip_lisp_extension - let default_paths = let (/) = Filename.concat in Configuration.[ + let default_paths = let (/) = Filename.concat in + Local.Sites.semantics @ + Configuration.[ datadir / "primus" / "semantics"; sysdatadir / "primus" / "semantics"; ] @@ -412,38 +418,41 @@ let () = (String.concat ~sep:" or " Redirection.known_channels) in Config.(param (list Redirection.convert) ~doc "channel-redirect") in - Config.when_ready (fun {Config.get=(!!)} -> - if !!documentation then - Project.register_pass' ~deps:["api"] ~autorun:true Documentation.print; - if !!enable_typecheck then - Project.register_pass' ~deps:["api"] ~autorun:true typecheck; - let paths = [Filename.current_dir_name] @ !!libs @ library_paths in - let features = "core" :: List.concat !!features in - Primus.Components.register_generic ~package:"bap" "lisp-type-checker" - (module TypeErrorSummary) - ~desc:"Typechecks program and outputs the summary in the standard output."; - Primus.Machine.add_component (module LispCore) [@warning "-D"]; - Primus.Components.register_generic "lisp-core" (module LispCore) - ~package:"bap" - ~desc:"Initializes Primus Lisp core. Forwards Lisp message to \ - the BAP log subsystem and enables propagation of \ - observations to signals."; - Primus.Machine.add_component (module TypeErrorPrinter) [@warning "-D"]; - Primus.Components.register_generic ~package:"bap" "lisp-type-error-printer" - (module TypeErrorPrinter) - ~desc:"Prints Primus Lisp type errors into the standard output."; - Channels.init !!redirects; - Primitives.init (); - Semantics_primitives.provide (); - Semantics.load_lisp_unit ~paths ~features; - let stdout = Option.map !!semantics_stdout ~f:(fun file -> - let ch = Out_channel.create file in - let ppf = Format.formatter_of_out_channel ch in - at_exit (fun () -> - Format.pp_print_flush ppf (); - Out_channel.close ch); - ppf) in - Primus.Lisp.Semantics.enable ?stdout (); - if Poly.(!!semantics <> ["disable"]) - then Semantics.enable_lifter !!semantics; - load_lisp_program !!dump paths features) + Config.declare_extension + ~doc:"loads and manages Primus Lisp sources" + ~provides:["primus"; "lisp"; "semantics"; "lifter"] + @@ fun {Config.get=(!!)} -> + if !!documentation then + Project.register_pass' ~deps:["api"] ~autorun:true Documentation.print; + if !!enable_typecheck then + Project.register_pass' ~deps:["api"] ~autorun:true typecheck; + let paths = [Filename.current_dir_name] @ !!libs @ library_paths in + let features = "core" :: List.concat !!features in + Primus.Components.register_generic ~package:"bap" "lisp-type-checker" + (module TypeErrorSummary) + ~desc:"Typechecks program and outputs the summary in the standard output."; + Primus.Machine.add_component (module LispCore) [@warning "-D"]; + Primus.Components.register_generic "lisp-core" (module LispCore) + ~package:"bap" + ~desc:"Initializes Primus Lisp core. Forwards Lisp message to \ + the BAP log subsystem and enables propagation of \ + observations to signals."; + Primus.Machine.add_component (module TypeErrorPrinter) [@warning "-D"]; + Primus.Components.register_generic ~package:"bap" "lisp-type-error-printer" + (module TypeErrorPrinter) + ~desc:"Prints Primus Lisp type errors into the standard output."; + Channels.init !!redirects; + Primitives.init (); + Semantics_primitives.provide (); + Semantics.load_lisp_unit ~paths ~features; + let stdout = Option.map !!semantics_stdout ~f:(fun file -> + let ch = Out_channel.create file in + let ppf = Format.formatter_of_out_channel ch in + at_exit (fun () -> + Format.pp_print_flush ppf (); + Out_channel.close ch); + ppf) in + Primus.Lisp.Semantics.enable ?stdout (); + if Poly.(!!semantics <> ["disable"]) + then Semantics.enable_lifter !!semantics; + load_lisp_program !!dump paths features diff --git a/plugins/primus_lisp/semantics/dune b/plugins/primus_lisp/semantics/dune new file mode 100644 index 000000000..ed89d9610 --- /dev/null +++ b/plugins/primus_lisp/semantics/dune @@ -0,0 +1,4 @@ +(install + (files bits.lisp dummy.lisp ieee754.lisp) + (package bap-primus-lisp) + (section (site (bap-common semantics)))) diff --git a/plugins/primus_lisp/site-lisp/dune b/plugins/primus_lisp/site-lisp/dune new file mode 100644 index 000000000..7aac0d290 --- /dev/null +++ b/plugins/primus_lisp/site-lisp/dune @@ -0,0 +1,24 @@ +(install + (files ascii.lisp + atoi.lisp + char.lisp + errno.lisp + floats.lisp + getopt.lisp + ieee754.lisp + libc-init.lisp + libintl.lisp + limit-malloc.lisp + llvm-x86-64-floats.lisp + locale.lisp + memory-allocator.lisp + posix.lisp + setjmp.lisp + simple-memory-allocator.lisp + stdio.lisp + stdlib.lisp + string.lisp + types.lisp + unistd.lisp) + (package bap-primus-lisp) + (section (site (bap-common lisp)))) diff --git a/plugins/primus_loader/.merlin b/plugins/primus_loader/.merlin deleted file mode 100644 index 26ef418fd..000000000 --- a/plugins/primus_loader/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -B ../../_build/plugins/primus_elf -B ../../_build/lib/bap_primus -S ../../lib/bap_primus -REC diff --git a/plugins/primus_loader/dune b/plugins/primus_loader/dune new file mode 100644 index 000000000..8bdbe588d --- /dev/null +++ b/plugins/primus_loader/dune @@ -0,0 +1,11 @@ +(library + (name bap_primus_loader_plugin) + (public_name bap-primus-loader.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-core-theory bap-primus monads core_kernel ogre)) + +(plugin + (name primus-loader) + (package bap-primus-loader) + (libraries bap-primus-loader.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_loader/primus_loader_main.ml b/plugins/primus_loader/primus_loader_main.ml index 1218fb2ae..f65755f65 100644 --- a/plugins/primus_loader/primus_loader_main.ml +++ b/plugins/primus_loader/primus_loader_main.ml @@ -56,5 +56,8 @@ let stack_base = "stack-base" ~doc:"default address of the stack base") -let () = Config.when_ready (fun {Config.get=(!!)} -> - init !!stack_size !!stack_base) +let () = Config.declare_extension + ~doc:"generic Primus dynamic loader" + ~provides:["abi"; "loader"; "primus"; "emulator"] + (fun {Config.get=(!!)} -> + init !!stack_size !!stack_base) diff --git a/plugins/primus_mark_visited/.merlin b/plugins/primus_mark_visited/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_mark_visited/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_mark_visited/dune b/plugins/primus_mark_visited/dune new file mode 100644 index 000000000..a47106fbb --- /dev/null +++ b/plugins/primus_mark_visited/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_mark_visited_plugin) + (public_name bap-primus-mark-visited.plugin) + (libraries bap bap-core-theory bap-main bap-primus-track-visited)) + +(plugin + (name primus-mark-visited) + (package bap-primus-mark-visited) + (libraries bap-primus-mark-visited.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_mark_visited/primus_mark_visited_main.ml b/plugins/primus_mark_visited/primus_mark_visited_main.ml index 4078f9231..631a65d63 100644 --- a/plugins/primus_mark_visited/primus_mark_visited_main.ml +++ b/plugins/primus_mark_visited/primus_mark_visited_main.ml @@ -7,7 +7,7 @@ Provides the $(b,bap:mark-visited) and $(b,bap:report-visited) components. open Bap_main open Bap.Std open Bap_primus.Std -include Self() +include Loggers() module ReportProgress(Machine : Primus.Machine.S) = struct open Machine.Syntax @@ -21,7 +21,9 @@ module ReportProgress(Machine : Primus.Machine.S) = struct end -let () = Extension.declare @@ fun _ -> +let () = Extension.declare + ~doc + ~provides:["primus"; "component"] @@ fun _ -> Bap_primus_track_visited.init (); Primus.Components.register_generic ~package:"bap" "report-visited" (module ReportProgress) diff --git a/plugins/primus_powerpc/dune b/plugins/primus_powerpc/dune new file mode 100644 index 000000000..62b6393e8 --- /dev/null +++ b/plugins/primus_powerpc/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_powerpc_plugin) + (public_name bap-primus-powerpc.plugin) + (libraries bap bap-primus core_kernel)) + +(plugin + (name primus-powerpc) + (package bap-primus-powerpc) + (libraries bap-primus-powerpc.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_powerpc/primus_powerpc_main.ml b/plugins/primus_powerpc/primus_powerpc_main.ml index eb00ec702..5c60bbc85 100644 --- a/plugins/primus_powerpc/primus_powerpc_main.ml +++ b/plugins/primus_powerpc/primus_powerpc_main.ml @@ -11,7 +11,9 @@ let () = Config.manpage [ all flags and CTR register to zero." ] -let () = Config.when_ready @@ fun _ -> +let () = Config.declare_extension + ~doc:"provides PPC Primus support package" + ~provides:["primus"; "powerpc"; "ppc"] @@ fun _ -> let module Component(Machine : Primus.Machine.S) = struct open Machine.Syntax module Env = Primus.Env.Make(Machine) diff --git a/plugins/primus_print/.merlin b/plugins/primus_print/.merlin deleted file mode 100644 index 2f96c4be0..000000000 --- a/plugins/primus_print/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -B ../../_build/lib/bap_primus -B ../../_build/lib/bare -REC \ No newline at end of file diff --git a/plugins/primus_print/dune b/plugins/primus_print/dune new file mode 100644 index 000000000..d0c29a1d4 --- /dev/null +++ b/plugins/primus_print/dune @@ -0,0 +1,19 @@ +(library + (name bap_primus_print_plugin) + (public_name bap-primus-print.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-future + bap-knowledge + bap-primus + bare + core_kernel + monads)) + +(plugin + (name primus-print) + (package bap-primus-print) + (libraries bap-primus-print.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_print/primus_print_main.ml b/plugins/primus_print/primus_print_main.ml index d445d1c7f..0fc003c8f 100644 --- a/plugins/primus_print/primus_print_main.ml +++ b/plugins/primus_print/primus_print_main.ml @@ -192,4 +192,7 @@ let start_monitoring {Config.get=(!)} = Stream.observe (Primus.Observation.Provider.data m) (print_event out m)) -let () = Config.when_ready start_monitoring +let () = Config.declare_extension + ~doc:"prints Primus states and observations" + ~provides:["primus"; "printer"; "observations"] + start_monitoring diff --git a/plugins/primus_promiscuous/.merlin b/plugins/primus_promiscuous/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_promiscuous/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_promiscuous/dune b/plugins/primus_promiscuous/dune new file mode 100644 index 000000000..298a1d2df --- /dev/null +++ b/plugins/primus_promiscuous/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_promiscuous_plugin) + (public_name bap-primus-promiscuous.plugin) + (libraries bap bap-primus core_kernel monads)) + +(plugin + (name primus-promiscuous) + (package bap-primus-promiscuous) + (libraries bap-primus-promiscuous.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_promiscuous/primus_promiscuous_main.ml b/plugins/primus_promiscuous/primus_promiscuous_main.ml index f2a480737..e1779347c 100644 --- a/plugins/primus_promiscuous/primus_promiscuous_main.ml +++ b/plugins/primus_promiscuous/primus_promiscuous_main.ml @@ -237,13 +237,16 @@ manpage [ let enabled = flag "mode" ~doc:"(DEPRECATED) Enable the mode." -let () = when_ready (fun {get=(!!)} -> - Primus.Components.register_generic "promiscuous-path-explorer" - (module Forker) ~package - ~desc:"Forces execution of all linearly independent paths \ - by forcefully flipping the branch conditions."; - Primus.Components.register_generic "division-by-zero-handler" - (module EnableDivisionByZero) ~package - ~desc:"Disables division by zero errors."; - - if !!enabled then enable_legacy_promiscuous_mode ()); +let () = declare_extension + ~doc:"enables the promiscuous mode of execution" + ~provides:["primus"; "fuzzer"] + (fun {get=(!!)} -> + Primus.Components.register_generic "promiscuous-path-explorer" + (module Forker) ~package + ~desc:"Forces execution of all linearly independent paths \ + by forcefully flipping the branch conditions."; + Primus.Components.register_generic "division-by-zero-handler" + (module EnableDivisionByZero) ~package + ~desc:"Disables division by zero errors."; + + if !!enabled then enable_legacy_promiscuous_mode ()); diff --git a/plugins/primus_propagate_taint/.merlin b/plugins/primus_propagate_taint/.merlin deleted file mode 100644 index 7fa1e8e0e..000000000 --- a/plugins/primus_propagate_taint/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -REC -B ../../_build/plugins/primus_propagate_taint -B ../../_build/lib/bap_primus -B ../../_build/lib/bap_taint diff --git a/plugins/primus_propagate_taint/dune b/plugins/primus_propagate_taint/dune new file mode 100644 index 000000000..5dd55ed62 --- /dev/null +++ b/plugins/primus_propagate_taint/dune @@ -0,0 +1,22 @@ +(library + (name bap_primus_propagate_taint_plugin) + (public_name bap-primus-propagate-taint.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-future + bap-knowledge + bap-microx + bap-primus + bap-taint + core_kernel + graphlib + monads + regular)) + +(plugin + (name primus-propagate-taint) + (package bap-primus-propagate-taint) + (libraries bap-primus-propagate-taint.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_propagate_taint/primus_propagate_taint_main.ml b/plugins/primus_propagate_taint/primus_propagate_taint_main.ml index 3a915e7b1..0ed15f0d2 100644 --- a/plugins/primus_propagate_taint/primus_propagate_taint_main.ml +++ b/plugins/primus_propagate_taint/primus_propagate_taint_main.ml @@ -276,9 +276,9 @@ let marking_disabled = flag "no-marks" attributes. The option is only valid when the $(b,run) option is specified. " ^ soft_deprecation_notice) -;; - -when_ready begin fun {get=is} -> +let () = declare_extension + ~doc:"compatibility layer for the old traint propagation framework" + ~provides:["dataflow"; "pass"; "analysis"; "taint"; "primus"] @@ fun {get=is} -> if is injection_enabled || is projection_enabled then if is enabled || is marking_disabled then invalid_arg "Incorrect mix of old and new parameters"; @@ -308,4 +308,3 @@ when_ready begin fun {get=is} -> if not (is marking_disabled) then enable_projection (); end -end diff --git a/plugins/primus_random/.merlin b/plugins/primus_random/.merlin deleted file mode 100644 index 73b2dc662..000000000 --- a/plugins/primus_random/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG zarith -REC diff --git a/plugins/primus_random/dune b/plugins/primus_random/dune new file mode 100644 index 000000000..f72d7314c --- /dev/null +++ b/plugins/primus_random/dune @@ -0,0 +1,19 @@ +(library + (name bap_primus_random_plugin) + (public_name bap-primus-random.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-main + bap-primus + bitvec + bitvec-sexp + core_kernel + zarith + bap-core-theory)) + +(plugin + (name primus-random) + (package bap-primus-random) + (libraries bap-primus-random.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_region/dune b/plugins/primus_region/dune new file mode 100644 index 000000000..271e3a466 --- /dev/null +++ b/plugins/primus_region/dune @@ -0,0 +1,11 @@ +(library + (name bap_primus_region_plugin) + (public_name bap-primus-region.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-core-theory bap-primus monads core_kernel)) + +(plugin + (name primus-region) + (package bap-primus-region) + (libraries bap-primus-region.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_region/primus_region_main.ml b/plugins/primus_region/primus_region_main.ml index ed2292717..74f94f3e7 100644 --- a/plugins/primus_region/primus_region_main.ml +++ b/plugins/primus_region/primus_region_main.ml @@ -195,7 +195,10 @@ let desc = another." let () = Config.manpage [`S "DESCRIPTION"; `P desc] -let () = Config.when_ready @@ fun _ -> +let () = Config.declare_extension + ~doc:"provides Primus Lisp library for manipulating program regions" + ~provides:["primus"; "primus-library"; "regions"; "interval-trees"] + @@ fun _ -> Primus.Machine.add_component (module Main) [@warning "-D"]; Primus.Components.register_generic "lisp-regions" (module Main) ~package:"bap" diff --git a/plugins/primus_round_robin/.merlin b/plugins/primus_round_robin/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_round_robin/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_round_robin/dune b/plugins/primus_round_robin/dune new file mode 100644 index 000000000..d9f44846a --- /dev/null +++ b/plugins/primus_round_robin/dune @@ -0,0 +1,11 @@ +(library + (name bap_primus_round_robin_plugin) + (public_name bap-primus-round-robin-scheduler.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-future bap-primus monads core_kernel)) + +(plugin + (name primus-round-robin) + (package bap-primus-round-robin-scheduler) + (libraries bap-primus-round-robin-scheduler.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_round_robin/primus_round_robin_main.ml b/plugins/primus_round_robin/primus_round_robin_main.ml index 1d3d9a14b..5076ef8c2 100644 --- a/plugins/primus_round_robin/primus_round_robin_main.ml +++ b/plugins/primus_round_robin/primus_round_robin_main.ml @@ -85,4 +85,7 @@ manpage [ let enabled = flag "scheduler" ~doc:"Enable the scheduler." -let () = when_ready (fun {get=(!!)} -> register !!enabled) +let () = declare_extension + ~doc:"schedules Primus machines in the BFS order" + ~provides:["primus"; "scheduler"] + (fun {get=(!!)} -> register !!enabled) diff --git a/plugins/primus_symbolic_executor/.merlin b/plugins/primus_symbolic_executor/.merlin deleted file mode 100644 index 193629af6..000000000 --- a/plugins/primus_symbolic_executor/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../lib/bap_primus_track_visited -PKG z3 zarith \ No newline at end of file diff --git a/plugins/primus_symbolic_executor/dune b/plugins/primus_symbolic_executor/dune new file mode 100644 index 000000000..f0b9539f6 --- /dev/null +++ b/plugins/primus_symbolic_executor/dune @@ -0,0 +1,22 @@ +(library + (name bap_primus_symbolic_executor_plugin) + (public_name bap-primus-symbolic-executor.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-main + bap-primus + bap-primus-track-visited + bitvec + core_kernel + monads + regular + z3 + zarith + bap-core-theory)) + +(plugin + (name primus-symbolic-executor) + (package bap-primus-symbolic-executor) + (libraries bap-primus-symbolic-executor.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_symbolic_executor/lisp/dune b/plugins/primus_symbolic_executor/lisp/dune new file mode 100644 index 000000000..ab6bad7df --- /dev/null +++ b/plugins/primus_symbolic_executor/lisp/dune @@ -0,0 +1,4 @@ +(install + (files symbolic-stdio.lisp symbolic-stdlib.lisp) + (package bap-primus-symbolic-executor) + (section (site (bap-common site_lisp)))) diff --git a/plugins/primus_symbolic_executor/primus_symbolic_executor_main.ml b/plugins/primus_symbolic_executor/primus_symbolic_executor_main.ml index 35733d635..3596259a4 100644 --- a/plugins/primus_symbolic_executor/primus_symbolic_executor_main.ml +++ b/plugins/primus_symbolic_executor/primus_symbolic_executor_main.ml @@ -1026,7 +1026,9 @@ module Primitives(Machine : Primus.Machine.S) = struct ] end -let () = Extension.declare @@ fun ctxt -> +let () = Extension.declare + ~doc:"provides a Primus symbolic executor" + ~provides:["primus"; "symbolic-executor"] @@ fun ctxt -> let open Extension.Syntax in SMT.set_timeout (ctxt-->timeout); Primus.Components.register_generic "symbolic-computer" diff --git a/plugins/primus_systems/.merlin b/plugins/primus_systems/.merlin deleted file mode 100644 index 2ba616962..000000000 --- a/plugins/primus_systems/.merlin +++ /dev/null @@ -1 +0,0 @@ -REC diff --git a/plugins/primus_systems/dune b/plugins/primus_systems/dune new file mode 100644 index 000000000..cce1845ce --- /dev/null +++ b/plugins/primus_systems/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_systems_plugin) + (public_name bap-primus-systems.plugin) + (libraries bap-knowledge bap-main bap-primus core_kernel)) + +(plugin + (name primus-systems) + (package bap-primus-systems) + (libraries bap-primus-systems.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_systems/systems/dune b/plugins/primus_systems/systems/dune new file mode 100644 index 000000000..8379cbfbe --- /dev/null +++ b/plugins/primus_systems/systems/dune @@ -0,0 +1,4 @@ +(install + (files (core.asd as systems/core.asd)) + (package bap-primus-systems) + (section (site (bap-common primus)))) diff --git a/plugins/primus_taint/.merlin b/plugins/primus_taint/.merlin deleted file mode 100644 index 2bcdb9022..000000000 --- a/plugins/primus_taint/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -REC -B ../../_build/plugins/primus_taint -B ../../_build/lib/bap_primus -B ../../_build/lib/bap_taint - -B . -B ../../lib/bap_primus -B ../../lib/bap_taint diff --git a/plugins/primus_taint/dune b/plugins/primus_taint/dune new file mode 100644 index 000000000..2a3a5f92d --- /dev/null +++ b/plugins/primus_taint/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_taint_plugin) + (public_name bap-primus-taint.plugin) + (libraries bap bap-primus bap-taint core_kernel regular monads)) + +(plugin + (name primus-taint) + (package bap-primus-taint) + (libraries bap-primus-taint.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_taint/lisp/dune b/plugins/primus_taint/lisp/dune new file mode 100644 index 000000000..766adeed8 --- /dev/null +++ b/plugins/primus_taint/lisp/dune @@ -0,0 +1,4 @@ +(install + (files sensitive-sinks.lisp taint.lisp taint-sources.lisp) + (package bap-primus-taint) + (section (site (bap-common site_lisp)))) diff --git a/plugins/primus_taint/primus_taint_main.ml b/plugins/primus_taint/primus_taint_main.ml index b60680f6c..7058db06b 100644 --- a/plugins/primus_taint/primus_taint_main.ml +++ b/plugins/primus_taint/primus_taint_main.ml @@ -271,27 +271,30 @@ let collectors = [ let enable_gc = param (enum collectors) ~default:false "gc" ~doc:"Picks a taint garbage collector" -let () = when_ready (fun {get=(!!)} -> - Primus.Machine.add_component (module Setup) [@warning "-D"]; - Primus.Components.register_generic "taint-primitives" - (module Setup) - ~package:"bap" - ~desc:"Exposes Primus Lisp primitives that controls the \ - Primus Taint Engine." ; - Primus.Machine.add_component (module Signals) [@warning "-D"]; - Primus.Components.register_generic - ~package:"bap" "taint-signals" - (module Signals) - ~desc:"Reflects Primus Taint observations to Lisp signals." ; - Primus_taint_policies.init (); - Primus.Components.register_generic - ~package:"bap" "conservative-garbage-collector" - (module Taint.Gc.Conservative) - ~desc:"Enables taint garbage collector. The component scans \ - the memory and registers and deletes taints that are no \ - longer reachable."; - - enable_policy_selectors !!policy; - if !!enable_gc - then Primus.Machine.add_component - (module Taint.Gc.Conservative) [@warning "-D"]) +let () = declare_extension + ~doc:"manages the Primus Taint Analysis framework" + ~provides:["dataflow"; "pass"; "taint"; "primus"; "primus-lisp"] + @@ fun {get=(!!)} -> + Primus.Machine.add_component (module Setup) [@warning "-D"]; + Primus.Components.register_generic "taint-primitives" + (module Setup) + ~package:"bap" + ~desc:"Exposes Primus Lisp primitives that controls the \ + Primus Taint Engine." ; + Primus.Machine.add_component (module Signals) [@warning "-D"]; + Primus.Components.register_generic + ~package:"bap" "taint-signals" + (module Signals) + ~desc:"Reflects Primus Taint observations to Lisp signals." ; + Primus_taint_policies.init (); + Primus.Components.register_generic + ~package:"bap" "conservative-garbage-collector" + (module Taint.Gc.Conservative) + ~desc:"Enables taint garbage collector. The component scans \ + the memory and registers and deletes taints that are no \ + longer reachable."; + + enable_policy_selectors !!policy; + if !!enable_gc + then Primus.Machine.add_component + (module Taint.Gc.Conservative) [@warning "-D"] diff --git a/plugins/primus_test/dune b/plugins/primus_test/dune new file mode 100644 index 000000000..718f2ea69 --- /dev/null +++ b/plugins/primus_test/dune @@ -0,0 +1,18 @@ +(library + (name bap_primus_test_plugin) + (public_name bap-primus-test.plugin) + (libraries + bap + bap-primus + bitvec + bitvec-order + core_kernel + monads + regular + zarith)) + +(plugin + (name primus-test) + (package bap-primus-test) + (libraries bap-primus-test.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_test/lisp/dune b/plugins/primus_test/lisp/dune new file mode 100644 index 000000000..17657cf7d --- /dev/null +++ b/plugins/primus_test/lisp/dune @@ -0,0 +1,8 @@ +(install + (files check-value.lisp + incident.lisp + memcheck.lisp + memcheck-malloc.lisp + warn-unused.lisp) + (package bap-primus-test) + (section (site (bap-common site_lisp)))) diff --git a/plugins/primus_test/primus_test_main.ml b/plugins/primus_test/primus_test_main.ml index d4909f0e4..61996ce44 100644 --- a/plugins/primus_test/primus_test_main.ml +++ b/plugins/primus_test/primus_test_main.ml @@ -336,4 +336,7 @@ manpage [ ];; -when_ready (fun _ -> main ()) +declare_extension + ~doc:"provides primitives for Primus Testing and Verification Frameworkd" + ~provides:["primus"; "primus-lisp"; "primus-library"; "verification"] + (fun _ -> main ()) diff --git a/plugins/primus_wandering/.merlin b/plugins/primus_wandering/.merlin deleted file mode 100644 index 00cdb112f..000000000 --- a/plugins/primus_wandering/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_primus diff --git a/plugins/primus_wandering/dune b/plugins/primus_wandering/dune new file mode 100644 index 000000000..1eea19f8d --- /dev/null +++ b/plugins/primus_wandering/dune @@ -0,0 +1,10 @@ +(library + (name bap_primus_wandering_plugin) + (public_name bap-primus-wandering-scheduler.plugin) + (libraries bap bap-future bap-primus core_kernel monads)) + +(plugin + (name primus-wandering) + (package bap-primus-wandering-scheduler) + (libraries bap-primus-wandering-scheduler.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_wandering/primus_wandering_main.ml b/plugins/primus_wandering/primus_wandering_main.ml index c57847024..d8a7a0be3 100644 --- a/plugins/primus_wandering/primus_wandering_main.ml +++ b/plugins/primus_wandering/primus_wandering_main.ml @@ -102,4 +102,7 @@ let seed = param ~doc:"random generator seed" int "seed" -let () = when_ready (fun {get=(!!)} -> register !!enabled !!seed) +let () = declare_extension + ~doc:"schedules Primus machines in a random order" + ~provides:["primus"; "scheduler"] + (fun {get=(!!)} -> register !!enabled !!seed) diff --git a/plugins/primus_x86/.merlin b/plugins/primus_x86/.merlin deleted file mode 100644 index db0178b61..000000000 --- a/plugins/primus_x86/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG bap-x86-cpu -PKG bap-primus diff --git a/plugins/primus_x86/dune b/plugins/primus_x86/dune new file mode 100644 index 000000000..30a18ef49 --- /dev/null +++ b/plugins/primus_x86/dune @@ -0,0 +1,11 @@ +(library + (name bap_primus_x86_plugin) + (public_name bap-primus-x86.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-core-theory bap-primus bap-x86 regular)) + +(plugin + (name primus-x86) + (package bap-primus-x86) + (libraries bap-primus-x86.plugin) + (site (bap-common plugins))) diff --git a/plugins/primus_x86/primus_x86_main.ml b/plugins/primus_x86/primus_x86_main.ml index d90028a0c..a92253113 100644 --- a/plugins/primus_x86/primus_x86_main.ml +++ b/plugins/primus_x86/primus_x86_main.ml @@ -27,4 +27,7 @@ Config.manpage [ all flag registers to zero." ];; -Config.when_ready init +Config.declare_extension + ~doc:"x86 Primus Support package" + ~provides:["abi"; "x86"; "primus"] + init diff --git a/plugins/print/.merlin b/plugins/print/.merlin deleted file mode 100644 index 23525ba9f..000000000 --- a/plugins/print/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -PKG cmdliner - -B ../../_build/lib/bap_demangle -REC \ No newline at end of file diff --git a/plugins/print/dune b/plugins/print/dune new file mode 100644 index 000000000..d0af917a3 --- /dev/null +++ b/plugins/print/dune @@ -0,0 +1,21 @@ +(library + (name print) + (public_name bap-print.plugin) + (libraries + bap + bap-core-theory + bap-demangle + bap-knowledge + core_kernel + core_kernel.caml_unix + graphlib + ogre + regular + re.pcre + text-tags)) + +(plugin + (name print) + (package bap-print) + (libraries bap-print.plugin) + (site (bap-common plugins))) diff --git a/plugins/print/print_main.ml b/plugins/print/print_main.ml index c4e18b66f..59b3c0884 100644 --- a/plugins/print/print_main.ml +++ b/plugins/print/print_main.ml @@ -511,7 +511,7 @@ let main attrs ansi_colors demangle symbol_fmts subs secs patterns doms = ~desc:"print the file specification in the OGRE format" ~ver "ogre" pp_spec let () = - Config.when_ready @@ fun _ -> + Config.declare_extension @@ fun _ -> let open Adt in let desc = "Abstract Data Type pretty printing format" in let ver = Program.version and name = "adt" in @@ -588,7 +588,10 @@ let () = printed." in Config.(param (some (list string)) ~as_flag:(Some []) ~doc ~docv:"SEMANTICS-LIST" "semantics") in - Config.when_ready (fun {Config.get=(!)} -> - main !bir_attr !ansi_colors !demangle !print_symbols !subs !secs - !patterns - !semantics) + Config.declare_extension + ~doc:"prints the project in various formats" + ~provides:["printer"] + (fun {Config.get=(!)} -> + main !bir_attr !ansi_colors !demangle !print_symbols !subs !secs + !patterns + !semantics) diff --git a/plugins/propagate_taint/.merlin b/plugins/propagate_taint/.merlin deleted file mode 100644 index 9eb1d80ec..000000000 --- a/plugins/propagate_taint/.merlin +++ /dev/null @@ -1,4 +0,0 @@ -REC -PKG cmdliner -B ../../_build/plugins/propagate_taint -B ../../_build/lib/microx \ No newline at end of file diff --git a/plugins/propagate_taint/dune b/plugins/propagate_taint/dune new file mode 100644 index 000000000..55a3ce553 --- /dev/null +++ b/plugins/propagate_taint/dune @@ -0,0 +1,18 @@ +(library + (name bap_propagate_taint_plugin) + (public_name bap-taint-propagator.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-microx + core_kernel + graphlib + monads + regular)) + +(plugin + (name propagate-taint) + (package bap-taint-propagator) + (libraries bap-taint-propagator.plugin) + (site (bap-common plugins))) diff --git a/plugins/propagate_taint/propagate_taint_main.ml b/plugins/propagate_taint/propagate_taint_main.ml index 78dff78a5..4bebc0498 100644 --- a/plugins/propagate_taint/propagate_taint_main.ml +++ b/plugins/propagate_taint/propagate_taint_main.ml @@ -324,9 +324,12 @@ module Cmdline = struct let () = let reg = policy "reg" "registers" `Random in let mem = policy "mem" "memory locations" `Random in - Config.when_ready (fun {Config.get=(!)} -> - let args = create !max_trace !max_loop !deterministic - !random_seed !reg !mem !interesting !print_coverage in - Project.register_pass (main args)) + Config.declare_extension + ~doc:"the legacy taint propagation pass" + ~provides:["taint"; "pass"] + (fun {Config.get=(!)} -> + let args = create !max_trace !max_loop !deterministic + !random_seed !reg !mem !interesting !print_coverage in + Project.register_pass (main args)) end diff --git a/plugins/radare2/.merlin b/plugins/radare2/.merlin deleted file mode 100644 index f8f87025d..000000000 --- a/plugins/radare2/.merlin +++ /dev/null @@ -1,6 +0,0 @@ -PKG yojson -PKG zarith -B ../../_build/plugins/radare2 -B ../../lib/bap_relation -B ../../lib/arm -REC diff --git a/plugins/radare2/dune b/plugins/radare2/dune new file mode 100644 index 000000000..3cc0f6ac1 --- /dev/null +++ b/plugins/radare2/dune @@ -0,0 +1,23 @@ +(library + (name bap_radare2_plugin) + (public_name bap-radare2.plugin) + (libraries + bap + bap-arm + bap-core-theory + bap-future + bap-knowledge + bap-relation + bitvec + core_kernel + core_kernel.caml_unix + regular + re.pcre + yojson + zarith)) + +(plugin + (name radare2) + (package bap-radare2) + (libraries bap-radare2.plugin) + (site (bap-common plugins))) diff --git a/plugins/radare2/radare2_main.ml b/plugins/radare2/radare2_main.ml index 736d22220..f45a9f28c 100644 --- a/plugins/radare2/radare2_main.ml +++ b/plugins/radare2/radare2_main.ml @@ -125,4 +125,7 @@ let () = `S "SEE ALSO"; `P "$(b,bap-plugin-objdump)(1)" ]; - Config.when_ready (fun {get=_} -> main ()) + Config.declare_extension + ~doc:"extracts symbols and function starts using radare2" + ~provides:["symbolizer"; "radare2"] + (fun {get=_} -> main ()) diff --git a/plugins/raw/dune b/plugins/raw/dune new file mode 100644 index 000000000..787de3f07 --- /dev/null +++ b/plugins/raw/dune @@ -0,0 +1,12 @@ +(library + (name bap_raw_plugin) + (public_name bap-raw.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-main bitvec + core_kernel core_kernel.caml_unix ogre)) + +(plugin + (name raw) + (package bap-raw) + (libraries bap-raw.plugin) + (site (bap-common plugins))) diff --git a/plugins/read_symbols/.merlin b/plugins/read_symbols/.merlin deleted file mode 100644 index fa3483337..000000000 --- a/plugins/read_symbols/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -PKG cmdliner -REC \ No newline at end of file diff --git a/plugins/read_symbols/dune b/plugins/read_symbols/dune new file mode 100644 index 000000000..d769e68f3 --- /dev/null +++ b/plugins/read_symbols/dune @@ -0,0 +1,16 @@ +(library + (name bap_read_symbols_plugin) + (public_name bap-symbol-reader.plugin) + (libraries + bap-core-theory + bap-knowledge + bap-main + bap-relation + bitvec + core_kernel)) + +(plugin + (name read-symbols) + (package bap-symbol-reader) + (libraries bap-symbol-reader.plugin) + (site (bap-common plugins))) diff --git a/plugins/recipe_command/dune b/plugins/recipe_command/dune new file mode 100644 index 000000000..0b323bb9e --- /dev/null +++ b/plugins/recipe_command/dune @@ -0,0 +1,10 @@ +(library + (name bap_recipe_command_plugin) + (public_name bap-recipe-command.plugin) + (libraries bap-recipe bap-main base)) + +(plugin + (name recipe-command) + (package bap-recipe-command) + (libraries bap-recipe-command.plugin) + (site (bap-common plugins))) diff --git a/plugins/recipe_command/recipe_command_main.ml b/plugins/recipe_command/recipe_command_main.ml index 363d5b448..cf6247d13 100644 --- a/plugins/recipe_command/recipe_command_main.ml +++ b/plugins/recipe_command/recipe_command_main.ml @@ -181,3 +181,7 @@ let () = Extension.Error.register_printer @@ function | Recipe_error err -> Some (Stdlib.Format.asprintf "%a" Recipe.pp_error err) | _ -> None + +let () = Extension.declare ~doc:"provides the recipe command" + ~provides:["command"; "recipe"] + (fun _ -> Ok ()) diff --git a/plugins/relocatable/.merlin b/plugins/relocatable/.merlin deleted file mode 100644 index a12bea4bc..000000000 --- a/plugins/relocatable/.merlin +++ /dev/null @@ -1,8 +0,0 @@ -B ../../_build/plugins/relocatable -B ../../lib/arm -B ../../lib/bap_mips -B ../../lib/bap_powerpc -B ../../lib/x86_cpu/ -S . - -REC \ No newline at end of file diff --git a/plugins/relocatable/dune b/plugins/relocatable/dune new file mode 100644 index 000000000..af2d81dd8 --- /dev/null +++ b/plugins/relocatable/dune @@ -0,0 +1,24 @@ +(library + (name bap_relocatable_plugin) + (public_name bap-relocatable.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-arm + bap-core-theory + bap-knowledge + bap-main + bap-powerpc + bap-x86 + bitvec + bitvec-order + bitvec-sexp + core_kernel + monads + ogre)) + +(plugin + (name relocatable) + (package bap-relocatable) + (libraries bap-relocatable.plugin) + (site (bap-common plugins))) diff --git a/plugins/report/dune b/plugins/report/dune new file mode 100644 index 000000000..272d3ce27 --- /dev/null +++ b/plugins/report/dune @@ -0,0 +1,11 @@ +(library + (name bap_report_plugin) + (public_name bap-report.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-future core_kernel core_kernel.caml_unix)) + +(plugin + (name report) + (package bap-report) + (libraries bap-report.plugin) + (site (bap-common plugins))) diff --git a/plugins/report/report_main.ml b/plugins/report/report_main.ml index 3fa955f27..ca7f96c26 100644 --- a/plugins/report/report_main.ml +++ b/plugins/report/report_main.ml @@ -190,6 +190,9 @@ let print_events () = let enabled = Config.flag "progress" ~doc:"Show progress bars" let events = Config.flag "events" ~doc:"Output progress events" let () = - Config.when_ready (fun {Config.get=(!!)} -> - if !!enabled then enable (); - if !!events then print_events ()); + Config.declare_extension + ~doc:"reports program status using progress bars" + ~provides:["report"; "visualization"] + (fun {Config.get=(!!)} -> + if !!enabled then enable (); + if !!events then print_events ()); diff --git a/plugins/riscv/.merlin b/plugins/riscv/.merlin deleted file mode 100644 index 20c54640e..000000000 --- a/plugins/riscv/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -B ../../lib/bap_riscv -REC diff --git a/plugins/riscv/dune b/plugins/riscv/dune new file mode 100644 index 000000000..41aab69c9 --- /dev/null +++ b/plugins/riscv/dune @@ -0,0 +1,22 @@ +(library + (name bap_riscv_plugin) + (public_name bap-riscv.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-c + bap-core-theory + bap-knowledge + bap-main + bap-riscv + core_kernel + monads + ogre)) + +(plugin + (name riscv) + (package bap-riscv) + (libraries bap-riscv.plugin) + (site (bap-common plugins))) diff --git a/plugins/riscv/riscv_main.ml b/plugins/riscv/riscv_main.ml index 6b80e309a..7f2c1e8b4 100644 --- a/plugins/riscv/riscv_main.ml +++ b/plugins/riscv/riscv_main.ml @@ -13,6 +13,8 @@ module Dis = Disasm_expert.Basic type Extension.Error.t += Unknown_backend of string let provides = [ + "semantics"; + "lifter"; "riscv"; "riscv64"; "riscv32"; @@ -144,4 +146,5 @@ let main ctxt = | Some s -> Error (Unknown_backend s) let () = Bap_main.Extension.declare main + ~doc:"provides RISCV semantics" ~provides diff --git a/plugins/riscv/semantics/dune b/plugins/riscv/semantics/dune new file mode 100644 index 000000000..0f0aa65b4 --- /dev/null +++ b/plugins/riscv/semantics/dune @@ -0,0 +1,4 @@ +(install + (files riscv.lisp) + (package bap-riscv) + (section (site (bap-common semantics)))) diff --git a/plugins/run/.merlin b/plugins/run/.merlin deleted file mode 100644 index 3637f16f5..000000000 --- a/plugins/run/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_primus -B ../../_build/plugins/run \ No newline at end of file diff --git a/plugins/run/dune b/plugins/run/dune new file mode 100644 index 000000000..7f4a73dcd --- /dev/null +++ b/plugins/run/dune @@ -0,0 +1,18 @@ +(library + (name bap_run_plugin) + (public_name bap-run.plugin) + (libraries + bap + bap-core-theory + bap-knowledge + bap-primus + core_kernel + graphlib + monads + regular)) + +(plugin + (name run) + (package bap-run) + (libraries bap-run.plugin) + (site (bap-common plugins))) diff --git a/plugins/run/run_main.ml b/plugins/run/run_main.ml index e66d67c26..f6b90c279 100644 --- a/plugins/run/run_main.ml +++ b/plugins/run/run_main.ml @@ -353,9 +353,12 @@ let deps = [ ] let () = - Config.when_ready (fun conf -> - Project.register_pass ~deps (main conf); - Primus.Machine.add_component (module Visited) [@warning "-D"]; - Primus.Components.register_generic "records-visited" (module Visited) - ~internal:true - ~package:"run") + Config.declare_extension + ~doc:"emulates the program using Primus" + ~provides:["pass"; "primus"; "emulator"; "microexecution"] + (fun conf -> + Project.register_pass ~deps (main conf); + Primus.Machine.add_component (module Visited) [@warning "-D"]; + Primus.Components.register_generic "records-visited" (module Visited) + ~internal:true + ~package:"run") diff --git a/plugins/specification/dune b/plugins/specification/dune new file mode 100644 index 000000000..3c6fa97b1 --- /dev/null +++ b/plugins/specification/dune @@ -0,0 +1,10 @@ +(library + (name specification) + (public_name bap-specification.plugin) + (libraries bap core_kernel bap-main ogre regular)) + +(plugin + (name specification) + (package bap-specification) + (libraries bap-specification.plugin) + (site (bap-common plugins))) diff --git a/plugins/specification/specification_main.ml b/plugins/specification/specification_main.ml index ba006f93e..7ac945a08 100644 --- a/plugins/specification/specification_main.ml +++ b/plugins/specification/specification_main.ml @@ -82,3 +82,8 @@ let string_of_problem = function let () = Extension.Error.register_printer @@ function | Fail p -> Some (string_of_problem p) | _ -> None + + +let () = Extension.declare ~doc:"provides the specification command" + ~provides:["command"; "specification"; "ogre"] + (fun _ -> Ok ()) diff --git a/plugins/ssa/dune b/plugins/ssa/dune new file mode 100644 index 000000000..a4a6eb36e --- /dev/null +++ b/plugins/ssa/dune @@ -0,0 +1,10 @@ +(library + (name bap_ssa_plugin) + (public_name bap-ssa.plugin) + (libraries bap bap-main)) + +(plugin + (name ssa) + (package bap-ssa) + (libraries bap-ssa.plugin) + (site (bap-common plugins))) diff --git a/plugins/ssa/ssa_main.ml b/plugins/ssa/ssa_main.ml index 5dcf1ce6b..aba5aa9e9 100644 --- a/plugins/ssa/ssa_main.ml +++ b/plugins/ssa/ssa_main.ml @@ -1,16 +1,14 @@ -open Bap.Std -include Self() +let provides = ["pass"; "analysis"; "ssa"] +let doc = {| +# DESCRIPTION -let main = Project.map_program ~f:(Term.map sub_t ~f:Sub.ssa) +Translates the whole program into the SSA form. -;; -Config.manpage [ - `S "SYNOPSIS"; - `Pre " - $(b,mname) -"; - `S "DESCRIPTION"; - `P "Translates the whole program into the SSA form"; -] +]|} -let () = Config.when_ready (fun _ -> Project.register_pass main);; +open Bap.Std + +let main = Project.map_program ~f:(Term.map sub_t ~f:Sub.ssa) +let () = Bap_main.Extension.declare ~doc ~provides @@ fun _ -> + Project.register_pass main; + Ok () diff --git a/plugins/strings/.merlin b/plugins/strings/.merlin deleted file mode 100644 index ec5a0b276..000000000 --- a/plugins/strings/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -REC -B ../../_build/lib/bap_strings -B ../../_build/lib/beagle diff --git a/plugins/strings/dune b/plugins/strings/dune new file mode 100644 index 000000000..b99a0fa37 --- /dev/null +++ b/plugins/strings/dune @@ -0,0 +1,10 @@ +(library + (name bap_strings_plugin) + (public_name bap-beagle-strings.plugin) + (libraries bap bap-strings bap-beagle core_kernel regular)) + +(plugin + (name strings) + (package bap-beagle-strings) + (libraries bap-beagle-strings.plugin) + (site (bap-common plugins))) diff --git a/plugins/strings/strings_main.ml b/plugins/strings/strings_main.ml index 5b513eafa..f11850517 100644 --- a/plugins/strings/strings_main.ml +++ b/plugins/strings/strings_main.ml @@ -63,6 +63,8 @@ let print {Config.get=(!!)} proj = Option.iter (Project.get proj Beagle_prey.statics) ~f:(print_str !!address) -let () = Config.when_ready (fun cfg -> - Project.register_pass ~name:"collect" (collect cfg); - Project.register_pass' ~deps:["strings-collect"] (print cfg)) +let () = Config.declare_extension + ~doc:"searches in binaries for string-like artifacts" + ~provides:["pass"; "strings"] @@ fun cfg -> + Project.register_pass ~name:"collect" (collect cfg); + Project.register_pass' ~deps:["strings-collect"] (print cfg) diff --git a/plugins/stub_resolver/.merlin b/plugins/stub_resolver/.merlin deleted file mode 100644 index 962ce741a..000000000 --- a/plugins/stub_resolver/.merlin +++ /dev/null @@ -1,3 +0,0 @@ -S . -B ../../_build/plugins/stub_resolver -REC \ No newline at end of file diff --git a/plugins/stub_resolver/dune b/plugins/stub_resolver/dune new file mode 100644 index 000000000..14209edb8 --- /dev/null +++ b/plugins/stub_resolver/dune @@ -0,0 +1,31 @@ +(library + (name bap_stub_resolver_plugin) + (public_name bap-stub-resolver.plugin) + (preprocess (pps ppx_bap)) + (wrapped false) + (libraries + bap + bap-abi + bap-core-theory + bap-knowledge + bap-main + bitvec + bitvec-order + bitvec-sexp + core_kernel + ogre)) + +(plugin + (name stub-resolver) + (package bap-stub-resolver) + (libraries bap-stub-resolver.plugin) + (site (bap-common plugins))) + +(rule + (target stub_resolver_sites.ml) + (deps stub_resolver_sites.ml.ab (alias ../../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/plugins/stub_resolver/signatures/dune b/plugins/stub_resolver/signatures/dune new file mode 100644 index 000000000..f82f0f72d --- /dev/null +++ b/plugins/stub_resolver/signatures/dune @@ -0,0 +1,4 @@ +(install + (files powerpc.stubs) + (package bap-powerpc) + (section (site (bap-common signatures)))) diff --git a/plugins/stub_resolver/stub_resolver_main.ml b/plugins/stub_resolver/stub_resolver_main.ml index e1115edf2..d6a864bf0 100644 --- a/plugins/stub_resolver/stub_resolver_main.ml +++ b/plugins/stub_resolver/stub_resolver_main.ml @@ -54,6 +54,8 @@ let known_stub_names = [ ".MIPS.stubs"; ] +let sites = Stub_resolver_sites.paths + let system_signatures_folder = Filename.concat Extension.Configuration.sysdatadir "signatures" @@ -86,7 +88,8 @@ let signatures = Extension.Configuration.parameters inferred from the word, i.e., the leading zeros are not \ discarded. By default we search in the current working \ folder, " ^ user_signatures_folder ^ ", and in " ^ - system_signatures_folder ) + system_signatures_folder ^ ", and in the following sites:" ^ + (String.concat ~sep:"; " sites)) let link_only = Extension.Configuration.parameter Extension.Type.(list string) "link-only" diff --git a/plugins/stub_resolver/stub_resolver_sites.ml.ab b/plugins/stub_resolver/stub_resolver_sites.ml.ab new file mode 100644 index 000000000..5d1477658 --- /dev/null +++ b/plugins/stub_resolver/stub_resolver_sites.ml.ab @@ -0,0 +1 @@ +let paths = [${site_signatures}] \ No newline at end of file diff --git a/plugins/systemz/.merlin b/plugins/systemz/.merlin deleted file mode 100644 index 033cc1473..000000000 --- a/plugins/systemz/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -B ../../lib/bap_systemz -REC diff --git a/plugins/systemz/dune b/plugins/systemz/dune new file mode 100644 index 000000000..999222e24 --- /dev/null +++ b/plugins/systemz/dune @@ -0,0 +1,11 @@ +(library + (name bap_systemz_plugin) + (public_name bap-systemz.plugin) + (preprocess (pps ppx_bap)) + (libraries bap bap-core-theory bap-knowledge bap-main bap-systemz)) + +(plugin + (name systemz) + (package bap-systemz) + (libraries bap-systemz.plugin) + (site (bap-common plugins))) diff --git a/plugins/systemz/systemz_main.ml b/plugins/systemz/systemz_main.ml index 8d1658ee6..f33131fa2 100644 --- a/plugins/systemz/systemz_main.ml +++ b/plugins/systemz/systemz_main.ml @@ -80,8 +80,11 @@ let main _ctxt = let provides = [ "systemz"; "lifter"; + "semantics"; ] + (* finally, let's register our extension and call the main function *) let () = Bap_main.Extension.declare main + ~doc:"provides the systemz lifter" ~provides diff --git a/plugins/taint/.merlin b/plugins/taint/.merlin deleted file mode 100644 index a30d9fd73..000000000 --- a/plugins/taint/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -PKG cmdliner \ No newline at end of file diff --git a/plugins/taint/dune b/plugins/taint/dune new file mode 100644 index 000000000..b0f23529b --- /dev/null +++ b/plugins/taint/dune @@ -0,0 +1,11 @@ +(library + (name bap_taint_plugin) + (public_name bap-taint.plugin) + (preprocess (pps ppx_bap)) + (libraries bap core_kernel regular)) + +(plugin + (name taint) + (package bap-taint) + (libraries bap-taint.plugin) + (site (bap-common plugins))) diff --git a/plugins/taint/taint_main.ml b/plugins/taint/taint_main.ml index 7e400db74..8b5c400df 100644 --- a/plugins/taint/taint_main.ml +++ b/plugins/taint/taint_main.ml @@ -97,7 +97,7 @@ module Marker = struct class main ~regs ~ptrs = object(self) inherit Term.mapper as super - method map_def def = + method! map_def def = super#map_def def |> mark Taint.reg regs |> mark Taint.ptr ptrs @@ -165,6 +165,9 @@ language follows:"; let reg = taints "reg" in let ptr = taints "ptr" in Config.manpage man; - Config.when_ready (fun {Config.get=(!)} -> main !reg !ptr) + Config.declare_extension + ~doc:"the legacy taint propagation engine" + ~provides:["taint"; "analysis"; "dataflow"] + (fun {Config.get=(!)} -> main !reg !ptr) end diff --git a/plugins/thumb/.merlin b/plugins/thumb/.merlin deleted file mode 100644 index 49313319f..000000000 --- a/plugins/thumb/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -B ../../lib/arm -REC diff --git a/plugins/thumb/dune b/plugins/thumb/dune new file mode 100644 index 000000000..7a15ab248 --- /dev/null +++ b/plugins/thumb/dune @@ -0,0 +1,19 @@ +(library + (name bap_thumb_plugin) + (public_name bap-thumb.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-arm + bap-core-theory + bap-knowledge + bap-main + bitvec + core_kernel + ogre)) + +(plugin + (name thumb) + (package bap-thumb) + (libraries bap-thumb.plugin) + (site (bap-common plugins))) diff --git a/plugins/thumb/test_sample.txt b/plugins/thumb/test_sample.txt deleted file mode 100644 index 90f0a9dd9..000000000 --- a/plugins/thumb/test_sample.txt +++ /dev/null @@ -1,591 +0,0 @@ -tADC: -4c 41 -{ - tmp := r4 - r4 := r4 + r1 + (if cf then 1 else 0) - cf := high:1[pad:33[tmp] + pad:33[r1] + (if cf then 1 else 0)] - vf := high:1[~(tmp ^ r1) & (tmp ^ r4)] - nf := high:1[r4] - zf := r4 = 0 -} -tADDi3: -4b 1d -{ - r3 := r1 + 5 - cf := r3 <$ r1 - vf := high:1[~(r1 ^ 5) & (r1 ^ r3)] - nf := high:1[r3] - zf := r3 = 0 -} -tADDi8: -11 31 -{ - tmp := r1 - r1 := r1 + 0x11 - cf := r1 <$ tmp - vf := high:1[~(tmp ^ 0x11) & (tmp ^ r1)] - nf := high:1[r1] - zf := r1 = 0 -} -tADDrr: -5d 18 -{ - r5 := r3 + r1 - cf := r5 <$ r3 - vf := high:1[~(r3 ^ r1) & (r3 ^ r5)] - nf := high:1[r5] - zf := r5 = 0 -} -tADDhirr: -cb 44 -{ - r11 := r11 + r9 -} -tADR: -11 a1 -{ - r1 := (pc & 0xFFFFFFFC) + 0x11 << 2 -} -tADDrSPi: -11 aa -{ - r2 := sp + 0x11 << 2 -} -tADDspi: -07 b0 -{ - sp := sp + 7 << 2 -} -tMOVi8: -11 27 -{ - r7 := 0x11 - nf := high:1[r7] - zf := r7 = 0 -} -tMOVr: -89 46 -{ - r9 := r1 -} -tMUL: -4f 43 -{ - r7 := r7 * r1 - nf := high:1[r7] - zf := r7 = 0 -} -tMVN: -cb 43 -{ - r3 := ~r1 - nf := high:1[r3] - zf := r3 = 0 -} -tSBC: -8b 41 -{ - tmp := r3 - r3 := r1 - r3 - (if ~cf then 1 else 0) - cf := high:1[pad:33[tmp] + pad:33[~r1] + (if cf then 1 else 0)] - vf := high:1[~(tmp ^ ~r1) & (tmp ^ r1)] - nf := high:1[r1] - zf := r1 = 0 -} -tSUBi3: -8b 1f -{ - r3 := r1 - 6 - cf := 6 <=$ r1 - vf := high:1[(r1 ^ 6) & (r1 ^ r3)] - nf := high:1[r3] - zf := r3 = 0 -} -tSUBi8: -8b 3f -{ - tmp := r7 - r7 := r7 - 0x8B - cf := 0x8B <=$ tmp - vf := high:1[(tmp ^ 0x8B) & (tmp ^ r7)] - nf := high:1[r7] - zf := r7 = 0 -} -tSUBrr: -8b 1b -{ - r3 := r1 - r6 - cf := r6 <=$ r1 - vf := high:1[(r1 ^ r6) & (r1 ^ r3)] - nf := high:1[r3] - zf := r3 = 0 -} -tSUBspi: -8b b0 -{ - sp := sp - 0xB << 2 -} -tAND: -0b 40 -{ - r3 := r3 & r1 - nf := high:1[r3] - zf := r3 = 0 -} -tASRri: -8b 10 -{ - cf := low:1[r1 >> 1] - r3 := r1 ~>> 2 - nf := high:1[r3] - zf := r3 = 0 -} -0b 10 -{ - cf := high:1[r1] - if (high:1[r1]) { - r3 := 0xFFFFFFFF - } - else { - r3 := 0 - } - nf := high:1[r3] - zf := r3 = 0 -} -tASRrr: -0b 41 -{ - if (pad:32[low:8[r1]] < 0x20) { - if (pad:32[low:8[r1]] <> 0) { - cf := low:1[r3 >> pad:32[low:8[r1]] - 1] - r3 := r3 ~>> pad:32[low:8[r1]] - } - } - else { - cf := high:1[r3] - if (high:1[r3]) { - r3 := 0xFFFFFFFF - } - else { - r3 := 0 - } - } - nf := high:1[r3] - zf := r3 = 0 -} -tBIC: -8b 43 -{ - r3 := r3 & ~r1 - nf := high:1[r3] - zf := r3 = 0 -} -tCMNz: -cb 42 -{ - tmp := r3 + r1 - cf := tmp <$ r3 - vf := high:1[~(r3 ^ r1) & (r3 ^ tmp)] - nf := high:1[tmp] - zf := tmp = 0 -} -tCMPi8: -11 29 -{ - tmp := r1 - 0x11 - cf := 0x11 <=$ r1 - vf := high:1[(r1 ^ 0x11) & (r1 ^ tmp)] - nf := high:1[tmp] - zf := tmp = 0 -} -tCMPr: -91 42 -{ - tmp := r1 - r2 - cf := r2 <=$ r1 - vf := high:1[(r1 ^ r2) & (r1 ^ tmp)] - nf := high:1[tmp] - zf := tmp = 0 -} -tCMPhir: -91 45 -{ - tmp := r9 - r2 - cf := r2 <=$ r9 - vf := high:1[(r9 ^ r2) & (r9 ^ tmp)] - nf := high:1[tmp] - zf := tmp = 0 -} -tEOR: -51 40 -{ - r1 := r1 ^ r2 - nf := high:1[r1] - zf := r1 = 0 -} -tLSLri: -51 00 -{ - cf := low:1[r2 >> 0x1F] - r1 := r2 << 1 - nf := high:1[r1] - zf := r1 = 0 -} -tLSLrr: -91 40 -{ - if (pad:32[low:8[r2]] < 0x20) { - if (pad:32[low:8[r2]] <> 0) { - cf := low:1[r1 >> 0x20 - pad:32[low:8[r2]]] - r1 := r1 << pad:32[low:8[r2]] - } - } - else { - if (pad:32[low:8[r2]] = 0x20) { - cf := low:1[r1] - } - else { - cf := 0 - } - r1 := 0 - } - nf := high:1[r1] - zf := r1 = 0 -} -tLSRri: -51 08 -{ - cf := low:1[r2] - r1 := r2 >> 1 - nf := high:1[r1] - zf := r1 = 0 -} -tLSRrr: -d1 40 -{ - if (pad:32[low:8[r2]] < 0x20) { - if (pad:32[low:8[r2]] <> 0) { - cf := low:1[r1 >> pad:32[low:8[r2]] - 1] - r1 := r1 >> pad:32[low:8[r2]] - } - } - else { - if (pad:32[low:8[r2]] = 0x20) { - cf := high:1[r1] - } - else { - cf := 0 - } - r1 := 0 - } - nf := high:1[r1] - zf := r1 = 0 -} -tORR: -11 43 -{ - r1 := r1 | r2 - nf := high:1[r1] - zf := r1 = 0 -} -tRSB: -51 42 -{ - r1 := -r2 - cf := r2 <=$ 0 - vf := high:1[r2 & r1] - nf := high:1[r1] - zf := r1 = 0 -} -tREV: -11 ba -{ - r1 := extract:7:0[r2].extract:15:8[r2].extract:23:16[r2].extract:31:24[r2] -} -tREV16: -51 ba -{ - r1 := extract:23:16[r2].extract:31:24[r2].extract:7:0[r2].extract:15:8[r2] -} -tREVSH: -d1 ba -{ - if (high:1[low:8[r2]]) { - r1 := 0xFF.0xFF.extract:7:0[r2].extract:15:8[r2] - } - else { - r1 := 0.0.extract:7:0[r2].extract:15:8[r2] - } -} -tROR: -d3 41 -{ - if (pad:32[low:4[r2]] = 0) { - cf := high:1[r3] - } - else { - cf := low:1[r3 >> pad:32[low:4[r2]] - 1] - r3 := r3 >> (pad:32[low:4[r2]] | r3) << 0x20 - pad:32[low:4[r2]] - } - nf := high:1[r3] - zf := r3 = 0 -} -tTST: -13 42 -{ - tmp := r3 & r2 - nf := high:1[tmp] - zf := tmp = 0 -} --- bits instructions -tSXTB: -57 b2 -{ - r7 := extend:32[low:8[r2]] -} -tSXTH: -17 b2 -{ - r7 := extend:32[low:16[r2]] -} -tUXTB: -d7 b2 -{ - r7 := pad:32[low:8[r2]] -} -tUXTH: -97 b2 -{ - r7 := pad:32[low:16[r2]] -} --- branch instructions (* following takes the instruction address as 0 *) -tBcc: -65 d1 -{ - if (~zf) { - pc := 0xCA - } - if (~zf) { - jmp 0xCA - } -} -7f dd -{ - if (zf | ~(nf & vf | ~nf & ~vf)) { - pc := 0xFE - } - if (zf | ~(nf & vf | ~nf & ~vf)) { - jmp 0xFE - } -} -tB: -aa e0 -{ - pc := 0x154 - jmp 0x154 -} -tBL: -01 f0 01 f8 -{ - lr := pc - 2 | 1 - pc := 0x1002 - jmp 0x1002 -} -tBLXi: -06 f0 06 e8 -{ - lr := pc - 2 | 1 - pc := 0x600C - jmp 0x600C -} -tBLXr: -d8 47 -{ - lr := pc - 2 | 1 - pc := r11 & 0xFFFFFFFE - jmp (r11 & 0xFFFFFFFE) -} -tBX: -50 47 -{ - pc := (0x7FFFFFFF & r10 >> 1) << 1 - jmp ((0x7FFFFFFF & r10 >> 1) << 1) -} --- mem instructions -tLDRi: -8a 69 -{ - r2 := mem[r1 + 0x18, el]:u32 -} -tLDRr: -0a 59 -{ - r2 := mem[r1 + r4, el]:u32 -} -tLDRpci: -ca 4f -{ - r7 := mem[pc + 0x328, el]:u32 -} -tLDRspi: -0a 99 -{ - r1 := mem[sp + 0x28, el]:u32 -} -tLDRBi: -0a 79 -{ - r2 := pad:32[mem[r1 + 4]] -} -tLDRBi: -0a 5d -{ - r2 := pad:32[mem[r1 + r4]] -} -tLDRHi: -0a 89 -{ - r2 := pad:32[mem[r1 + 8, el]:u16] -} -tLDRHr: -0a 5b -{ - r2 := pad:32[mem[r1 + r4, el]:u16] -} -tLDRSB: -0a 57 -{ - r2 := extend:32[mem[r1 + r4]] -} -tLDRSH: -0a 5f -{ - r2 := extend:32[mem[r1 + r4, el]:u16] -} -tSTRi: -0a 67 -{ - mem := mem with [r1 + 0x70, el]:u32 <- r2 -} -tSTRr: -0a 51 -{ - mem := mem with [r1 + r4, el]:u32 <- r2 -} -tSTRspi: -0a 91 -{ - mem := mem with [sp + 0x28, el]:u32 <- r1 -} -tSTRBi: -0a 71 -{ - mem := mem with [r1 + 4] <- low:8[r2] -} -tSTRBr: -0a 55 -{ - mem := mem with [r1 + r4] <- low:8[r2] -} -tSTRHi: -0a 85 -{ - mem := mem with [r1 + 0x28, el]:u16 <- low:16[r2] -} -tSTRHr: -0a 53 -{ - mem := mem with [r1 + r4, el]:u16 <- low:16[r2] -} --- multi mem instructions -tSTMIA_UPD: -0b c3 -{ - mem := mem with [r3, el]:u32 <- r0 - r3 := r3 + 4 - mem := mem with [r3, el]:u32 <- r1 - r3 := r3 + 4 - mem := mem with [r3, el]:u32 <- r3 - r3 := r3 + 4 -} -tLDMIA: -ab cd -{ - tmp := r5 - r0 := mem[tmp, el]:u32 - tmp := tmp + 4 - r1 := mem[tmp, el]:u32 - tmp := tmp + 4 - r3 := mem[tmp, el]:u32 - tmp := tmp + 4 - r5 := mem[tmp, el]:u32 - tmp := tmp + 4 - r7 := mem[tmp, el]:u32 - tmp := tmp + 4 - r5 := tmp -} -ab c8 -{ - tmp := r0 - r1 := mem[tmp, el]:u32 - tmp := tmp + 4 - r3 := mem[tmp, el]:u32 - tmp := tmp + 4 - r5 := mem[tmp, el]:u32 - tmp := tmp + 4 - r7 := mem[tmp, el]:u32 - tmp := tmp + 4 - r0 := tmp -} -tPUSH: -ab b5 -{ - tmp := sp - 0x18 - mem := mem with [tmp, el]:u32 <- r0 - tmp := tmp + 4 - mem := mem with [tmp, el]:u32 <- r1 - tmp := tmp + 4 - mem := mem with [tmp, el]:u32 <- r3 - tmp := tmp + 4 - mem := mem with [tmp, el]:u32 <- r5 - tmp := tmp + 4 - mem := mem with [tmp, el]:u32 <- r7 - tmp := tmp + 4 - mem := mem with [tmp, el]:u32 <- lr - tmp := tmp + 4 - sp := sp - 0x18 -} -tPOP: -ab bd -{ - tmp := sp - r0 := mem[tmp, el]:u32 - tmp := tmp + 4 - r1 := mem[tmp, el]:u32 - tmp := tmp + 4 - r3 := mem[tmp, el]:u32 - tmp := tmp + 4 - r5 := mem[tmp, el]:u32 - tmp := tmp + 4 - r7 := mem[tmp, el]:u32 - tmp := tmp + 4 - pc := mem[tmp, el]:u32 & 0xFFFFFFFE - tmp := tmp + 4 - sp := tmp - jmp pc -} -ab bc -{ - tmp := sp - r0 := mem[tmp, el]:u32 - tmp := tmp + 4 - r1 := mem[tmp, el]:u32 - tmp := tmp + 4 - r3 := mem[tmp, el]:u32 - tmp := tmp + 4 - r5 := mem[tmp, el]:u32 - tmp := tmp + 4 - r7 := mem[tmp, el]:u32 - tmp := tmp + 4 - sp := tmp -} \ No newline at end of file diff --git a/plugins/thumb/thumb_env.ml b/plugins/thumb/thumb_env.ml deleted file mode 100644 index 1ea96f52c..000000000 --- a/plugins/thumb/thumb_env.ml +++ /dev/null @@ -1,85 +0,0 @@ -(* This module is left temporary for backward compatibility, - we will remove it later. -*) -open Core_kernel[@@warning "-D"] -open Bap_core_theory -open KB.Syntax - -open Thumb_core - -module Env = struct - type value = r32 - type byte = r8 - type half_word = r16 - type bit = r1 - - let bit = s1 - let half_word = s16 - let value = s32 - let byte = s8 - let memory = mem - let r0 = r0 - let r1 = r1 - let r2 = r2 - let r3 = r3 - let r4 = r4 - let r5 = r5 - let r6 = r6 - let r7 = r7 - let r8 = r8 - let r9 = r9 - let r10 = r10 - let r11 = r11 - let r12 = r12 - let lr = lr - let sp = sp - let nf = nf - let zf = zf - let cf = cf - let vf = vf - let qf = qf - let tf = tf - - module Defs = Thumb_defs - - type reg_type = Defs.reg - type operand = Defs.op - - (* to elimiate ambiguity *) - let load_reg_wide (op : Defs.reg) = match op with - | `R0 -> r0 - | `R1 -> r1 - | `R2 -> r2 - | `R3 -> r3 - | `R4 -> r4 - | `R5 -> r5 - | `R6 -> r6 - | `R7 -> r7 - | `R8 -> r8 - | `R9 -> r9 - | `R10 -> r10 - | `R11 -> r11 - | `R12 -> r12 - | `LR -> lr - | `SP -> sp - | reg -> - failwithf "load_wide: unexpected or unknown register: %s" - (Sexp.to_string (Defs.sexp_of_reg reg)) - () - - let load_reg (op : Defs.reg) = match op with - | `R0 -> r0 - | `R1 -> r1 - | `R2 -> r2 - | `R3 -> r3 - | `R4 -> r4 - | `R5 -> r5 - | `R6 -> r6 - | `R7 -> r7 - | `LR -> lr - | `SP -> sp - | reg -> - failwithf "load_reg: unexpected or unknown register: %s" - (Sexp.to_string (Defs.sexp_of_reg reg)) - () -end diff --git a/plugins/thumb/thumb_main.ml b/plugins/thumb/thumb_main.ml index 85065c65e..1f4e81efd 100644 --- a/plugins/thumb/thumb_main.ml +++ b/plugins/thumb/thumb_main.ml @@ -243,6 +243,9 @@ module Main = struct KB.return Insn.empty end -let () = Bap_main.Extension.declare @@ fun _ctxt -> +let () = Bap_main.Extension.declare + ~doc:"provides semantics for Thumb instructions" + ~provides:["lifter"; "semantics"; "thumb"; "arm"] + @@ fun _ctxt -> Main.load (); Ok () diff --git a/plugins/trace/.merlin b/plugins/trace/.merlin deleted file mode 100644 index df88fce81..000000000 --- a/plugins/trace/.merlin +++ /dev/null @@ -1,2 +0,0 @@ -REC -B ../../_build/lib/bap_traces \ No newline at end of file diff --git a/plugins/trace/dune b/plugins/trace/dune new file mode 100644 index 000000000..7dcfa300a --- /dev/null +++ b/plugins/trace/dune @@ -0,0 +1,19 @@ +(library + (name bap_trace_plugin) + (public_name bap-trace.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-future + bap-plugins + bap-traces + core_kernel + core_kernel.caml_unix + regular + uri)) + +(plugin + (name trace) + (package bap-trace) + (libraries bap-trace.plugin) + (site (bap-common plugins))) diff --git a/plugins/trace/trace_main.ml b/plugins/trace/trace_main.ml index b89712b72..6dc710771 100644 --- a/plugins/trace/trace_main.ml +++ b/plugins/trace/trace_main.ml @@ -87,21 +87,24 @@ module Cmdline = struct err_formatter fmt let () = - Config.when_ready (fun {Config.get=(!)} -> - Future.upon Plugins.loaded (fun () -> - match main !dump !load with - | Ok `Done -> () - | Ok `Exit -> exit 0 - | Error e -> match e with - | `Protocol_error err -> - exitf "Protocol error: %a" Error.pp err - | `System_error err -> - exitf "System error: %s" @@ Unix.error_message err - | `No_provider -> - exitf "No provider for the given URI" - | `Ambiguous_uri -> - exitf "More than one provider for a given URI" - | exception Incompatibe_args -> - exitf "Incompatible arguments, see usage SYNOPSIS" )) + Config.declare_extension + ~doc:"manages execution traces" + ~provides:["dynamic"; "pass"; "printer"; "trace"] + (fun {Config.get=(!)} -> + Future.upon Plugins.loaded (fun () -> + match main !dump !load with + | Ok `Done -> () + | Ok `Exit -> exit 0 + | Error e -> match e with + | `Protocol_error err -> + exitf "Protocol error: %a" Error.pp err + | `System_error err -> + exitf "System error: %s" @@ Unix.error_message err + | `No_provider -> + exitf "No provider for the given URI" + | `Ambiguous_uri -> + exitf "More than one provider for a given URI" + | exception Incompatibe_args -> + exitf "Incompatible arguments, see usage SYNOPSIS" )) end diff --git a/plugins/trivial_condition_form/dune b/plugins/trivial_condition_form/dune new file mode 100644 index 000000000..b783257a8 --- /dev/null +++ b/plugins/trivial_condition_form/dune @@ -0,0 +1,10 @@ +(library + (name bap_trivial_condition_form_plugin) + (public_name bap-trivial-condition-form.plugin) + (libraries bap core_kernel)) + +(plugin + (name trivial-condition-form) + (package bap-trivial-condition-form) + (libraries bap-trivial-condition-form.plugin) + (site (bap-common plugins))) diff --git a/plugins/trivial_condition_form/trivial_condition_form_main.ml b/plugins/trivial_condition_form/trivial_condition_form_main.ml index abfd1a16e..5b405cfb3 100644 --- a/plugins/trivial_condition_form/trivial_condition_form_main.ml +++ b/plugins/trivial_condition_form/trivial_condition_form_main.ml @@ -54,5 +54,7 @@ hoisted into the assignment section of a block."; ];; -let () = when_ready (fun _ -> - Project.register_pass ~runonce:true main) +let () = declare_extension + ~doc:"eliminates complex conditional on branches" + ~provides:["pass"; "simplification"] @@ fun _ -> + Project.register_pass ~runonce:true main diff --git a/plugins/warn_unused/dune b/plugins/warn_unused/dune new file mode 100644 index 000000000..e85a338d0 --- /dev/null +++ b/plugins/warn_unused/dune @@ -0,0 +1,10 @@ +(library + (name bap_warn_unused_plugin) + (public_name bap-warn-unused.plugin) + (libraries bap core_kernel)) + +(plugin + (name warn-unused) + (package bap-warn-unused) + (libraries bap-warn-unused.plugin) + (site (bap-common plugins))) diff --git a/plugins/warn_unused/warn_unused_main.ml b/plugins/warn_unused/warn_unused_main.ml index 2c0077ebb..770d5cf0f 100644 --- a/plugins/warn_unused/warn_unused_main.ml +++ b/plugins/warn_unused/warn_unused_main.ml @@ -132,13 +132,13 @@ module Cmdline = struct let () = Config.manpage man; - Config.when_ready (fun {Config.get=(!)} -> - Project.register_pass ~deps:["callsites"] ~name:"taint" taint; - Project.register_pass' ~name:"print" (run print); - Project.register_pass ~name:"mark" (run mark); - Project.register_pass' - ignore ~deps:[name^"-taint"; "propagate-taint"; - name^"-print"] - ) - + Config.declare_extension + ~doc:"the legacy warn-unused analysis" + ~provides:["pass"; "analysis"] @@ fun {Config.get=(!)} -> + Project.register_pass ~deps:["callsites"] ~name:"taint" taint; + Project.register_pass' ~name:"print" (run print); + Project.register_pass ~name:"mark" (run mark); + Project.register_pass' + ignore ~deps:[name^"-taint"; "propagate-taint"; + name^"-print"] end diff --git a/plugins/x86/.merlin b/plugins/x86/.merlin deleted file mode 100644 index fc0d3dccd..000000000 --- a/plugins/x86/.merlin +++ /dev/null @@ -1,13 +0,0 @@ -PKG zarith -B ../../_build/plugins/x86 -B ../../_build/lib/bap_abi -B ../../_build/lib/bap_api -B ../../_build/lib/x86_cpu -B ../../_build/lib/bap_c -B ../../plugins/x86 -B ../../lib/bap_abi -B ../../lib/bap_api -B ../../lib/x86_cpu -B ../../lib/bap_c -B ../../lib/bap_demangle -REC \ No newline at end of file diff --git a/plugins/x86/dune b/plugins/x86/dune new file mode 100644 index 000000000..8c4683ca6 --- /dev/null +++ b/plugins/x86/dune @@ -0,0 +1,27 @@ +(library + (name x86) + (public_name bap-x86.plugin) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-abi + bap-api + bap-c + bap-core-theory + bap-future + bap-knowledge + bap-llvm + bap-main + bap-primus + bap-x86 + bitvec + core_kernel + ogre + str + zarith)) + +(plugin + (name x86) + (package bap-x86) + (libraries bap-x86.plugin) + (site (bap-common plugins))) diff --git a/plugins/x86/semantics/dune b/plugins/x86/semantics/dune new file mode 100644 index 000000000..69c1f390c --- /dev/null +++ b/plugins/x86/semantics/dune @@ -0,0 +1,7 @@ +(install + (section (site (bap-common semantics))) + (package bap-x86) + (files x86-32.lisp + x86-64.lisp + x86-64-sse-intrinsics.lisp + x86-common.lisp)) diff --git a/plugins/x86/x86_legacy_bil_convenience.ml b/plugins/x86/x86_legacy_bil_convenience.ml index 0a4c5934c..f07788560 100644 --- a/plugins/x86/x86_legacy_bil_convenience.ml +++ b/plugins/x86/x86_legacy_bil_convenience.ml @@ -148,6 +148,7 @@ let bvtosf ?(rm=RNE) ~float_size a = unop (FP(FBVTOSF float_size, rm)) a let ftof ?(rm=RNE) ~float_size a = unop (FP(FFTOF float_size, rm)) a let ieeebvtof ?(rm=RNE) ~float_size a = unop (FP(FIEEEBVTOF float_size, rm)) a let fnan ?(rm=RNE) ~float_size = unop (FP(FNAN float_size, rm)) (exp_false) +[@@warning "-16"] let cast ct tnew = function | Int(i,t) -> let (i',t') = Arithmetic.cast ct (i,t) tnew in diff --git a/plugins/x86/x86_main.ml b/plugins/x86/x86_main.ml index 48244b4eb..28cbc76ff 100644 --- a/plugins/x86/x86_main.ml +++ b/plugins/x86/x86_main.ml @@ -65,28 +65,31 @@ let () = ~f:(fun (name, kind) -> Option.some_if (equal_kind kind default) name)) in Config.(param (enum kinds) "lifter" ~doc ~default) in - Config.when_ready (fun {Config.get=(!!)} -> - let open Bap_core_theory in - let open Bap_primus.Std in + Config.declare_extension + ~doc:"provides x86/x86-64 semantics" + ~provides:["disassembler"; "lifter"; "semantics"; "x86"; "abi"] + @@ fun {Config.get=(!!)} -> + let open Bap_core_theory in + let open Bap_primus.Std in - main !!backend !!kind !!abi; - if !!fp_lifter || !!legacy_lifter then begin - let open Bap_core_theory in - let open Bap_primus.Std in - if !!fp_lifter then Format.eprintf - "The --with-floating-points flag is deprecated \ - and will be removed in the following versions of bap. \ - This flag enables the legacy lifter that is incomplete \ - and disables the new version that translates \ - floating-point operations into the intrinsic calls. \ - If you still need the legacy lifter use the \ - --x86-with-legacy-floating-points option instead.@\n%!"; - X86_legacy_bil_lifter.init (); - X86_legacy_bil_semantics.init (); - end else if not !!disable_intrinsics - then - KB.promise Primus.Lisp.Semantics.context @@ fun _ -> - KB.return @@ - Primus.Lisp.Context.create [ - "x86-floating-points", ["intrinsic-semantics"] - ]) + main !!backend !!kind !!abi; + if !!fp_lifter || !!legacy_lifter then begin + let open Bap_core_theory in + let open Bap_primus.Std in + if !!fp_lifter then Format.eprintf + "The --with-floating-points flag is deprecated \ + and will be removed in the following versions of bap. \ + This flag enables the legacy lifter that is incomplete \ + and disables the new version that translates \ + floating-point operations into the intrinsic calls. \ + If you still need the legacy lifter use the \ + --x86-with-legacy-floating-points option instead.@\n%!"; + X86_legacy_bil_lifter.init (); + X86_legacy_bil_semantics.init (); + end else if not !!disable_intrinsics + then + KB.promise Primus.Lisp.Semantics.context @@ fun _ -> + KB.return @@ + Primus.Lisp.Context.create [ + "x86-floating-points", ["intrinsic-semantics"] + ] diff --git a/ppx_bap.opam b/ppx_bap.opam new file mode 100644 index 000000000..f236ddb33 --- /dev/null +++ b/ppx_bap.opam @@ -0,0 +1,45 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "BAP-blessed ppx rewriters" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "ppx"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "ppx_assert" {>= "v0.14" & < "v0.16"} + "ppx_bench" {>= "v0.14" & < "v0.16"} + "ppx_bin_prot" {>= "v0.14" & < "v0.16"} + "ppx_cold" {>= "v0.14" & < "v0.16"} + "ppx_compare" {>= "v0.14" & < "v0.16"} + "ppx_enumerate" {>= "v0.14" & < "v0.16"} + "ppx_fields_conv" {>= "v0.14" & < "v0.16"} + "ppx_hash" {>= "v0.14" & < "v0.16"} + "ppx_here" {>= "v0.14" & < "v0.16"} + "ppxlib" {>= "0.15.0"} + "ppx_optcomp" {>= "v0.14" & < "v0.16"} + "ppx_sexp_conv" {>= "v0.14" & < "v0.16"} + "ppx_sexp_value" {>= "v0.14" & < "v0.16"} + "ppx_variants_conv" {>= "v0.14" & < "v0.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/regular.opam b/regular.opam new file mode 100644 index 000000000..95c3eb67b --- /dev/null +++ b/regular.opam @@ -0,0 +1,36 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "Regular Data Types" +description: + "Provides functors and typeclasses implementing functionality expected for a regular data type, like i/o, containers, printing, etc. In particular, the library includes: - module Data that adds generic i/o routines for each regular data type. - module Cache that adds caching service for data types - module Regular that glues everything together - module Opaque for regular but opaque data types - module Seq that extends Core_kernel's sequence module - module Bytes that provides a rich core-like interface for Bytes data type." +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap" "data-structure"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "ppx_bap" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/src/.merlin b/src/.merlin deleted file mode 100644 index abf001705..000000000 --- a/src/.merlin +++ /dev/null @@ -1,10 +0,0 @@ -REC -PKG cmdliner -PKG curl -PKG parsexp -PKG uuidm -PKG re -B ../_build/src -B ../_build/lib/bap_byteweight -B ../src -B ../lib/bap_byteweight diff --git a/src/bap_frontend.ml b/src/bap_frontend.ml index c222e1cc7..e6641ee67 100644 --- a/src/bap_frontend.ml +++ b/src/bap_frontend.ml @@ -169,7 +169,7 @@ let entity_desc : (entity * string) list = [ `Collators, "project collators (comparators)"; ] -let () = +let _list_command_declaration : unit = let what = Command.argument @@ Type.enum entities in let filter = Command.parameter Type.(list string) "filter" ~aliases:["f"] @@ -316,6 +316,28 @@ let () = | _ -> ()); Ok () +let _config_command_declaration : unit = + let entities = Configuration.[ + "datadir", datadir; + "cachedir", cachedir; + "sysdatadir", sysdatadir; + "libdir", libdir; + "confdir", confdir; + ] in + let entity = Command.argument @@ Type.(some (enum entities)) in + let doc = "prints BAP configuration" in + Command.declare ~doc "config" Command.(args $entity) @@ + fun entity _ctxt -> match entity with + | Some entity -> + Format.printf "%s@." entity; + Ok () + | None -> + List.iter entities ~f:(fun (name, value) -> + Format.printf "%s: %s@." name value); + Ok () + + + let () = let _unused : (module unit) = (module Bap.Std) in diff --git a/src/baptop.ml b/src/baptop.ml index ced362714..ee28c9eaf 100644 --- a/src/baptop.ml +++ b/src/baptop.ml @@ -3,4 +3,8 @@ let main () = UTop_main.main () -let () = main () +let () = + try main () with + Symtable.Error err -> + Format.eprintf "Internal error: %a@." Symtable.report_error err; + exit 1 diff --git a/src/dune b/src/dune new file mode 100644 index 000000000..2de1a5a6e --- /dev/null +++ b/src/dune @@ -0,0 +1,47 @@ +(executable + (name bap_frontend) + (public_name bap) + (package bap-frontend) + (modules bap_frontend) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-core-theory + bap-knowledge + bap-main + core_kernel + findlib.dynload + regular + threads)) + +(executable + (name bap_mc) + (public_name bap-mc) + (package bap-mc) + (modules bap_mc) + (libraries unix)) + +(executable + (name bap_byteweight_main) + (public_name bap-byteweight) + (package bap-byteweight-frontend) + (modules bap_byteweight_main) + (preprocess (pps ppx_bap)) + (libraries + bap + bap-byteweight + cmdliner + curl + fileutils + re.posix + threads)) + +(executable + (name baptop) + (public_name baptop) + (package bap-toplevel) + (modules baptop) + (modes byte) + (link_flags (-linkall)) + (optional) + (libraries dune-site.plugins dune-site.toplevel utop threads findlib.dynload)) diff --git a/text-tags.opam b/text-tags.opam new file mode 100644 index 000000000..eb0460e1d --- /dev/null +++ b/text-tags.opam @@ -0,0 +1,33 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +version: "dev" +synopsis: "A library for rich formatting using semantic tags" +maintainer: ["Ivan Gotovchits "] +authors: ["The BAP Team"] +license: "MIT" +tags: ["bap"] +homepage: "https://github.com/BinaryAnalysisPlatform/bap" +bug-reports: "https://github.com/BinaryAnalysisPlatform/bap/issues" +depends: [ + "dune" {>= "3.1"} + "core_kernel" {>= "v0.14" & < "v0.16"} + "bap-common" {= version} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/BinaryAnalysisPlatform/bap.git" diff --git a/tools/configure.ml b/tools/configure.ml new file mode 100644 index 000000000..ee52e9379 --- /dev/null +++ b/tools/configure.ml @@ -0,0 +1,3 @@ +let () = + Arg.write_arg "config.status.in" @@ + Array.sub Sys.argv 1 (Array.length Sys.argv - 1) diff --git a/tools/dune b/tools/dune new file mode 100644 index 000000000..eb5d79344 --- /dev/null +++ b/tools/dune @@ -0,0 +1,29 @@ +(executable + (name rewrite) + (preprocess (pps ppx_sexp_conv)) + (modules rewrite) + (libraries bap-common base stdio sexplib dune-configurator dune-site)) + +(executable + (name bapbuild) + (public_name bapbuild) + (package bap-build) + (preprocess (pps ppx_bap)) + (modules bapbuild) + (libraries core_kernel ocamlbuild bap-build compiler-libs)) + +(executable + (name bapbundle) + (public_name bapbundle) + (package bap-bundle) + (modules bapbundle) + (libraries core_kernel bap-bundle fileutils uri)) + +(rule + (target bap_config) + (deps bap_config.ab (alias ../config)) + (action + (with-stdin-from %{deps} + (with-stdout-to %{target} + (chdir %{workspace_root} + (run ./tools/rewrite.exe -filename %{deps})))))) diff --git a/tools/rewrite.ml b/tools/rewrite.ml new file mode 100644 index 000000000..9ff09d30f --- /dev/null +++ b/tools/rewrite.ml @@ -0,0 +1,159 @@ +open Printf +open Base +open Stdio +open Sexplib + +module Buf = Caml.Buffer +module Arg = Caml.Arg +module Cfg = Configurator.V1 +module Sys = Caml.Sys +module Format = Caml.Format + +type cls = + | Help + | With + | Comp of bool + +type cfg = string Hashtbl.M(String).t [@@deriving sexp] + +let filename = ref "" +let init = ref false +let args = [ + "-filename", Arg.Set_string filename, "NAME the name of the file"; + "-init", Arg.Set init, "BOOL creates the configuration file" +] + +let () = Cfg.main ~args ~name:"bap-configurator" @@ fun self -> + let ocamlc ?name var = + Option.value name ~default:var, + Cfg.ocaml_config_var_exn self var in + + let prefix = + let stdlib = Cfg.ocaml_config_var_exn self "standard_library" in + String.chop_suffix_exn stdlib "/lib/ocaml" in + + let build_id = + try Cfg.Process.run_capture_exn self "git" [ + "rev-parse"; + "--verify"; + "--quiet"; + "--short=7"; + "HEAD" + ] + with _ -> "" in + + let name = "bap-common" in + + + let site name = + let sites = Bap_common.sites name in + "site_" ^ name, + List.map sites ~f:(sprintf "%S") |> + String.concat ~sep:"; " in + + if init.contents then begin + let vars = Hashtbl.of_alist_exn (module String) [ + "pkg_name", name; + "pkg_version", "2.6.0-alpha"; + "prefix", prefix; + "exec_prefix", "$prefix"; + "bindir", "$exec_prefix/bin"; + "sbindir", "$exec_prefix/sbin"; + "libexecdir", "$exec_prefix/libexec"; + "sysconfdir", "$prefix/etc"; + "sharedstatedir", "$prefix/com"; + "localstatedir", "$prefix/var"; + "libdir", "$exec_prefix/lib"; + "datarootdir", "$prefix/share"; + "datadir", "$datarootdir"; + "infodir", "$datarootdir/info"; + "localedir", "$datarootdir/locale"; + "mandir", "$datarootdir/man"; + "docdir", "$datarootdir/doc/$pkg_name"; + "htmldir", "$docdir"; + "dvidir", "$docdir"; + "pdfdir", "$docdir"; + "psdir", "$docdir"; + "plugindir", "$libdir/bap"; + "debug", "true"; + "profile", "false"; + "build_id", build_id; + "llvm-config", "llvm-config"; + "cxxfilt_paths", "[]"; + "ida_path", ""; + "ida_headless", "false"; + "objdump_paths", "[]"; + site "api"; + site "lisp"; + site "plugins"; + site "primus"; + site "semantics"; + site "signatures"; + site "site_lisp"; + ocamlc ~name:"ocaml_version" "version"; + ocamlc "os_type"; + ocamlc "system"; + ocamlc "architecture"; + ocamlc "host"; + ocamlc "target"; + ocamlc "standard_library"; + ocamlc ~name:"suffix_program" "ext_exe"; + ] in + + let classes = [ + "--enable-", Comp true; + "--disable-", Comp false; + "--help", Help; + "-help", Help; + "--with-", With; + ] in + + let add_variable spec = + match String.split_on_chars spec ~on:['='] with + | [key;data] -> + Hashtbl.set vars ~key ~data + | _ -> + Cfg.die "An invalid variable specification %S\n" spec in + + let classify arg = List.find_map classes ~f:(fun ((prefix,_) as cls) -> + Option.some_if (String.is_prefix ~prefix arg) cls) in + + Arg.read_arg "config.status.in" |> Array.iter ~f:(fun arg -> + match classify arg with + | Some (_,Help) -> Caml.exit 0 + | Some (_,Comp _) -> () + | Some (pref,With) -> + add_variable (String.subo arg ~pos:(String.length pref)) + | None when String.is_prefix arg ~prefix:"--" -> + add_variable (String.subo ~pos:2 arg) + | None -> + eprintf "Invalid ./configure argument %S\n" arg); + Format.printf "%a@." Sexp.pp_hum (sexp_of_cfg vars); + Caml.exit 0; + end; + + let vars = + cfg_of_sexp @@ + Sexp.of_string @@ In_channel.read_all "config.status" in + + let rewrite_var var = + match Hashtbl.find vars var with + | None -> + eprintf "Warning %s: unknown variable %S in %s\n" + Sys.argv.(0) var !filename; + var + | Some s -> s in + + let substitute_one str = + let buf = Buffer.create (String.length str) in + Buf.add_substitute buf rewrite_var str; + Buf.contents buf in + + let rec substitute str = + let res1 = substitute_one str in + let res2 = substitute_one res1 in + if String.equal res1 res2 then res2 + else substitute res2 in + + In_channel.iter_lines In_channel.stdin ~f:(fun str -> + printf "%s\n" (substitute str))