Output formatting changes for unwindInfo and section contents
authorAmy Yu <amycmyu@gmail.com>
Thu, 7 Jun 2018 01:00:58 +0000 (18:00 -0700)
committerAmy Yu <amycmyu@gmail.com>
Tue, 19 Jun 2018 20:26:01 +0000 (13:26 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/957c4db6eb24cdbe87fcd02a658ab99b50f8d304

src/coreclr/src/tools/r2rdump/R2RDump.cs
src/coreclr/src/tools/r2rdump/UnwindInfo.cs

index 2e2c27c..fce9fbd 100644 (file)
@@ -54,7 +54,7 @@ namespace R2RDump
                 syntax.DefineOption("types", ref _types, "Dump available types");
                 syntax.DefineOption("unwind", ref _unwind, "Dump unwindInfo");
                 syntax.DefineOption("gc", ref _gc, "Dump gcInfo and slot table");
-                syntax.DefineOption("v|verbose", ref verbose, "Dump raw bytes, disassembly, unwindInfo and gcInfo");
+                syntax.DefineOption("v|verbose", ref verbose, "Dump raw bytes, disassembly, unwindInfo, gcInfo and section contents");
                 syntax.DefineOption("diff", ref _diff, "Compare two R2R images (not yet implemented)");
             });
 
@@ -64,6 +64,7 @@ namespace R2RDump
                 _disasm = true;
                 _unwind = true;
                 _gc = true;
+                _types = true;
             }
 
             return argSyntax;
@@ -147,6 +148,11 @@ namespace R2RDump
             {
                 DumpBytes(r2r, section.RelativeVirtualAddress, (uint)section.Size);
             }
+            if (_types)
+            {
+                _writer.WriteLine();
+                DumpAvailableTypes(r2r);
+            }
         }
 
         /// <summary>
@@ -236,7 +242,6 @@ namespace R2RDump
 
         private void DumpAvailableTypes(R2RReader r2r)
         {
-            WriteDivider("Available Types");
             foreach (string name in r2r.AvailableTypes)
             {
                 _writer.WriteLine(name);
@@ -353,6 +358,10 @@ namespace R2RDump
                 {
                     DumpHeader(r2r, false);
                 }
+                if (_types)
+                {
+                    DumpSection(r2r, r2r.R2RHeader.Sections[R2RSection.SectionType.READYTORUN_SECTION_AVAILABLE_TYPES]);
+                }
 
                 QuerySection(r2r, _sections);
                 QueryRuntimeFunction(r2r, _runtimeFunctions);
@@ -360,11 +369,6 @@ namespace R2RDump
                 QueryMethod(r2r, "R2R Methods by Keyword", _keywords, false);
             }
 
-            if (_types)
-            {
-                DumpAvailableTypes(r2r);
-            }
-
             _writer.WriteLine("=============================================================");
             _writer.WriteLine();
         }
index da12f4f..c7f60a5 100644 (file)
@@ -35,18 +35,16 @@ namespace R2RDump
         {
             StringBuilder sb = new StringBuilder();
 
-            sb.AppendLine($"\t\t{{");
-            sb.AppendLine($"\t\t\tCodeOffset: {CodeOffset}");
-            sb.AppendLine($"\t\t\tUnwindOp: {UnwindOp}");
-            sb.AppendLine($"\t\t\tOpInfo: {OpInfo}");
-            sb.AppendLine($"\t\t}}");
-            sb.AppendLine($"\t\t{{");
-            sb.AppendLine($"\t\t\tOffsetLow: {OffsetLow}");
-            sb.AppendLine($"\t\t\tUnwindOp: {UnwindOp}");
-            sb.AppendLine($"\t\t\tOffsetHigh: {OffsetHigh}");
-            sb.AppendLine($"\t\t}}");
+            sb.AppendLine($"\t\tCodeOffset: {CodeOffset}");
+            sb.AppendLine($"\t\tUnwindOp: {UnwindOp}");
+            sb.AppendLine($"\t\tOpInfo: {OpInfo}");
+            sb.AppendLine();
+            sb.AppendLine($"\t\tOffsetLow: {OffsetLow}");
+            sb.AppendLine($"\t\tUnwindOp: {UnwindOp}");
+            sb.AppendLine($"\t\tOffsetHigh: {OffsetHigh}");
+            sb.AppendLine();
             sb.AppendLine($"\t\tFrameOffset: {FrameOffset}");
-            sb.AppendLine($"\t\t------------------");
+            sb.AppendLine($"\t\t--------------------");
 
             return sb.ToString();
         }