-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Links to source code #183
Labels
enhancement
New feature or request
Comments
So far, no functioning way of extracting the line numbers has been found. The only viable option is to parse source code files; however, this defeats the purpose of extracting member information via reflection. |
var pdbManaged = SharpPdb.Managed.PdbFileReader.OpenPdb(string.Format(path, "pdb"));
var funToken = 100663301;
var function = pdbManaged.GetFunctionFromToken(funToken);
IPdbSequencePoint sequencePoint = function.SequencePoints[0];
Assert.Equal(0, sequencePoint.Offset);
Assert.Equal(22, sequencePoint.StartLine);
Assert.Equal(22, sequencePoint.EndLine);
Assert.Equal(23, sequencePoint.StartColumn);
Assert.Equal(24, sequencePoint.EndColumn);
var sources = pdb.Functions.SelectMany(f => f.SequencePoints).Select(sp => sp.Source).GroupBy(s => s.Name).Select(sg => sg.First());
Assert.Single(sources);
IPdbSource source = sources.First();
Assert.Equal("/home/travis/build/southpolenator/WinDbgCs_dumps/Source/Clr/SharedLibrary/SharedLibrary.cs", source.Name); |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using dnlib.DotNet;
using SharpPdb.Managed;
var results = new Dictionary<string, (string, int)[]>();
const string path = @"";
foreach (var file in Directory.EnumerateFiles(path, "*.pdb", SearchOption.AllDirectories))
{
var module = ModuleDefMD.Load(file.Replace(".pdb", ".dll"));
var tokens = module.GetTypes().SelectMany(t => t.Methods).ToDictionary(x => x.MDToken.Raw);
var pdbFile = PdbFileReader.OpenPdb(file);
var sequencePoints = pdbFile.Functions
.Where(x => x.SequencePoints.Any())
.Select(x => (tokens[(uint)x.Token].Name.String, x.SequencePoints.First().StartLine))
.ToArray();
if (sequencePoints.Length == 0)
continue;
results.Add(file, sequencePoints);
} |
hailstorm75
added a commit
that referenced
this issue
Jan 2, 2022
hailstorm75
added a commit
that referenced
this issue
Jan 2, 2022
hailstorm75
added a commit
that referenced
this issue
Jan 2, 2022
The core functionality and UI is implemented; however, the results are inaccurate and there are rarely any links extracted... |
Some of the PDB's are source from |
hailstorm75
added a commit
that referenced
this issue
May 17, 2022
hailstorm75
added a commit
that referenced
this issue
May 17, 2022
hailstorm75
added a commit
that referenced
this issue
May 17, 2022
hailstorm75
added a commit
that referenced
this issue
May 22, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the solution you'd like
The generated document should have links to the source code of the given type and its members.
Additional context
GitHub links to source code have the following format:
https://github.com/user/repository/blob/branch/path/to/source.file#L12
GitLab links are similar:
https://gitlab.com/user/repository/-/blob/branch/path/to/source.file#L12
...where L12 means line 12
The text was updated successfully, but these errors were encountered: