Skip to content

Commit

Permalink
pathfinder
Browse files Browse the repository at this point in the history
  • Loading branch information
LednevaAR committed Nov 19, 2023
0 parents commit 51ecaa9
Show file tree
Hide file tree
Showing 257 changed files with 1,054,366 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Test"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v1

- name: Build
working-directory: front
run: |
cmake ./
make
- name: Unit tests
working-directory: front
run: build/test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
front/data/
front/CMakeCache.txt
front/CMakeFiles/
front/build/
front/Makefile
front/cmake_install.cmake
.vscode/
*.out
_deps/
front/DartConfiguration.tcl
testgraph_generator.output
data/
3 changes: 3 additions & 0 deletions .idea/dictionaries/nefanov.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/pathfinder.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# pathfinder
CFL-R-based software analysis tool

## Reference:
If you use Pathfinder, please, cite this article:

Н. Н. Ефанов, А. Р. Федоров, Э. В. Шамбер, А. А. Щербаков, А. П. Елесина Pathfinder: статический анализатор программ на базе решения задач достижимости на графах в КС-ограничениях // Труды МФТИ, Том 13, №4, 2021, сс 14-29. DOI:10.53815/20726759_2021_13_4_14

Or:

Efanov, N., Fedorov, A.R., Shamber, E.V., Shcherbakov, A.A., & Elesina, A.P. (2021). Pathfinder: software static analyzer based on solving the graph reachability problem with CF constraints. Proceedings of Moscow Institute of Physics and Technology. Vol. 13, 4 pp. 14-29. (In Russian) DOI:10.53815/20726759_2021_13_4_14

## Reports, talks:

**Apr. 2022:**

N. Efanov, S. Efimov // Pathfinder: overview of the tool, approach & applications. YC Seminar, SPbSU: https://drive.google.com/file/d/1bEjzNo4M-ER4jznoXGKloXfuwJeKLXC2/view

N. Efanov, S. Efimov // CFL-R approach for code static analysis. Techtalk on KMTT Seminar, MIPT:
https://youtu.be/EDp_dERI1GM

**Jun. 2022:**

S. Efimov // Static analysis of cycles vectorization based on CFL-reachability. Bachelor degree defence, MIPT, KMTT Dept.

## ResearchGate:
1) [Modern formal languages theory based methods for software static analysis](https://www.researchgate.net/project/Modern-formal-languages-theory-based-methods-for-software-static-analysis)

# Requirements
* GCC 9.3.0
* CMAKE 3.16.3
* PYTHON 3.7 *(only for Lexer and Callgrind-front analysis)*
* CLANG 14.0.0 *(only for llvm analysis)*
* LLVM 14.0.0 *(only for llvm analysis)*
* PYTHON 2.7.18 *(only for llvm analysis)*
* GRAPHVIZ 2.43.0 *(only for llvm analysis)*
# Build
cd front
cmake ./
make
# Run [in demo mode, with simplified grammar rules]
In [path to file] you need to specify the path to the file pre-compiled<br>with `gcc file_name -fdump-tree-cfg-graph`<br>
If you omit it, the program will ask you to specify it via stdin<br><br>

When running `bash run.sh` it starts to work with code analysis.
<br>For a test it is needed to write `examples/test1.c` (if you are in front/gcc-cfg-utils and not using cmd args),
<br>then write grammar rules (first: number of rules, then rules)
<br>For example:

5
S AB
S AR
R SB
A a
B b

<br> Then to put letters on edges. <br>

It produces file build/core, which is core executable of CFL-R analysis and<br>
can be called by frontend (see example in front/callgrind-front).
<br><br>
If you want to run the unit-tests you need write:

bash run.sh -test

It is also supported file input method<br>
To use it write:

bash run.sh -file [path to file] (For example: input/example.in)

# Supported flags
* `-cmd` the next argument should be the path to analyzed file
* `-file` the next argument should be the path to input file
* `-front-only` to not run the core file, only to generate data/graph
* `-thin` to present data/graph string by string (`thin-bb version`)
* `-fast` to use `fast.cpp` alghorithm
* `-slow` to use `slow.cpp` alghorithm
* `-test` to run unit-tests
* `-o` to save front output into specific file (specify path into next argument)
* `-ssa` to represent input graph in SSA form
# Examples
* bash run.sh
gcc-cfg-utils/examples/test1.c
1
S a
a a b b a a a
* bash run.sh -cmd gcc-cfg-utils/examples/test1.c
1
S a
a a b b a a a
* bash run.sh -file gcc-cfg-utils/input/example.in

# Run [in general mode]
<br>The terms in grammar rules can be spaced strings, just pass -spaced_rhs as option for core. For example:

* StrTerm StrTermRhs1 StrTermRhs2

# LLVM IR

Also it is supported llvm compilers<br>
To analyze LLVM IR bitcode you should switch to LLVM branch:

git checkout llvm

# Backends
1) Melski-Reps, CYK -- based:
- "slow" mode
- "fast" mode
2) GLL-based:
- Iguana (GLL4Graph): See in documentation_GLL4Graph document
Loading

0 comments on commit 51ecaa9

Please sign in to comment.