From 8aa67451c72afcd4cffb6c81f50e9e4c8a388685 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Thu, 2 Sep 2010 15:55:54 +0200 Subject: [PATCH] dwarflint: More check descriptions --- dwarflint/check_debug_aranges.cc | 12 +++++++++- dwarflint/check_debug_loc_range.cc | 36 ++++++++++++++++++++++++++---- dwarflint/check_matching_ranges.cc | 5 ++++- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/dwarflint/check_debug_aranges.cc b/dwarflint/check_debug_aranges.cc index e88bf9eee..440d5465a 100644 --- a/dwarflint/check_debug_aranges.cc +++ b/dwarflint/check_debug_aranges.cc @@ -41,7 +41,17 @@ check_debug_aranges::descriptor () static checkdescriptor cd (checkdescriptor::create ("check_debug_aranges") .groups ("@low") - .prereq ()); + .prereq () + .description ( +"Checks for low-level structure of .debug_aranges. In addition it\n" +"checks:\n" +" - that relocations are valid. In ET_REL files that certain fields\n" +" are relocated\n" +" - for dangling and duplicate CU references\n" +" - for garbage inside padding\n" +" - for zero-length ranges\n" +" - that the ranges cover all the address range covered by CUs\n" + )); return cd; } diff --git a/dwarflint/check_debug_loc_range.cc b/dwarflint/check_debug_loc_range.cc index 751a4d0d1..b9310db0e 100644 --- a/dwarflint/check_debug_loc_range.cc +++ b/dwarflint/check_debug_loc_range.cc @@ -54,7 +54,19 @@ check_debug_ranges::descriptor () (checkdescriptor::create ("check_debug_ranges") .groups ("@low") .prereq () - .prereq ()); + .prereq () + .description ( +"Checks for low-level structure of .debug_ranges. In addition it\n" +"checks:\n" +" - for overlapping and dangling references from .debug_info\n" +" - that base address is set and that it actually changes the address\n" +" - that ranges have a positive size\n" +" - that there are no unreferenced holes in the section\n" +" - that relocations are valid. In ET_REL files that certain fields\n" +" are relocated\n" +" - neither or both of range start and range end are expected to be\n" +" relocated. It's expected that they are both relocated against the\n" +" same section.\n")); return cd; } @@ -67,7 +79,19 @@ check_debug_loc::descriptor () (checkdescriptor::create ("check_debug_loc") .groups ("@low") .prereq () - .prereq ()); + .prereq () + .description ( +"Checks for low-level structure of .debug_loc. In addition it\n" +"makes the same checks as .debug_ranges. For location expressions\n" +"it further checks:\n" +" - that DW_OP_bra and DW_OP_skip argument is non-zero and doesn't\n" +" escape the expression. In addition it is required that the jump\n" +" ends on another instruction, not arbitrarily in the middle of the\n" +" byte stream, even if that position happened to be interpretable as\n" +" another well-defined instruction stream.\n" +" - on 32-bit machines it rejects DW_OP_const8u and DW_OP_const8s\n" +" - on 32-bit machines it checks that ULEB128-encoded arguments aren't\n" +" quantities that don't fit into 32 bits\n")); return cd; } @@ -446,7 +470,8 @@ namespace && coverage_is_overlap (coverage, end_off, cu->head->address_size)) HAVE_OVERLAP; - if (!read_ctx_read_offset (&ctx, cu->head->address_size == 8, &end_addr)) + if (!read_ctx_read_offset (&ctx, cu->head->address_size == 8, + &end_addr)) { wr_error (&where, ": can't read address range ending.\n"); return false; @@ -488,7 +513,7 @@ namespace } if (end_addr < begin_addr) - wr_message (cat | mc_error, &where, ": has negative range %s.\n", + wr_message (cat | mc_error, &where, ": has negative range %s.\n", range_fmt (buf, sizeof buf, begin_addr, end_addr)); else if (begin_addr == end_addr) /* 2.6.6: A location list entry [...] whose beginning @@ -588,6 +613,7 @@ namespace /* For .debug_ranges, we optionally do ranges vs. ELF sections coverage analysis. */ + // xxx this is a candidate for a separate check struct coverage_map *coverage_map = NULL; if (do_range_coverage && sec->id == sec_ranges && (coverage_map @@ -608,6 +634,7 @@ namespace references are organized in monotonously increasing order. That doesn't have to be the case. So merge all the references into one sorted array. */ + { typedef std::vector ref_cu_vect; ref_cu_vect refs; for (struct cu *cu = cu_chain; cu != NULL; cu = cu->next) @@ -645,6 +672,7 @@ namespace retval = false; last_off = off; } + } if (retval) { diff --git a/dwarflint/check_matching_ranges.cc b/dwarflint/check_matching_ranges.cc index ae37c8092..2361618db 100644 --- a/dwarflint/check_matching_ranges.cc +++ b/dwarflint/check_matching_ranges.cc @@ -42,7 +42,10 @@ namespace static checkdescriptor descriptor () { static checkdescriptor cd (checkdescriptor::create ("check_matching_ranges") - .inherit > ()); + .inherit > () + .description ( +"Check that the ranges in .debug_aranges and .debug_ranges match.\n" +)); return cd; } -- 2.47.3