Mark Wielaard [Fri, 8 Apr 2011 09:30:58 +0000 (11:30 +0200)]
dwarflint: check_linkage_external_die keep symbol table and double check.
We pull the symbol table from the dwarf file and check when a linkage_name
is set that the symbol table contains that name and is marked not marked
local, with the following exceptions:
- No symbol in table, OK, if not a defining or const object.
Or GNU extension, anonymous structs can have a linkage_name.
- Symbol in table marked local, OK if not a defining object
and marked external. Which means it comes from some external
symbol table.
Petr Machata [Fri, 8 Apr 2011 00:03:01 +0000 (02:03 +0200)]
dwarflint: Drop checkdescriptor::{prereq,inherit}
- ... which was just duplicating the lint.check<> calls in check
initializers. It was needed for --list-checks to display all the
checks. Now we register all the checks that we either want to show
in the list or run, and mark them as hidden or unscheduled as needed.
We lose the ability to list dependees in --list-checks, but I don't
think that is too interesting anyway.
Mark Wielaard [Wed, 30 Mar 2011 10:44:14 +0000 (12:44 +0200)]
dwarflint: Allow DW_AT_ranges with const form, as gnu extension.
Without -gstrict-dwarf gcc allows usage of attributes from
later versions. One strange case is DW_AT_ranges in version 2
since that version doesn't actually define a rangelistptr
class. This case is added in the form_allowed override for dwarf_gnu.
In gnu mode dwarf_version_union::form_allowed checks both variants,
source and extension, in no-gnu mode, only the latest is allowed.
Mark Wielaard [Mon, 4 Apr 2011 10:42:21 +0000 (12:42 +0200)]
dwarflint: linkage_name attributes checking.
Dwarf4 introduces DW_AT_linkage_name, which is like DW_AT_MIPS_linkage_name
already used by gcc for earlier versions. Mark DW_TAG_common_block,
DW_TAG_constant, DW_TAG_entry_point, DW_TAG_subprogram and DW_TAG_variable
as optionally having at_linkage_name (either the old or new variant) in
expected-at.cc. Add new check_linkage_external_die.cc to find DIEs with
linkage_name set, but not marked DW_AT_external.
Mark Wielaard [Sun, 3 Apr 2011 18:14:50 +0000 (20:14 +0200)]
Add minimal support for DW_TAG_GNU_template.
http://gcc.gnu.org/wiki/TemplateParmsDwarf describes
DW_TAG_GNU_template_template_param, DW_TAG_GNU_template_parameter_pack,
DW_TAG_GNU_formal_parameter_pack and DW_AT_GNU_template_name.
Added to libdw/c++/dwarf-knowledge.cc, dwarflint/expected-at.cc and
dwarflint/dwarf_gnu.cc
Mark Wielaard [Fri, 1 Apr 2011 22:36:56 +0000 (00:36 +0200)]
dwarflint: check_dups_abstract_origin, be specific about GNU_call_site dups.
A call site entry has a DW_AT_low_pc attribute which is the return
address after the call and a DW_AT_abstract_origin that is a
pointer to the reference it calls directly or indirectly. So
both may be available also at the abstract_origin (with different
values).
Mark Wielaard [Thu, 31 Mar 2011 22:17:58 +0000 (00:17 +0200)]
dwarflint: check_dups_abstract_origin, some (GNU_call_site) dups are OK.
A call site entry has a DW_AT_low_pc attribute which is the return
address after the call and a DW_AT_abstract_origin that is a
pointer to the reference it calls directly or indirectly.
Mark Wielaard [Wed, 30 Mar 2011 15:09:17 +0000 (17:09 +0200)]
Add DW_AT_GNU_call attributes to dwarf-knowledge.cc.
DW_AT_GNU_call_site_value, DW_AT_GNU_call_site_data_value,
DW_AT_GNU_call_site_target and DW_AT_GNU_call_site_target_clobbered
describe locations. DW_AT_GNU_tail_call, DW_AT_GNU_all_tail_call_sites,
DW_AT_GNU_all_call_sites and DW_AT_GNU_all_source_call_sites are flags.
Petr Machata [Mon, 28 Mar 2011 22:54:48 +0000 (00:54 +0200)]
dwarflint: Add filtering of duplicate messages
- we use the first string component of stream implementation of wr_message
as a key to decide whether we've seen the message before. Most of the
messages use streams, is why it's like that. When (if) we get back to
formatting strings, that string should be even better key, because there
will be less chance for compiler to do duplicate elimination etc.
Petr Machata [Thu, 24 Mar 2011 16:44:12 +0000 (17:44 +0100)]
dwarflint: Add check_die_tree pass for generic per-DIE checks
- add reg_die_check for registering per-DIE check passes
- turn check_registrar into a template to allow reuse among reg<> and
reg_die_check<>
- the per-DIE checking magic is in check_die_tree.hh
- hide most of checks.hh into dwarflint.cc. That has little to do
with per-DIE checks as such, but was a necessary cleanup
Mark Wielaard [Tue, 22 Mar 2011 22:03:31 +0000 (23:03 +0100)]
Add support for call_site and entry_value to dwarf.h and readelf.
New tags DW_TAG_GNU_call_site and DW_TAG_GNU_call_site_parameter.
New attributes DW_AT_GNU_call_site_value,
DW_AT_GNU_call_site_data_value, DW_AT_GNU_call_site_target,
DW_AT_GNU_call_site_target_clobbered, DW_AT_GNU_tail_call,
DW_AT_GNU_all_tail_call_sites, DW_AT_GNU_all_call_sites,
and DW_AT_GNU_all_source_call_sites.
New operation DW_OP_GNU_entry_value.
Mark Wielaard [Fri, 18 Feb 2011 19:16:03 +0000 (20:16 +0100)]
Calculate reference hash before finalizing, store in die_info.
Follows whole reference chain (ignoring children) and combines
local references of all dies found. Reduces number of attr_set
collisions a lot. Unfortunately there are circular reference
chains for some larger c++ programs. That was unexpected.
Needs cycle detection to figure out what is going on.
Mark Wielaard [Thu, 20 Jan 2011 15:23:48 +0000 (16:23 +0100)]
Turn copier::entry into a value_reference so what_space works on it.
copier::entry is used as a value_reference when an attr_value has a
dangling reference to a DIE not yet built in the output. So make sure
its type matches that usage.
Mark Wielaard [Thu, 20 Jan 2011 14:28:59 +0000 (15:28 +0100)]
Introduce local_hash for dwarf_output debug_info_die.
Very simplistic local_hash implementation. Just takes tag name,
attributes and children sizes into account. But is good enough to
make all the dwarf_edit_output tests pass. Some dwarfcmp-test-self
tests fail though. it also generates a significant number of
collissions for the dwarf_output_collector attr_sets.
Petr Machata [Thu, 10 Mar 2011 15:03:18 +0000 (16:03 +0100)]
dwarflint: Fix "die chain not terminated by a null entry" for CU DIE
- CU DIE is not part of DIE chain, it's a singleton (with optional null
entries following it as padding)
- consequently, don't emit this message for CU DIE, and change it to full
error for all other cases