[lld] r310107 - [llvm-pdbutil] Dump image section headers.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 13:02:38 PDT 2017


Author: zturner
Date: Fri Aug  4 13:02:38 2017
New Revision: 310107

URL: http://llvm.org/viewvc/llvm-project?rev=310107&view=rev
Log:
[llvm-pdbutil] Dump image section headers.

Image section headers are stored in the DBI stream, but we
had no way to dump them.  This patch adds dumping support,
along with some tests that LLD actually dumps them correctly.

Differential Revision: https://reviews.llvm.org/D36332

Modified:
    lld/trunk/test/COFF/pdb.test

Modified: lld/trunk/test/COFF/pdb.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb.test?rev=310107&r1=310106&r2=310107&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb.test (original)
+++ lld/trunk/test/COFF/pdb.test Fri Aug  4 13:02:38 2017
@@ -6,7 +6,7 @@
 # RUN: llvm-pdbutil pdb2yaml -stream-metadata -stream-directory -pdb-stream \
 # RUN:   -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
 
-# RUN: llvm-pdbutil dump -modules -section-map -section-contribs \
+# RUN: llvm-pdbutil dump -modules -section-map -section-contribs -section-headers \
 # RUN:   -publics -public-extras -types -ids -type-extras -id-extras %t.pdb \
 # RUN:   | FileCheck -check-prefix RAW %s
 
@@ -188,6 +188,64 @@ RAW-NEXT:    0x0000000c
 RAW-NEXT:  Address Map
 RAW-NEXT:    off = 20
 RAW-NEXT:    off = 0
+RAW:                            Section Headers
+RAW-NEXT: ============================================================
+RAW:        SECTION HEADER #1
+RAW-NEXT:     .pdata name
+RAW-NEXT:          C virtual size
+RAW-NEXT:       1000 virtual address
+RAW-NEXT:        200 size of raw data
+RAW-NEXT:        400 file pointer to raw data
+RAW-NEXT:          0 file pointer to relocation table
+RAW-NEXT:          0 file pointer to line numbers
+RAW-NEXT:          0 number of relocations
+RAW-NEXT:          0 number of line numbers
+RAW-NEXT:   40000040 flags
+RAW-NEXT:            IMAGE_SCN_CNT_INITIALIZED_DATA
+RAW-NEXT:            IMAGE_SCN_MEM_READ
+RAW:        SECTION HEADER #2
+RAW-NEXT:      .text name
+RAW-NEXT:         16 virtual size
+RAW-NEXT:       2000 virtual address
+RAW-NEXT:        200 size of raw data
+RAW-NEXT:        600 file pointer to raw data
+RAW-NEXT:          0 file pointer to relocation table
+RAW-NEXT:          0 file pointer to line numbers
+RAW-NEXT:          0 number of relocations
+RAW-NEXT:          0 number of line numbers
+RAW-NEXT:   60000020 flags
+RAW-NEXT:            IMAGE_SCN_CNT_CODE
+RAW-NEXT:            IMAGE_SCN_MEM_EXECUTE
+RAW-NEXT:            IMAGE_SCN_MEM_READ
+RAW:        SECTION HEADER #3
+RAW-NEXT:     .xdata name
+RAW-NEXT:          8 virtual size
+RAW-NEXT:       3000 virtual address
+RAW-NEXT:        200 size of raw data
+RAW-NEXT:        800 file pointer to raw data
+RAW-NEXT:          0 file pointer to relocation table
+RAW-NEXT:          0 file pointer to line numbers
+RAW-NEXT:          0 number of relocations
+RAW-NEXT:          0 number of line numbers
+RAW-NEXT:   40000040 flags
+RAW-NEXT:            IMAGE_SCN_CNT_INITIALIZED_DATA
+RAW-NEXT:            IMAGE_SCN_MEM_READ
+RAW:        SECTION HEADER #4
+RAW-NEXT:     .rdata name
+RAW-NEXT:         77 virtual size
+RAW-NEXT:       4000 virtual address
+RAW-NEXT:        200 size of raw data
+RAW-NEXT:        A00 file pointer to raw data
+RAW-NEXT:          0 file pointer to relocation table
+RAW-NEXT:          0 file pointer to line numbers
+RAW-NEXT:          0 number of relocations
+RAW-NEXT:          0 number of line numbers
+RAW-NEXT:   40000040 flags
+RAW-NEXT:            IMAGE_SCN_CNT_INITIALIZED_DATA
+RAW-NEXT:            IMAGE_SCN_MEM_READ
+RAW:                        Original Section Headers
+RAW-NEXT: ============================================================
+RAW-NEXT:   PDB does not contain the requested image section header type
 RAW:                        Section Contributions
 RAW-NEXT: ============================================================
 RAW-NEXT:   SC  | mod = 0, 0001:0000, size = 12, data crc = 0, reloc crc = 0
@@ -202,18 +260,18 @@ RAW-NEXT:   SC  | mod = 0, 0003:0000, si
 RAW-NEXT:         IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
 RAW:                             Section Map
 RAW-NEXT: ============================================================
-RAW-NEXT:   Section 0000 | ovl = 0, group = 0, frame = 0, name = 1
+RAW-NEXT:   Section 0000 | ovl = 0, group = 0, frame = 1, name = 65535
 RAW-NEXT:                  class = 65535, offset = 0, size =
 RAW-NEXT:                  flags = read | 32 bit addr | selector
-RAW-NEXT:   Section 0001 | ovl = 1, group = 0, frame = 0, name = 2
+RAW-NEXT:   Section 0001 | ovl = 0, group = 0, frame = 2, name = 65535
 RAW-NEXT:                  class = 65535, offset = 0, size =
 RAW-NEXT:                  flags = read | execute | 32 bit addr | selector
-RAW-NEXT:   Section 0002 | ovl = 2, group = 0, frame = 0, name = 3
+RAW-NEXT:   Section 0002 | ovl = 0, group = 0, frame = 3, name = 65535
 RAW-NEXT:                  class = 65535, offset = 0, size =
 RAW-NEXT:                  flags = read | 32 bit addr | selector
-RAW-NEXT:   Section 0003 | ovl = 3, group = 0, frame = 0, name = 4
+RAW-NEXT:   Section 0003 | ovl = 0, group = 0, frame = 4, name = 65535
 RAW-NEXT:                  class = 65535, offset = 0, size =
 RAW-NEXT:                  flags = read | 32 bit addr | selector
-RAW-NEXT:   Section 0004 | ovl = 4, group = 0, frame = 0, name = 5
+RAW-NEXT:   Section 0004 | ovl = 0, group = 0, frame = 5, name = 65535
 RAW-NEXT:                  class = 65535, offset = 0, size =
 RAW-NEXT:                  flags = 32 bit addr | absolute addr




More information about the llvm-commits mailing list