1

Background

In the "Show Graphic Views" menu of Understand, there is the option to create a butterfly graph, for one specific entity as seen below:

enter image description here

In addition, there is the und command as well. This command has the capability of running commands in a batch in the following way:

Once you have identified the commands you want to run using interactive mode, place those exact commands in a text file. No need to include the first und command or the quit command, those are handled automatically.

Then all you have to do is run

und myCommands.txt

I have over 1000 c++ classes that I want to create butterfly diagrams for. Given the automation capability of the und command, and the ability for understand to create butterfly diagrams for various entities I wanted to know....

Question

Is there a way for Understand to automate the creation of butterfly diagrams?

isakbob
  • 1,439
  • 2
  • 17
  • 39
  • Thank you for asking this question. I never heard of the "Understand" tool before. It looks very cool. – devdanke Feb 17 '21 at 04:50

1 Answers1

1

Yes, you can script this using perl or Python... Open the tool, and check out the top menu, Help >> Perl API or Help >> Python API... There is a help on the API They show an example like this (create the "callby" graph for all the funcions...), just change it to butterfly.

import understand
db = understand.open("test.udb")
for func in db.ents("function,method,procedure"):
  file = "callby_" + func.name() + ".png"
  print (func.longname(),"->",file)
  func.draw("Called By",file)