How to get the call paths to a given function?

风格不统一 提交于 2020-01-17 04:19:05

问题


I'm using Eclipse to debug a Java app.

I'd like to see all the possible "call paths" leading to calls to a specific function somefunc.

Does Eclipse provide a way to get this information? (FWIW, I'm using Juno Service Release 1; Build id: 20121004-1855.)

PS: FWIW, at least some calls to somefunc result from choices made by the user interactively, so I expect that some of the call paths will start in one or another GUI event handler.

EDIT: this is what I mean by a "call path". Suppose that some event handler a calls function b, then b calls c, c calls d, and finally d calls somefunc. Then the sequence

a -> b -> c -> d -> somefunction

is one of the call paths I'm interested in.


回答1:


Does 'right click' >> Open Call Hierarchy help?

It does not aggregate all direct and indirect callers in a flat structure, but gives you a tree through.




回答2:


Left click in the method name, then right click -> References -> Project (or Workspace)

This will show you all the places that that method is called from. I am not sure if that is what you mean by "call path" or not.



来源:https://stackoverflow.com/questions/13753857/how-to-get-the-call-paths-to-a-given-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!