connglli / ELEGANT

ELEGANT - a tool to Effectively LocatE fraGmentAtion-iNduced compaTibility issues.
MIT License
3 stars 0 forks source link

how to get the program slice of API in Android application? #19

Open jerryhero opened 6 years ago

jerryhero commented 6 years ago

I read the weekly reports in this project and want to use the function of program slicing in Android application.Could you tell me how to get this function?Is there API that I can use to directly get the program slicing of Android application?Thanks a lot!

connglli commented 6 years ago

@jerryhero The weekly reports are only a notes taking process of my work on ELEGANT, it, however, does little help for you to locate the program slicing code.

Unfortunately, you cannot directly use the program slicing APIs, because both ELEGANT and these API are on top of FlowDroid. If you want to use it, add FlowDroid, or Soot (its enough), as your dependency. To use it, check code in Soots.java, which I wrote to provide some easy-to-use APIs for Soot. The method findBackwardSlicing(...) may be what you want.

But pay attention:

  1. There are many types of slices related to the program slicing technique, e.g. the forward, the backward, the static, and the dynamic. The findBackwardSlicing(...) is what I wrote for the static backward one.
  2. It is somewhat easy to get a slice, however, it is not to get a precise one, which is tightly coupled to your analysis. To get a precise one, some tricks bound to your analysis may be introduced. Thus, the API findBackwardSlicing(...) is tightly coupled to, and precise in, the analysis of ELEGANT. It is fat, tricky, and it may not be the one that suits your requirements/project.
jerryhero commented 6 years ago

Thanks, I wanna to know, is there code that I can get the forward slice of Android program?I see the method findInternalForwardSlicing(...) in this project,but not found any caller of this method.Is there way to get the forward slice? Thanks a lot!

connglli commented 6 years ago

@jerryhero No callers of it. It is a helper method that I wrote for future use. However, it has not been used, yet. You can use and test it if you only need the PDG constructed by FlowDroid.

Pay attention: I mentioned "the PDG constructed by FlowDroid", which means, if a variable which is defined but never used by your app under test, this method will fail. Test it, and you will know it.