Skip to content

Commit

Permalink
Add option to dump debug info to jit-diffs (#166)
Browse files Browse the repository at this point in the history
Off by default. Enable via --debuginfo.

Info is dumped after the method (like unwind and eh) and will show up
as file diffs.
  • Loading branch information
AndyAyersMS authored Sep 6, 2018
1 parent a8da9bb commit b74d29f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/jit-dasm-pmi/jit-dasm-pmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Config
private IReadOnlyList<string> _methods = Array.Empty<string>();
private IReadOnlyList<string> _platformPaths = Array.Empty<string>();
private bool _dumpGCInfo = false;
private bool _dumpDebugInfo = false;
private bool _noCopyJit = false;
private bool _verbose = false;
private bool _tiering = false;
Expand All @@ -54,6 +55,7 @@ public Config(string[] args)
syntax.DefineOption("o|output", ref _rootPath, "The output path.");
syntax.DefineOption("f|file", ref _fileName, "Name of file to take list of assemblies from. Both a file and assembly list can be used.");
syntax.DefineOption("gcinfo", ref _dumpGCInfo, "Add GC info to the disasm output.");
syntax.DefineOption("debuginfo", ref _dumpDebugInfo, "Add Debug info to the disasm output.");
syntax.DefineOption("v|verbose", ref _verbose, "Enable verbose output.");
syntax.DefineOption("t|tiering", ref _tiering, "Enable tiered jitting");
syntax.DefineOption("r|recursive", ref _recursive, "Scan directories recursively.");
Expand Down Expand Up @@ -140,6 +142,7 @@ private void Validate()
public bool Recursive { get { return _recursive; } }
public bool UseFileName { get { return (_fileName != null); } }
public bool DumpGCInfo { get { return _dumpGCInfo; } }
public bool DumpDebugInfo { get { return _dumpDebugInfo; } }
public bool DoVerboseOutput { get { return _verbose; } }
public bool CopyJit { get { return !_noCopyJit; } }
public string CorerunExecutable { get { return _corerunExe; } }
Expand Down Expand Up @@ -346,6 +349,7 @@ private class DisasmEnginePmi
private string _altjit = null;
private List<AssemblyInfo> _assemblyInfoList;
public bool doGCDump = false;
public bool doDebugDump = false;
public bool verbose = false;
private int _errorCount = 0;

Expand All @@ -370,6 +374,7 @@ public DisasmEnginePmi(string executable, Config config, string outputPath,
_assemblyInfoList = assemblyInfoList;

this.doGCDump = config.DumpGCInfo;
this.doDebugDump = config.DumpDebugInfo;
this.verbose = config.DoVerboseOutput;
}

Expand Down Expand Up @@ -493,6 +498,11 @@ void AddEnvironmentVariable(string varName, string varValue)
AddEnvironmentVariable("COMPlus_JitGCDump", "*");
}

if (this.doDebugDump)
{
AddEnvironmentVariable("COMPlus_JitDebugDump", "*");
}

if (this._altjit != null)
{
AddEnvironmentVariable("COMPlus_AltJit", "*");
Expand Down
10 changes: 10 additions & 0 deletions src/jit-dasm/jit-dasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class Config
private IReadOnlyList<string> _methods = Array.Empty<string>();
private IReadOnlyList<string> _platformPaths = Array.Empty<string>();
private bool _dumpGCInfo = false;
private bool _dumpDebugInfo = false;
private bool _verbose = false;

public Config(string[] args)
Expand All @@ -59,6 +60,7 @@ public Config(string[] args)
syntax.DefineOption("o|output", ref _rootPath, "The output path.");
syntax.DefineOption("f|file", ref _fileName, "Name of file to take list of assemblies from. Both a file and assembly list can be used.");
syntax.DefineOption("gcinfo", ref _dumpGCInfo, "Add GC info to the disasm output.");
syntax.DefineOption("debuginfo", ref _dumpDebugInfo, "Add Debug info to the disasm output.");
syntax.DefineOption("v|verbose", ref _verbose, "Enable verbose output.");
var waitArg = syntax.DefineOption("w|wait", ref _wait, "Wait for debugger to attach.");
waitArg.IsHidden = true;
Expand Down Expand Up @@ -141,6 +143,7 @@ private void Validate()
public bool Recursive { get { return _recursive; } }
public bool UseFileName { get { return (_fileName != null); } }
public bool DumpGCInfo { get { return _dumpGCInfo; } }
public bool DumpDebugInfo { get { return _dumpDebugInfo; } }
public bool DoVerboseOutput { get { return _verbose; } }
public string CrossgenExecutable { get { return _crossgenExe; } }
public string JitPath { get { return _jitPath; } }
Expand Down Expand Up @@ -345,6 +348,7 @@ private class DisasmEngine
private string _altjit = null;
private List<AssemblyInfo> _assemblyInfoList;
public bool doGCDump = false;
public bool doDebugDump = false;
public bool verbose = false;
private int _errorCount = 0;

Expand All @@ -362,6 +366,7 @@ public DisasmEngine(string executable, Config config, string outputPath,
_assemblyInfoList = assemblyInfoList;

this.doGCDump = config.DumpGCInfo;
this.doDebugDump = config.DumpDebugInfo;
this.verbose = config.DoVerboseOutput;
}

Expand Down Expand Up @@ -471,6 +476,11 @@ void AddEnvironmentVariable(string varName, string varValue)
AddEnvironmentVariable("COMPlus_NgenGCDump", "*");
}

