Search for all possible paths in c / C ++ LLVM

I am trying to find any possible way in my LLVM program. Right now I can find the paths from entry to exit BB of all the functions in my code. However, this is not what I need. I need to extend CFG (perhaps by including call functions ?!) in order to have CFG for all source code and find paths in this extended CFG. I thought about using -inline pass first, to enable all functions first, and then run my pathfinder run, but as I noticed, it only works for functions that are explicitly mentioned inline in the code (cpp file). I can not go through hundreds of functions and add them to the line. I also have to ensure that all calls are on and the call is not missed. I'm not sure that inlining is my only option, or even this is an option. Any thought on this is appreciated.

** Obviously there is no recursive call in my source code.

0
source share
1 answer

I'm not quite sure what you are asking for, however you can use almost any language of the program to analyze source.cpp and source.h to find the declaration / definition of the function and add inline based on some rule.

Basically you will treat source.cpp as .txt and use any api of your preference to get files as char * . Ask to search ( , then find options and close ) .

 // FindFunctions.cpp #include "..." ... char * AddFuncDecChars( _In_ char * file, char * stringToBeInserted) { //Find possible functions with `()`. int[] PossFuncs = FindParenths(File); // Check to see if space delimited block followed by another block or // multiple space delimited blocks with commas. int[] VerifiedParens HasSpaceDelimWithPossibleCommas( PossFuncs, File); char * Change InsertStringToFunc( File, VerifiedParen, stringToBeInserted); return Change; } 

Also, inline should have a definition in the header, not cpp, so maybe it needs to be added to the headers by taking a pair of .h and .cpp .

-4
source

Source: https://habr.com/ru/post/1468772/


All Articles