Sometimes, especially when working on large projects (such as, I don’t know, say … the CLR), you find yourself debugging a problem where you don’t know where a component is built from. Depending on the problem, it might be useful to get to the sources of the assembly to help diagnose what the issue is (or to look up in the source control system who the owner of the code is so you can contact them). I ran into this problem recently, and using the IronPython MDbg extension was able to whip up a quick method that will dump the path to the source files that make up an assembly that you have symbols for:
for module in Shell.Debugger.Processes.Active.Modules:
if module.SymReader != None:
for document in module.SymReader.GetDocuments():
print “ %s“ % document.URL
print “ module does not have symbols, skipping“
Using this method is pretty straight forward:
It’s definately not an every-day debugging tool, which again makes it nice that IronPython makes extending the MDbg command set so easy since I wouldn’t have wanted to spend more than a few minutes working this code out.