1

I'm looking for a relatively simple way of creating a call graph of an iOS app (or a framework), using it's Xcode project or the obj code it emits.

The project files are a combination of Objective C, Swift and C++.

I've already tried clang's scan-build, but haven't had any luck turning the .dot files into graphViz graphs. I ended up with hundreds of .dot files and after dot, for over an hour, tries to load them up, nothing happens.

I've also tried to use opt, by adding this to my build line:

-S -emit-llvm -o - | opt -dot-callgraph -S

(from this SO question

but I get only a 107 byte callgraph.dot file and that doesn't have anything notable in it.

I think these errors are what make the output useless:

clang-5.0: warning: 'linker' input unused [-Wunused-command-line-argument] clang-5.0: warning: argument unused during compilation: '-emit-llvm' [-Wunused-command-line-argument]

mahboudz
  • 39,196
  • 16
  • 97
  • 124
  • Maybe [this answer](https://stackoverflow.com/a/5373814/2557145) can help you. I would guess that dynamic dispatch is difficult to statically analyze, which might be a problem for NSObject-subclasses. Also, Swift hides many function calls so this graph could turn out to be huge. – Palle Oct 27 '17 at 20:32
  • Possible duplicate of this https://stackoverflow.com/questions/24495085/ios-project-static-dynamic-code-analysis-and-call-graphs – Harjot Singh Oct 27 '17 at 20:36
  • Why does the rendering with graphviz fail? – Palle Oct 27 '17 at 20:36
  • I added some more info to my question. – mahboudz Oct 27 '17 at 21:30

0 Answers0