I found workaround...
At start when I load pdb(in future mdb) I walk trough all methods in
assembly and insert method in list where I find method StartLine and
EndLine based on Instructions list.
Later I pick method based on document+closest method...
Do you guys think this will work OK?(atm it does... see any possible
improvements?)
string dllPath = System.IO.Path.ChangeExtension (pdbPath, ".dll");
string exePath = System.IO.Path.ChangeExtension (pdbPath, ".exe");
ModuleDefinition md = null;
md = File.Exists (dllPath) ? ModuleDefinition.ReadModule (dllPath) :
ModuleDefinition.ReadModule (exePath);
reader = symbolBinder.GetSymbolReader (md, pdbPath);
md.ReadSymbols (reader);
foreach (var module in md.Assembly.Modules) {
foreach (var t in module.Types) {
foreach (var m in t.Methods) {
var methodSymbols = new MethodSymbols (m.MetadataToken);
reader.Read (methodSymbols);
if (methodSymbols.Instructions.Count == 0)
continue;
DocInfo document;
if (!documents.TryGetValue (methodSymbols.Instructions
[0].SequencePoint.Document.Url, out document)) {
document = new DocInfo (methodSymbols.Instructions
[0].SequencePoint.Document.Url);
document.Assembly = pAssembly;
documents.Add (document.Url, document);
}
document.AddMethod (m, methodSymbols);
}
}
}
Dne petek, 14. marec 2014 13:12:46 UTC+1 je oseba David Karlaš napisala:
>
> Title pretty much sums it up :D
> So I'm working on MicroFramework(http://netduino.com/hardware/) AddIn for
> MonoDevelop(https://github.com/DavidKarlas/MonoDevelop.MicroFramework)
> and I'm working on adding debugging support I'm using Mono.Cecil to load
> pdb/mdb which so far works great for translating Token->Offset but now I
> got stuck when I want to place Breakpoint. From MonoDevelop I get source
> file path, line and column on which breakpoint has to be added. Problem is
> there is no interface on ISymbolReader like VisualStudio debuggers
> has GetMethodFromDocumentPosition for more info see
> http://msdn.microsoft.com/en-us/library/system.diagnostics.symbolstore.symreader.getmethodfromdocumentposition(v=vs.100).aspx
> .
>
> So am I missing something or this functionality will have to be added to
> Mono.Cecil?
>
--
--
--
mono-cecil
---
You received this message because you are subscribed to the Google Groups
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.