Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ret and Line number as a slicing criteria isn't working #415

Open
aagontuk opened this issue Nov 14, 2021 · 1 comment
Open

ret and Line number as a slicing criteria isn't working #415

aagontuk opened this issue Nov 14, 2021 · 1 comment
Labels

Comments

@aagontuk
Copy link

aagontuk commented Nov 14, 2021

I am trying to slice following example (Adding line number for convenience):

     1  #include <stdio.h>
     2
     3  int main(int argc, char *argv[]) {
     4      int x = 10, y = 20, z = 30;
     5
     6      z = x + 10;
     7      z = z + 1;
     8
     9      y = 50;
    10
    11      return z;
    12  }

I am trying to slice on return statement in following way:

$ clang -g -c -emit-llvm example.c
$ ./llvm-slicer -c ret example.bc

llvm-slicer is giving following output:

No reachable slicing criteria: '' 'ret'
[llvm-slicer] saving sliced module to: example.sliced

I am getting same output when I try to slice using line numbers. If I give -c 7:z I am getting following output:

No reachable slicing criteria: '' '7:z'
[llvm-slicer] saving sliced module to: example.sliced

But if I use a function call site as a slicing criteria it is generating correct slice. Both -c foo and -c 7:z is working, given that foo is called in line 7 passing z as parameter.

@mchalupa
Copy link
Owner

This looks like a bug, thaks for reporting it.

For both -c 7:z and -sc 7#z the criteria get parsed correctly, so the problem will be in their matching:

$ tools/llvm-slicer -c '7:z' t.bc -dbg
[39710][llvm - slicer] Searching for slicing criteria values
[39883][llvm - slicer] Criterion file # fun # line # obj ==>  #  # 7 # z
[39907][llvm - slicer] Checking global variables for slicing criteria
[39925][llvm - slicer] Checking all instructions for slicing criteria
No reachable slicing criteria: '' '7:z'
[llvm-slicer] saving sliced module to: t.sliced

@mchalupa mchalupa added the bug label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants