8

Background:

Working in eclipse, I have two function: do_something and perform_task. I know that do_something calls a number of other functions which in turn call others (and so on and so on) and somewhere down the line perform_task gets called as well.

Since this is a big project, lots of flows and so on, I've already found two different sequences where do_something activates perform_task through some other sequence of functions.

Actuall question:

Is there a way in eclipse to get the call hierarchy of a certain function, but only sequences that will include also a certain other function in the sequence?

Thinking of this in terms of graph paths, we have a directed graph, and instead of asking what are paths to node x, I want to know what are the paths to node x that include node y.

shapiro yaacov
  • 2,308
  • 2
  • 26
  • 39
  • You may try adding a conditional breakpoint inside the function and as the condition you may write something like Thread.currrentthread().getstacktraceelements contains x.y.z.yourclass.yourmethod – guleryuz Jan 17 '16 at 22:39
  • @guleryuz - thanks for the idea, but in my case that simply is not an option. Also, your idea will cover one option (the one `Thread.currentthread()`), where I am seeking to get insight on all the options... – shapiro yaacov Jan 17 '16 at 23:15
  • is it possible to write some unittest and mock the function perform_task to cover all the sequences situations – realhu Jan 23 '16 at 10:55

1 Answers1

2

It's not exactly what you're asking for, but might be useful enough:

In the Call Hierarchy view, there's an option to show the callees of the selected method instead of the callers. Look at the view toolbar of Call Hiearchy for the two buttons that depict green dots connected with lines; those button toggle between the two modes.

enter image description here

If you select do_something and open the Call Hierarchy view on it, then set the mode to Show Callees you might be able to explore the various paths out of do_something that lead to perform_task.

E-Riz
  • 31,431
  • 9
  • 97
  • 134