Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0f5011980dbe
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3c84cf6a8e29
Choose a head ref
  • 12 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 6, 2019

  1. Copy the full SHA
    c0add94 View commit details
  2. split out DbgHelp

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    ab2dd62 View commit details
  3. more formatting

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    88dcbf0 View commit details
  4. constant

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    4203314 View commit details
  5. flags!

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    727baa9 View commit details
  6. newline handling

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    904fdd8 View commit details
  7. remove unused declaration

    eggrobin committed Jan 6, 2019
    Copy the full SHA
    7b46a7b View commit details

Commits on Jan 7, 2019

  1. symbol start

    eggrobin committed Jan 7, 2019
    Copy the full SHA
    ec85c89 View commit details

Commits on Jan 8, 2019

  1. Copy the full SHA
    7bdf9c4 View commit details
  2. stack

    eggrobin committed Jan 8, 2019
    Copy the full SHA
    af30a59 View commit details

Commits on Jan 13, 2019

  1. 4.6.1 is enough.

    eggrobin committed Jan 13, 2019
    Copy the full SHA
    80f06fa View commit details
  2. Merge pull request #2061 from eggrobin/better-stacktrace-decoding

    Better stacktrace decoding
    pleroy authored Jan 13, 2019
    Copy the full SHA
    3c84cf6 View commit details
Showing with 278 additions and 74 deletions.
  1. +3 −3 stacktrace_decoder/App.config
  2. +139 −0 stacktrace_decoder/dbghelp.cs
  3. +133 −70 stacktrace_decoder/stacktrace_decoder.cs
  4. +3 −1 stacktrace_decoder/stacktrace_decoder.csproj
6 changes: 3 additions & 3 deletions stacktrace_decoder/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
</configuration>
139 changes: 139 additions & 0 deletions stacktrace_decoder/dbghelp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;


namespace principia {
namespace tools {

internal static class DbgHelp {
internal const UInt32 SYMOPT_LOAD_LINES = 0x00000010;
internal const Int32 MAX_SYM_NAME = 2000;

[StructLayout(LayoutKind.Sequential,
Size = 88 + 2 * (MAX_SYM_NAME - 1),
CharSet = CharSet.Unicode)]
internal class SYMBOL_INFOW {
public Int32 SizeOfStruct = 88;
public Int32 TypeIndex;
public Int64 Reserved0;
public Int64 Reserved1;
public Int32 Index;
public Int32 Size;
public Int64 ModBase;
public Int32 Flags;
public Int64 Value;
public Int64 Address;
public Int32 Register;
public Int32 Scope;
public Int32 Tag;
public Int32 NameLen;
public Int32 MaxNameLen = MAX_SYM_NAME;
// The entire name goes here, but in order to access it we would need
// a fixed-size buffer, which would require making this an unsafe struct
// instead of a class. We don't need the name at this point.
public char Name0;
}

[StructLayout(LayoutKind.Sequential)]
internal class IMAGEHLP_LINEW64 {
public Int32 SizeOfStruct = Marshal.SizeOf<IMAGEHLP_LINEW64>();
public IntPtr Key;
public Int32 LineNumber;
private IntPtr FileName_;
public Int64 Address;

public string FileName {
get {
StringBuilder result = new StringBuilder();
for (int i = 0;; i += 2) {
char code_unit = (char)Marshal.ReadInt16(FileName_, i);
if (code_unit == 0) {
return result.ToString();
}
result.Append(code_unit);
}
}
}
}

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymInitializeW(
IntPtr hProcess,
[MarshalAs(UnmanagedType.LPWStr)] string UserSearchPath,
[MarshalAs(UnmanagedType.Bool)] bool fInvadeProcess);

[DllImport("dbghelp.dll", CharSet = CharSet.Unicode)]
internal static extern Int32 SymAddrIncludeInlineTrace(
IntPtr hProcess,
Int64 Address);

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymQueryInlineTrace(
IntPtr hProcess,
Int64 StartAddress,
Int32 StartContext,
Int64 StartRetAddress,
Int64 CurAddress,
out Int32 CurContext,
out Int32 CurFrameIndex);

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymGetLineFromInlineContextW(
IntPtr hProcess,
Int64 dwAddr,
Int32 InlineContext,
Int64 qwModuleBaseAddress,
out Int32 pdwDisplacement,
[MarshalAs(UnmanagedType.LPStruct)] IMAGEHLP_LINEW64 Line);


[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymGetLineFromAddrW64(
IntPtr hProcess,
Int64 dwAddr,
out Int32 pdwDisplacement,
[MarshalAs(UnmanagedType.LPStruct)] IMAGEHLP_LINEW64 Line);

[DllImport("dbghelp.dll", CharSet = CharSet.Unicode)]
internal static extern UInt32 SymSetOptions(
UInt32 SymOptions);

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern Int64 SymLoadModuleExW(
IntPtr hProcess,
IntPtr hFile,
[MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
Int64 BaseOfDll,
Int32 DllSize,
IntPtr Data,
UInt32 Flags);

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymFromAddrW(
IntPtr hProcess,
Int64 Address,
out Int64 Displacement,
[MarshalAs(UnmanagedType.LPStruct)] SYMBOL_INFOW Symbol);

[DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymFromInlineContextW(
IntPtr hProcess,
Int64 Address,
Int32 InlineContext,
out Int64 Displacement,
[MarshalAs(UnmanagedType.LPStruct)] SYMBOL_INFOW Symbol);
}

} // namespace tools
} // namespace principia
Loading