test: Fix coff-dump section array indicies to 1 based to match file format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer 2010-09-15 03:58:51 +00:00
parent 9c0c5c16e9
commit 00002796bb
3 changed files with 11 additions and 9 deletions

View File

@ -24,7 +24,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: SizeOfOptionalHeader = 0 ; CHECK: SizeOfOptionalHeader = 0
; CHECK: Characteristics = 0x0 ; CHECK: Characteristics = 0x0
; CHECK: Sections = [ ; CHECK: Sections = [
; CHECK: 0 = { ; CHECK: 1 = {
; CHECK: Name = .text ; CHECK: Name = .text
; CHECK: VirtualSize = 0 ; CHECK: VirtualSize = 0
; CHECK: VirtualAddress = 0 ; CHECK: VirtualAddress = 0
@ -57,7 +57,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: } ; CHECK: }
; CHECK: ] ; CHECK: ]
; CHECK: } ; CHECK: }
; CHECK: 1 = { ; CHECK: 2 = {
; CHECK: Name = .data ; CHECK: Name = .data
; CHECK: VirtualSize = 0 ; CHECK: VirtualSize = 0
; CHECK: VirtualAddress = 0 ; CHECK: VirtualAddress = 0

View File

@ -28,7 +28,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: SizeOfOptionalHeader = 0 ; CHECK: SizeOfOptionalHeader = 0
; CHECK: Characteristics = 0x0 ; CHECK: Characteristics = 0x0
; CHECK: Sections = [ ; CHECK: Sections = [
; CHECK: 0 = { ; CHECK: 1 = {
; CHECK: Name = .text ; CHECK: Name = .text
; CHECK: VirtualSize = 0 ; CHECK: VirtualSize = 0
; CHECK: VirtualAddress = 0 ; CHECK: VirtualAddress = 0
@ -75,7 +75,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: } ; CHECK: }
; CHECK: ] ; CHECK: ]
; CHECK: } ; CHECK: }
; CHECK: 1 = { ; CHECK: 2 = {
; CHECK: Name = .data ; CHECK: Name = .data
; CHECK: VirtualSize = 0 ; CHECK: VirtualSize = 0
; CHECK: VirtualAddress = 0 ; CHECK: VirtualAddress = 0

View File

@ -73,7 +73,7 @@ file = ('struct', [
(0x4000, 'IMAGE_FILE_UP_SYSTEM_ONLY', ), (0x4000, 'IMAGE_FILE_UP_SYSTEM_ONLY', ),
(0x8000, 'IMAGE_FILE_BYTES_REVERSED_HI', ), (0x8000, 'IMAGE_FILE_BYTES_REVERSED_HI', ),
])), ])),
('Sections', ('array', 'NumberOfSections', ('struct', [ ('Sections', ('array', '1', 'NumberOfSections', ('struct', [
('Name', ('scalar', '<8s', secname)), ('Name', ('scalar', '<8s', secname)),
('VirtualSize', ('scalar', '<L', '%d' )), ('VirtualSize', ('scalar', '<L', '%d' )),
('VirtualAddress', ('scalar', '<L', '%d' )), ('VirtualAddress', ('scalar', '<L', '%d' )),
@ -123,7 +123,7 @@ file = ('struct', [
(0x80000000, 'IMAGE_SCN_MEM_WRITE'), (0x80000000, 'IMAGE_SCN_MEM_WRITE'),
])), ])),
('SectionData', ('ptr', 'PointerToRawData', ('blob', 'SizeOfRawData'))), ('SectionData', ('ptr', 'PointerToRawData', ('blob', 'SizeOfRawData'))),
('Relocations', ('ptr', 'PointerToRelocations', ('array', 'NumberOfRelocations', ('struct', [ ('Relocations', ('ptr', 'PointerToRelocations', ('array', '0', 'NumberOfRelocations', ('struct', [
('VirtualAddress', ('scalar', '<L', '0x%X')), ('VirtualAddress', ('scalar', '<L', '0x%X')),
('SymbolTableIndex', ('scalar', '<L', '%d' )), ('SymbolTableIndex', ('scalar', '<L', '%d' )),
('Type', ('enum', '<H', '%d', ('MachineType', { ('Type', ('enum', '<H', '%d', ('MachineType', {
@ -463,18 +463,20 @@ def handle_struct(entry):
return newFields return newFields
def handle_array(entry): def handle_array(entry):
length = entry[1] start_index = entry[1]
element = entry[2] length = entry[2]
element = entry[3]
newItems = [] newItems = []
write("[\n") write("[\n")
indent() indent()
start_index = read_value(start_index)
value = read_value(length) value = read_value(length)
for index in xrange(value): for index in xrange(value):
write("%d = "%index) write("%d = " % (index + start_index))
value = handle_element(element) value = handle_element(element)
write("\n") write("\n")
newItems.append(value) newItems.append(value)