]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Add Mark's test cases
authorPetr Machata <pmachata@redhat.com>
Thu, 3 Mar 2011 16:47:54 +0000 (17:47 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 3 Mar 2011 16:47:54 +0000 (17:47 +0100)
dwarflint/Makefile.am
dwarflint/tests/hello.bad-1.bz2 [new file with mode: 0644]
dwarflint/tests/hello.bad-1.s [new file with mode: 0644]
dwarflint/tests/hello.bad-2.s [new file with mode: 0644]
dwarflint/tests/run-bad.sh [new file with mode: 0755]
dwarflint/tests/run-test-all-dies-it.sh

index 75c215a016d8a25d34651ddcb026755a8c148620..05fea4d4606f5f098ccb3613fdc1c024ac5bd7df 100644 (file)
@@ -101,7 +101,8 @@ EXTRA_TESTS = tests/run-debug_abbrev-duplicate-attribute.sh \
        tests/run-check_debug_info_refs.sh \
        tests/run-aranges_terminate_early.sh \
        tests/run-libdl-2.12.so.debug.sh \
-       tests/run-test-all-dies-it.sh
+       tests/run-test-all-dies-it.sh \
+       tests/run-bad.sh
 
 TESTS = $(EXTRA_TESTS) \
        tests/test-coverage \
diff --git a/dwarflint/tests/hello.bad-1.bz2 b/dwarflint/tests/hello.bad-1.bz2
new file mode 100644 (file)
index 0000000..52531ff
Binary files /dev/null and b/dwarflint/tests/hello.bad-1.bz2 differ
diff --git a/dwarflint/tests/hello.bad-1.s b/dwarflint/tests/hello.bad-1.s
new file mode 100644 (file)
index 0000000..8679ec1
--- /dev/null
@@ -0,0 +1,246 @@
+       .file   "hello.c"
+# GNU C (GCC) version 4.5.1 20100924 (Red Hat 4.5.1-4) (x86_64-redhat-linux)
+#      compiled by GNU C version 4.5.1 20100924 (Red Hat 4.5.1-4), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8.1
+# GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
+# options passed:  hello.c -mtune=generic -march=x86-64 -g -fverbose-asm
+# options enabled:  -falign-loops -fargument-alias
+# -fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg -fcommon
+# -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
+# -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident
+# -finline-functions-called-once -fira-share-save-slots
+# -fira-share-spill-slots -fivopts -fkeep-static-consts
+# -fleading-underscore -fmath-errno -fmerge-debug-strings
+# -fmove-loop-invariants -fpeephole -freg-struct-return
+# -fsched-critical-path-heuristic -fsched-dep-count-heuristic
+# -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
+# -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
+# -fsched-stalled-insns-dep -fshow-column -fsigned-zeros
+# -fsplit-ivs-in-unroller -ftrapping-math -ftree-cselim -ftree-forwprop
+# -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
+# -ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc
+# -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version
+# -funit-at-a-time -funwind-tables -fvect-cost-model -fverbose-asm
+# -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
+# -maccumulate-outgoing-args -malign-stringops -mfancy-math-387
+# -mfp-ret-in-387 -mfused-madd -mglibc -mieee-fp -mmmx -mno-sse4
+# -mpush-args -mred-zone -msse -msse2 -mtls-direct-seg-refs
+
+       .section        .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+       .section        .debug_info,"",@progbits
+.Ldebug_info0:
+       .section        .debug_line,"",@progbits
+.Ldebug_line0:
+       .text
+.Ltext0:
+# Compiler executable checksum: ea394b69293dd698607206e8e43d607e
+
+.globl main
+       .type   main, @function
+main:
+.LFB0:
+       .file 1 "hello.c"
+       # hello.c:3
+       .loc 1 3 0
+       .cfi_startproc
+       # basic block 2
+       pushq   %rbp    #       # 15    *pushdi2_rex64/1        [length = 1]
+       .cfi_def_cfa_offset 16
+       .cfi_offset 6, -16
+       movq    %rsp, %rbp      #,      # 16    *movdi_1_rex64/2        [length = 3]
+       .cfi_def_cfa_register 6
+       movl    %edi, -4(%rbp)  # argc, argc    # 2     *movsi_1/2      [length = 3]
+       movq    %rsi, -16(%rbp) # argv, argv    # 3     *movdi_1_rex64/4        [length = 4]
+       # hello.c:4
+       .loc 1 4 0
+       leave   # 21    leave_rex64     [length = 1]
+       .cfi_def_cfa 7, 8
+       ret     # 22    return_internal [length = 1]
+       .cfi_endproc
+.LFE0:
+       .size   main, .-main
+.Letext0:
+       .section        .debug_info
+       .long   0x84    # Length of Compilation Unit Info
+       .value  0x3     # DWARF version number
+       .long   .Ldebug_abbrev0 # Offset Into Abbrev. Section
+       .byte   0x8     # Pointer Size (in bytes)
+       .uleb128 0x1    # (DIE (0xb) DW_TAG_compile_unit)
+       .long   .LASF3  # DW_AT_producer: "GNU C 4.5.1 20100924 (Red Hat 4.5.1-4)"
+       .byte   0x1     # DW_AT_language
+       .long   .LASF4  # DW_AT_name: "hello.c"
+       .long   .LASF5  # DW_AT_comp_dir: "/home/mark/src/tests"
+       .quad   .Ltext0 # DW_AT_low_pc
+       .quad   .Letext0        # DW_AT_high_pc
+       .long   .Ldebug_line0   # DW_AT_stmt_list
+       .uleb128 0x2    # (DIE (0x2d) DW_TAG_subprogram)
+       .byte   0x1     # DW_AT_external
+       .long   .LASF6  # DW_AT_name: "main"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .byte   0x1     # DW_AT_prototyped
+       .long   0x6d    # DW_AT_type
+       .quad   .LFB0   # DW_AT_low_pc
+       .quad   .LFE0   # DW_AT_high_pc
+       .byte   0x1     # DW_AT_frame_base
+       .byte   0x9c    # DW_OP_call_frame_cfa
+       .long   0x6d    # DW_AT_sibling
+       .uleb128 0x3    # (DIE (0x50) DW_TAG_formal_parameter)
+       .long   .LASF0  # DW_AT_name: "argc"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .long   0x6d    # DW_AT_type
+       .byte   0x2     # DW_AT_location
+       .byte   0x91    # DW_OP_fbreg
+       .sleb128 -20
+       .uleb128 0x3    # (DIE (0x5e) DW_TAG_formal_parameter)
+       .long   .LASF1  # DW_AT_name: "argv"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .long   0x74    # DW_AT_type
+       .byte   0x2     # DW_AT_location
+       .byte   0x91    # DW_OP_fbreg
+       .sleb128 -32
+       .byte   0x0     # end of children of DIE 0x2d
+       .uleb128 0x4    # (DIE (0x6d) DW_TAG_base_type)
+       .byte   0x4     # DW_AT_byte_size
+       .byte   0x5     # DW_AT_encoding
+       .ascii "int\0"  # DW_AT_name
+       .uleb128 0x5    # (DIE (0x74) DW_TAG_pointer_type)
+       .byte   0x8     # DW_AT_byte_size
+       .long   0x7a    # DW_AT_type
+       .uleb128 0x5    # (DIE (0x7a) DW_TAG_pointer_type)
+       .byte   0x8     # DW_AT_byte_size
+       .long   0x80    # DW_AT_type
+       .uleb128 0x6    # (DIE (0x80) DW_TAG_base_type)
+       .byte   0x1     # DW_AT_byte_size
+       .byte   0x6     # DW_AT_encoding
+       .long   .LASF2  # DW_AT_name: "char"
+       .byte   0x0     # end of children of DIE 0xb
+       .section        .debug_abbrev
+       .uleb128 0x1    # (abbrev code)
+       .uleb128 0x11   # (TAG: DW_TAG_compile_unit)
+       .byte   0x1     # DW_children_yes
+       .uleb128 0x25   # (DW_AT_producer)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x13   # (DW_AT_language)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x1b   # (DW_AT_comp_dir)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x11   # (DW_AT_low_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x12   # (DW_AT_high_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x10   # (DW_AT_stmt_list)
+       .uleb128 0x6    # (DW_FORM_data4)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x2    # (abbrev code)
+       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
+       .byte   0x1     # DW_children_yes
+       .uleb128 0x3f   # (DW_AT_external)
+       .uleb128 0xc    # (DW_FORM_flag)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x3a   # (DW_AT_decl_file)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3b   # (DW_AT_decl_line)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x27   # (DW_AT_prototyped)
+       .uleb128 0xc    # (DW_FORM_flag)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .uleb128 0x11   # (DW_AT_low_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x12   # (DW_AT_high_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x40   # (DW_AT_frame_base)
+       .uleb128 0xa    # (DW_FORM_block1)
+       .uleb128 0x1    # (DW_AT_sibling)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x3    # (abbrev code)
+       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
+       .byte   0x0     # DW_children_no
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x3a   # (DW_AT_decl_file)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3b   # (DW_AT_decl_line)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .uleb128 0x2    # (DW_AT_location)
+       .uleb128 0xa    # (DW_FORM_block1)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x4    # (abbrev code)
+       .uleb128 0x24   # (TAG: DW_TAG_base_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3e   # (DW_AT_encoding)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0x8    # (DW_FORM_string)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x5    # (abbrev code)
+       .uleb128 0xf    # (TAG: DW_TAG_pointer_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x6    # (abbrev code)
+       .uleb128 0x24   # (TAG: DW_TAG_base_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3e   # (DW_AT_encoding)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .byte   0x0
+       .byte   0x0
+       .byte   0x0
+       .section        .debug_pubnames,"",@progbits
+       .long   0x17    # Length of Public Names Info
+       .value  0x2     # DWARF Version
+       .long   .Ldebug_info0   # Offset of Compilation Unit Info
+       .long   0x88    # Compilation Unit Length
+       .long   0x2d    # DIE offset
+       .ascii "main\0" # external name
+       .long   0x0
+       .section        .debug_aranges,"",@progbits
+       .long   0x2c    # Length of Address Ranges Info
+       .value  0x2     # DWARF Version
+       .long   .Ldebug_info0   # Offset of Compilation Unit Info
+       .byte   0x8     # Size of Address
+       .byte   0x0     # Size of Segment Descriptor
+       .value  0x0     # Pad to 16 byte boundary
+       .value  0x0
+       .quad   .Ltext0 # Address
+       .quad   .Letext0-.Ltext0        # Length
+       .quad   0x0
+       .quad   0x0
+       .section        .debug_str,"MS",@progbits,1
+.LASF1:
+       .string "argv"
+.LASF4:
+       .string "hello.c"
+.LASF5:
+       .string "/home/mark/src/tests"
+.LASF6:
+       .string "main"
+.LASF0:
+       .string "argc"
+.LASF3:
+       .string "GNU C 4.5.1 20100924 (Red Hat 4.5.1-4)"
+.LASF2:
+       .string "char"
+       .ident  "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)"
+       .section        .note.GNU-stack,"",@progbits
diff --git a/dwarflint/tests/hello.bad-2.s b/dwarflint/tests/hello.bad-2.s
new file mode 100644 (file)
index 0000000..5fcd2d5
--- /dev/null
@@ -0,0 +1,246 @@
+       .file   "hello.c"
+# GNU C (GCC) version 4.5.1 20100924 (Red Hat 4.5.1-4) (x86_64-redhat-linux)
+#      compiled by GNU C version 4.5.1 20100924 (Red Hat 4.5.1-4), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8.1
+# GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
+# options passed:  hello.c -mtune=generic -march=x86-64 -g -fverbose-asm
+# options enabled:  -falign-loops -fargument-alias
+# -fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg -fcommon
+# -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
+# -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident
+# -finline-functions-called-once -fira-share-save-slots
+# -fira-share-spill-slots -fivopts -fkeep-static-consts
+# -fleading-underscore -fmath-errno -fmerge-debug-strings
+# -fmove-loop-invariants -fpeephole -freg-struct-return
+# -fsched-critical-path-heuristic -fsched-dep-count-heuristic
+# -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
+# -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
+# -fsched-stalled-insns-dep -fshow-column -fsigned-zeros
+# -fsplit-ivs-in-unroller -ftrapping-math -ftree-cselim -ftree-forwprop
+# -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
+# -ftree-parallelize-loops= -ftree-phiprop -ftree-pta -ftree-reassoc
+# -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version
+# -funit-at-a-time -funwind-tables -fvect-cost-model -fverbose-asm
+# -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
+# -maccumulate-outgoing-args -malign-stringops -mfancy-math-387
+# -mfp-ret-in-387 -mfused-madd -mglibc -mieee-fp -mmmx -mno-sse4
+# -mpush-args -mred-zone -msse -msse2 -mtls-direct-seg-refs
+
+       .section        .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+       .section        .debug_info,"",@progbits
+.Ldebug_info0:
+       .section        .debug_line,"",@progbits
+.Ldebug_line0:
+       .text
+.Ltext0:
+# Compiler executable checksum: ea394b69293dd698607206e8e43d607e
+
+.globl main
+       .type   main, @function
+main:
+.LFB0:
+       .file 1 "hello.c"
+       # hello.c:3
+       .loc 1 3 0
+       .cfi_startproc
+       # basic block 2
+       pushq   %rbp    #       # 15    *pushdi2_rex64/1        [length = 1]
+       .cfi_def_cfa_offset 16
+       .cfi_offset 6, -16
+       movq    %rsp, %rbp      #,      # 16    *movdi_1_rex64/2        [length = 3]
+       .cfi_def_cfa_register 6
+       movl    %edi, -4(%rbp)  # argc, argc    # 2     *movsi_1/2      [length = 3]
+       movq    %rsi, -16(%rbp) # argv, argv    # 3     *movdi_1_rex64/4        [length = 4]
+       # hello.c:4
+       .loc 1 4 0
+       leave   # 21    leave_rex64     [length = 1]
+       .cfi_def_cfa 7, 8
+       ret     # 22    return_internal [length = 1]
+       .cfi_endproc
+.LFE0:
+       .size   main, .-main
+.Letext0:
+       .section        .debug_info
+       .long   0x84    # Length of Compilation Unit Info
+       .value  0x3     # DWARF version number
+       .long   .Ldebug_abbrev0 # Offset Into Abbrev. Section
+       .byte   0x8     # Pointer Size (in bytes)
+       .uleb128 0x1    # (DIE (0xb) DW_TAG_compile_unit)
+       .long   .LASF3  # DW_AT_producer: "GNU C 4.5.1 20100924 (Red Hat 4.5.1-4)"
+       .byte   0x1     # DW_AT_language
+       .long   .LASF4  # DW_AT_name: "hello.c"
+       .long   .LASF5  # DW_AT_comp_dir: "/home/mark/src/tests"
+       .quad   .Ltext0 # DW_AT_low_pc
+       .quad   .Letext0        # DW_AT_high_pc
+       .long   .Ldebug_line0   # DW_AT_stmt_list
+       .uleb128 0x2    # (DIE (0x2d) DW_TAG_subprogram)
+       .byte   0x1     # DW_AT_external
+       .long   .LASF6  # DW_AT_name: "main"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .byte   0x1     # DW_AT_prototyped
+       .long   0x6d    # DW_AT_type
+       .quad   .LFB0   # DW_AT_low_pc
+       .quad   .LFE0   # DW_AT_high_pc
+       .byte   0x1     # DW_AT_frame_base
+       .byte   0x9c    # DW_OP_call_frame_cfa
+       .long   0x6d    # DW_AT_sibling
+       .uleb128 0x3    # (DIE (0x50) DW_TAG_formal_parameter)
+       .long   .LASF0  # DW_AT_name: "argc"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .long   0x6d    # DW_AT_type
+       .byte   0x2     # DW_AT_location
+       .byte   0x91    # DW_OP_fbreg
+       .sleb128 -20
+       .uleb128 0x3    # (DIE (0x5e) DW_TAG_formal_parameter)
+       .long   .LASF1  # DW_AT_name: "argv"
+       .byte   0x1     # DW_AT_decl_file (hello.c)
+       .byte   0x2     # DW_AT_decl_line
+       .long   0x74    # DW_AT_type
+       .byte   0x2     # DW_AT_location
+       .byte   0x91    # DW_OP_fbreg
+       .sleb128 -32
+       .byte   0x0     # end of children of DIE 0x2d
+       .uleb128 0x4    # (DIE (0x6d) DW_TAG_base_type)
+       .byte   0x4     # DW_AT_byte_size
+       .byte   0x5     # DW_AT_encoding
+       .ascii "int\0"  # DW_AT_name
+       .uleb128 0x5    # (DIE (0x74) DW_TAG_pointer_type)
+       .byte   0x8     # DW_AT_byte_size
+       .long   0x7a    # DW_AT_type
+       .uleb128 0x5    # (DIE (0x7a) DW_TAG_pointer_type)
+       .byte   0x8     # DW_AT_byte_size
+       .long   0x80    # DW_AT_type
+       .uleb128 0x6    # (DIE (0x80) DW_TAG_base_type)
+       .byte   0x1     # DW_AT_byte_size
+       .byte   0x6     # DW_AT_encoding
+       .long   .LASF2  # DW_AT_name: "char"
+       .byte   0x0     # end of children of DIE 0xb
+       .section        .debug_abbrev
+       .uleb128 0x1    # (abbrev code)
+       .uleb128 0x11   # (TAG: DW_TAG_compile_unit)
+       .byte   0x1     # DW_children_yes
+       .uleb128 0x25   # (DW_AT_producer)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x13   # (DW_AT_language)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x1b   # (DW_AT_comp_dir)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x11   # (DW_AT_low_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x12   # (DW_AT_high_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x2    # (abbrev code)
+       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
+       .byte   0x1     # DW_children_yes
+       .uleb128 0x3f   # (DW_AT_external)
+       .uleb128 0xc    # (DW_FORM_flag)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x3a   # (DW_AT_decl_file)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3b   # (DW_AT_decl_line)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x27   # (DW_AT_prototyped)
+       .uleb128 0xc    # (DW_FORM_flag)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .uleb128 0x11   # (DW_AT_low_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x12   # (DW_AT_high_pc)
+       .uleb128 0x1    # (DW_FORM_addr)
+       .uleb128 0x40   # (DW_AT_frame_base)
+       .uleb128 0xa    # (DW_FORM_block1)
+       .uleb128 0x1    # (DW_AT_sibling)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x3    # (abbrev code)
+       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
+       .byte   0x0     # DW_children_no
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .uleb128 0x3a   # (DW_AT_decl_file)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3b   # (DW_AT_decl_line)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .uleb128 0x2    # (DW_AT_location)
+       .uleb128 0xa    # (DW_FORM_block1)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x4    # (abbrev code)
+       .uleb128 0x24   # (TAG: DW_TAG_base_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3e   # (DW_AT_encoding)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0x8    # (DW_FORM_string)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x5    # (abbrev code)
+       .uleb128 0xf    # (TAG: DW_TAG_pointer_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x49   # (DW_AT_type)
+       .uleb128 0x13   # (DW_FORM_ref4)
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x6    # (abbrev code)
+       .uleb128 0x24   # (TAG: DW_TAG_base_type)
+       .byte   0x0     # DW_children_no
+       .uleb128 0xb    # (DW_AT_byte_size)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3e   # (DW_AT_encoding)
+       .uleb128 0xb    # (DW_FORM_data1)
+       .uleb128 0x3    # (DW_AT_name)
+       .uleb128 0xe    # (DW_FORM_strp)
+       .byte   0x0
+       .byte   0x0
+       .byte   0x0
+       .section        .debug_pubnames,"",@progbits
+       .long   0x17    # Length of Public Names Info
+       .value  0x2     # DWARF Version
+       .long   .Ldebug_info0   # Offset of Compilation Unit Info
+       .long   0x88    # Compilation Unit Length
+       .long   0x2d    # DIE offset
+       .ascii "main\0" # external name
+       .long   0x0
+       .section        .debug_aranges,"",@progbits
+       .long   0x2c    # Length of Address Ranges Info
+       .value  0x2     # DWARF Version
+       .long   .Ldebug_info0   # Offset of Compilation Unit Info
+       .byte   0x8     # Size of Address
+       .byte   0x0     # Size of Segment Descriptor
+       .value  0x0     # Pad to 16 byte boundary
+       .value  0x0
+       .quad   .Ltext0 # Address
+       .quad   .Letext0-.Ltext0        # Length
+       .quad   0x0
+       .quad   0x0
+       .section        .debug_str,"MS",@progbits,1
+.LASF1:
+       .string "argv"
+.LASF4:
+       .string "hello.c"
+.LASF5:
+       .string "/home/mark/src/tests"
+.LASF6:
+       .string "main"
+.LASF0:
+       .string "argc"
+.LASF3:
+       .string "GNU C 4.5.1 20100924 (Red Hat 4.5.1-4)"
+.LASF2:
+       .string "char"
+       .ident  "GCC: (GNU) 4.5.1 20100924 (Red Hat 4.5.1-4)"
+       .section        .note.GNU-stack,"",@progbits
diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh
new file mode 100755 (executable)
index 0000000..6e60500
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/sh
+# Copyright (C) 2011 Red Hat, Inc.
+# This file is part of Red Hat elfutils.
+#
+# Red Hat elfutils is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# Red Hat elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Red Hat elfutils; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+#
+# Red Hat elfutils is an included package of the Open Invention Network.
+# An included package of the Open Invention Network is a package for which
+# Open Invention Network licensees cross-license their patents.  No patent
+# license is granted, either expressly or impliedly, by designation as an
+# included package.  Should you wish to participate in the Open Invention
+# Network licensing program, please visit www.openinventionnetwork.com
+# <http://www.openinventionnetwork.com>.
+
+. $srcdir/../tests/test-subr.sh
+
+srcdir=$srcdir/tests
+
+testfiles hello.bad-1
+
+testrun_compare ./dwarflint hello.bad-1 <<EOF
+error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
+EOF
index fb6f83ce9c0758ef8c748fec33a41494b97becd1..c14665dea45434bc2fc5c3dc87a9fab0b7d5c8a0 100755 (executable)
@@ -33,6 +33,6 @@ testfiles hello.bad-2
   sed 's/ \[ *\([0-9a-f]\+\).*/0x\1/' |
   testrun_compare ./tests/test-all-dies-it ./tests/test-all-dies-it
 
-../src/readelf -winfo hello.bad-2 | grep '^ \[ *[0-9a-f]*\]' |
-  sed 's/ \[ *\([0-9a-f]\+\).*/0x\1/' |
-  testrun_compare ./tests/test-all-dies-it hello.bad-2
+testrun_compare ./tests/test-all-dies-it hello.bad-2 <<EOF
+0xb
+EOF