if (this.doDebugDump)
{
AddEnvironmentVariable("COMPlus_NgenDebugDump", "*");
}

if (this._altjit != null)
{
AddEnvironmentVariable("COMPlus_AltJit", "*");
Expand Down
5 changes: 5 additions & 0 deletions src/jit-diff/diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ public static int DiffCommand(Config config)
commandArgs.Add("--gcinfo");
}

if (config.GenerateDebugInfo)
{
commandArgs.Add("--debuginfo");
}

if (config.Verbose)
{
commandArgs.Add("--verbose");
Expand Down
8 changes: 8 additions & 0 deletions src/jit-diff/jit-diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public class Config
private bool _benchmarks = false;
private bool _tests = false;
private bool _gcinfo = false;
private bool _debuginfo = false;
private bool _verbose = false;
private string _jobName = null;
private string _number = null;
Expand Down Expand Up @@ -178,6 +179,7 @@ public Config(string[] args)
syntax.DefineOption("benchmarks", ref _benchmarks, "Diff core benchmarks.");
syntax.DefineOption("tests", ref _tests, "Diff all tests.");
syntax.DefineOption("gcinfo", ref _gcinfo, "Add GC info to the disasm output.");
syntax.DefineOption("debuginfo", ref _debuginfo, "Add Debug info to the disasm output.");
syntax.DefineOption("v|verbose", ref _verbose, "Enable verbose output.");
syntax.DefineOption("core_root", ref _platformPath, "Path to test CORE_ROOT.");
syntax.DefineOption("test_root", ref _testPath, "Path to test tree. Use with --benchmarks or --tests.");
Expand Down Expand Up @@ -1085,6 +1087,10 @@ private void LoadFileConfig()
var gcinfo = ExtractDefault<bool>("gcinfo", out found);
_gcinfo = (found) ? gcinfo : _gcinfo;

// Set flag from default for debuginfo.
var debuginfo = ExtractDefault<bool>("debuginfo", out found);
_debuginfo = (found) ? debuginfo : _debuginfo;

// Set flag from default for tag.
var tag = ExtractDefault<string>("tag", out found);
_tag = (found) ? tag : _tag;
Expand Down Expand Up @@ -1167,6 +1173,7 @@ public int ListCommand()
PrintDefault("benchmarks", DefaultType.DT_bool);
PrintDefault("tests", DefaultType.DT_bool);
PrintDefault("gcinfo", DefaultType.DT_bool);
PrintDefault("debuginfo", DefaultType.DT_bool);
PrintDefault("tag", DefaultType.DT_string);
PrintDefault("verbose", DefaultType.DT_bool);

Expand Down Expand Up @@ -1221,6 +1228,7 @@ public int ListCommand()
public bool Benchmarks { get { return _benchmarks; } }
public bool DoTestTree { get { return _tests; } }
public bool GenerateGCInfo { get { return _gcinfo; } }
public bool GenerateDebugInfo { get { return _debuginfo; } }
public bool Verbose { get { return _verbose; } }
public bool DoAnalyze { get { return !_noanalyze; } }
public Commands DoCommand { get { return _command; } }
Expand Down

0 comments on commit b74d29f

Please sign in to comment.