[llvm] r308928 - [DWARF] Added verification check for die ranges. If highPC is an address, then it should be greater than lowPC for each range.

Yung, Douglas via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 18:08:08 PDT 2017


Hi Spyridoula,

Your change added a test, verify_die_ranges.s which seems to be failing on the PS4 Windows bot. Can you take a look?

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/11249

FAIL: LLVM :: tools/llvm-dwarfdump/X86/verify_die_ranges.s (32574 of 34247)
******************** TEST 'LLVM :: tools/llvm-dwarfdump/X86/verify_die_ranges.s' FAILED ********************
Script:
--
C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\llvm-mc.EXE C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s -filetype obj -triple x86_64-apple-darwin -o -  | C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\not.EXE C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\llvm-dwarfdump.EXE -verify -  | C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\FileCheck.EXE C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s
--
Exit Code: 1

Command Output (stdout):
--
$ "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\llvm-mc.EXE" "C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s" "-filetype" "obj" "-triple" "x86_64-apple-darwin" "-o" "-"
# command stderr:
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s:9:2: warning: .macosx_version_min should only be used for macosx targets

        .macosx_version_min 10, 12

        ^


$ "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\not.EXE" "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\llvm-dwarfdump.EXE" "-verify" "-"
$ "C:/ps4-buildslave2/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\FileCheck.EXE" "C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s"
# command stderr:
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\test\tools\llvm-dwarfdump\X86\verify_die_ranges.s:6:15: error: expected string not found in input

# CHECK-NEXT: error: Invalid address range [0x00000007 - 0x00000006].

              ^

<stdin>:4:1: note: scanning from here

error: Invalid address range [0x00000007 - 0x00000000].

^


error: command failed with exit status: 1


Douglas Yung

> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of
> Spyridoula Gravani via llvm-commits
> Sent: Monday, July 24, 2017 14:04
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r308928 - [DWARF] Added verification check for die ranges. If
> highPC is an address, then it should be greater than lowPC for each range.
> 
> Author: sgravani
> Date: Mon Jul 24 14:04:11 2017
> New Revision: 308928
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=308928&view=rev
> Log:
> [DWARF] Added verification check for die ranges. If highPC is an address, then
> it should be greater than lowPC for each range.
> 
> Differential Revision: https://reviews.llvm.org/D35733
> 
> Added:
>     llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_die_ranges.s
> Modified:
>     llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
>     llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
> 
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h?rev=308928&r1=
> 308927&r2=308928&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h Mon Jul 24
> +++ 14:04:11 2017
> @@ -73,6 +73,15 @@ class DWARFVerifier {
> 
> 
>    bool verifyUnitContents(DWARFUnit Unit);
> +
> +  /// Verify that all Die ranges are valid.
> +  ///
> +  /// This function currently checks for:
> +  /// - cases in which lowPC >= highPC
> +  ///
> +  /// \returns Number of errors that occured during verification.
> +  unsigned verifyDieRanges(const DWARFDie &Die);
> +
>    /// Verifies the attribute's DWARF attribute and its value.
>    ///
>    /// This function currently checks for:
> 
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=308928&r1=308927&
> r2=308928&view=diff
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Mon Jul 24 14:04:11
> +++ 2017
> @@ -94,6 +94,7 @@ bool DWARFVerifier::verifyUnitContents(D
>      auto Die = Unit.getDIEAtIndex(I);
>      if (Die.getTag() == DW_TAG_null)
>        continue;
> +    NumUnitErrors += verifyDieRanges(Die);
>      for (auto AttrValue : Die.attributes()) {
>        NumUnitErrors += verifyDebugInfoAttribute(Die, AttrValue);
>        NumUnitErrors += verifyDebugInfoForm(Die, AttrValue); @@ -209,6 +210,18
> @@ bool DWARFVerifier::handleDebugInfo() {
>    return (isHeaderChainValid && NumDebugInfoErrors == 0);  }
> 
> +unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die) {
> +  unsigned NumErrors = 0;
> +  for (auto Range : Die.getAddressRanges()) {
> +    if (Range.LowPC >= Range.HighPC) {
> +      ++NumErrors;
> +      OS << format("error: Invalid address range [0x%08x - 0x%08x].\n",
> +                   Range.LowPC, Range.HighPC);
> +    }
> +  }
> +  return NumErrors;
> +}
> +
>  unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
>                                                   DWARFAttribute &AttrValue) {
>    const DWARFObject &DObj = DCtx.getDWARFObj();
> 
> Added: llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_die_ranges.s
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-
> dwarfdump/X86/verify_die_ranges.s?rev=308928&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_die_ranges.s (added)
> +++ llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_die_ranges.s Mon Jul
> +++ 24 14:04:11 2017
> @@ -0,0 +1,82 @@
> +# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ #
> +RUN: | not llvm-dwarfdump -verify - \ # RUN: | FileCheck %s
> +
> +# CHECK: Verifying .debug_info Unit Header Chain...
> +# CHECK-NEXT: error: Invalid address range [0x00000007 - 0x00000006].
> +
> +	.section	__TEXT,__text,regular,pure_instructions
> +	.macosx_version_min 10, 12
> +	.globl	_foo                    ## -- Begin function foo
> +	.p2align	4, 0x90
> +_foo:                                   ## @foo
> +Lfunc_begin0:
> +	.file	1 "basic.c"
> +	.loc	1 1 0                   ## basic.c:1:0
> +	.cfi_startproc
> +## BB#0:                                ## %entry
> +	pushq	%rbp
> +Lcfi0:
> +	.cfi_def_cfa_offset 16
> +Lcfi1:
> +	.cfi_offset %rbp, -16
> +	movq	%rsp, %rbp
> +Lcfi2:
> +	.cfi_def_cfa_register %rbp
> +Ltmp0:
> +	.loc	1 1 17 prologue_end     ## basic.c:1:17
> +	popq	%rbp
> +	retq
> +Ltmp1:
> +Lfunc_end0:
> +	.cfi_endproc
> +                                        ## -- End function
> +	.section	__DWARF,__debug_str,regular,debug
> +Linfo_string:
> +	.asciz	"clang version 6.0.0 (trunk 308773) (llvm/trunk 308774)" ##
> string offset=0
> +	.asciz	"basic.c"               ## string offset=55
> +	.asciz	"/Users/sgravani/Development/tests" ## string offset=63
> +	.asciz	"foo"                   ## string offset=97
> +	.section	__DWARF,__debug_abbrev,regular,debug
> +Lsection_abbrev:
> +	.byte	1                       ## Abbreviation Code
> +	.byte	17                      ## DW_TAG_compile_unit
> +	.byte	1                       ## DW_CHILDREN_yes
> +	.byte	37                      ## DW_AT_producer
> +	.byte	14                      ## DW_FORM_strp
> +	.byte	19                      ## DW_AT_language
> +	.byte	5                       ## DW_FORM_data2
> +	.byte	3                       ## DW_AT_name
> +	.byte	14                      ## DW_FORM_strp
> +	.byte	16                      ## DW_AT_stmt_list
> +	.byte	6                       ## DW_FORM_data4
> +	.byte	27                      ## DW_AT_comp_dir
> +	.byte	14                      ## DW_FORM_strp
> +	.byte	17                      ## DW_AT_low_pc
> +	.byte	1                       ## DW_FORM_addr
> +	.byte	18                      ## DW_AT_high_pc
> +	.byte	1                       ## DW_FORM_addr
> +	.byte	0                       ## EOM(1)
> +	.byte	0                       ## EOM(2)
> +	.section	__DWARF,__debug_info,regular,debug
> +Lsection_info:
> +Lcu_begin0:
> +	.long	43                      ## Length of Unit
> +	.short	3                       ## DWARF version number
> +Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
> +	.long	Lset0
> +	.byte	8                       ## Address Size (in bytes)
> +	.byte	1                       ## Abbrev [1] 0xb:0x3f
> DW_TAG_compile_unit
> +	.long	0                       ## DW_AT_producer
> +	.short	12                      ## DW_AT_language
> +	.long	55                      ## DW_AT_name
> +Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
> +	.long	Lset1
> +	.long	63                      ## DW_AT_comp_dir
> +	.quad	Lfunc_end0 + 1          ## DW_AT_low_pc -- error: Invalid address
> range [0x00000007 - 0x00000006].
> +	.quad	Lfunc_end0              ## DW_AT_high_pc
> +	.byte	0                       ## End Of Children Mark
> +.subsections_via_symbols
> +	.section	__DWARF,__debug_line,regular,debug
> +Lsection_line:
> +Lline_table_start0:
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list