I’m going through a large julia package where I’m particularly interested in how the computing is done in one specific function (I’m certain that this function is called, as I added a print line therein so that if the function is called it prints something). I tried to use ASTInterpreter2 to help me identify where the function is called. Unfortunately, the package is so complicated that ASTInterpreter2 fails to work (the issue is just too complicated to be filed with a reasonably small MWE). I also tried to add println(backtrace()) in that function, expecting that the result of backtrace() can give me some clue. But what backtrace() returns is just too hard to interpret for an average non-geek like myself.
Thanks a lot! This is pretty much what I’m after. One quick question - stackback() seems to only print the names of the files in the stack without giving much information about the locations of the files. Is there a way to let stackback() elaborate a little by printing also the directory of each file involved?
TraceCalls returns a tree of all the function calls that happened during the execution of ...computation... (replace it with whatever code you want to execute). There are many examples in the manual. filter_lineage(tr -> tr.func==foo, trace; keep_descendents=false) will get rid of all the function calls in the tree except foo, its callers, its callers’ callers, etc. It won’t give you very different information than stacktrace(), but it will look nicer, and traces are very manipulable objects. Plus, you don’t have to modify the code you’re exploring.
It should be true that only files in base have relative paths, while all of your files will be listed with absolute paths. I think there’s a function (functionloc, iirc) that’ll try to distinguish the two for you (used by less and edit and such)