On Sat, 2021-07-03 at 20:07 +0530, Ankur Saini wrote: > AIM for today : > > - update the call_stack to track something else other than supergraph > edges > > — > > PROGRESS : > > - After some brainstorming about tracking the callstack, I think one > better way to track the call stack is to keep track of source and > destination of the call instead of supperedges representing them. > > - so I branched again and updated the call-string to now capture a pair > of supernodes ( one representing callee and other representing caller > ), like this I was not only able to easily port the entire code to > adapt it without much difficulty, but now can also push calls to > functions that doesn’t possess a superedge. > > - changes done can be seen on the " > refs/users/arsenic/heads/call_string_update “ branch. ( currently this > branch doesn’t contain other changes I have done till now, as I wanted > to test the new call-string representation exclusively and make sure it > doesn’t affect the functionality of the base analyser )
I'm not an expert at git, so it took me a while to figure out how to access your branch. It's easier for me if you can also use "git format-patch" to generate a patch and "git send-email" to send it to this list (and me, please), so that the patch content is going to the list. The approach in the patch seems reasonable. I think you may have a memory leak, though: you're changing call_string from: auto_vec<const return_superedge *> m_return_edges; to: auto_vec<const std::pair<const supernode *,const supernode *>*> m_supernodes; and the std:pairs are being dynamically allocated on the heap. Ownership gets transferred by call_string::operator=, but if I'm reading the patch correctly never get deleted. This is OK for prototyping, but will need fixing before the code can be merged. It's probably simplest to get rid of the indirection and allocation in m_supernodes and have the std::pair be stored by value, rather than by pointer, i.e.: auto_vec<std::pair<const supernode *, const supernode *> > m_supernodes; Does that work? (or is there a problem I'm not thinking of). If that's a problem, I think you might be able to get away with dropping the "first" from the pair, and simply storing the supernode to return to; I think the only places that "first" gets used are in dumps and in validation. But "first" is probably helpful for debugging, so given that you've got it working with that field, better to keep it. Hope this is helpful Dave > > - now hopefully all that is left for tomorrow is to update the analyzer > to finally see, call and return from the function aclled via the > function pointer. > > STATUS AT THE END OF THE DAY :- > > - update the call_stack to track something else other than supergraph > edges ( done ) > > Thank you > - Ankur >