Petr Machata [Tue, 19 Apr 2011 13:10:06 +0000 (15:10 +0200)]
dwarflint: ref_record is now template parametrized by locus type
- the theory being that most of the time all you need to track comes from
one source
- the upshot is that now the locus::clone and related business can go away
Same as find (), but if the attribute name isn't found,
but there is is an abstract_origin or specification
attribute, then will try to find_integrate () the name
from that reference.
check_linkage_external_die.is_external () now uses it.
Mark Wielaard [Mon, 11 Apr 2011 11:55:58 +0000 (13:55 +0200)]
dwarflint: Don't assert in check_debug_info can trigger an assert.
Instead of asserting a form must exist, let form_class () return
max_dw_class, like ambiguous_class () does. max_dw_class is already
used as sentinel in read_die_chain () in case the attribute is unknown.
This lets things work out for the low level check_debug_info check and
then makes the higher-level checks complain about the unexpected form
instead. Added an example binary and test dwarflint/tests/run-upper.sh.
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.