#include "check_debug_loc_range.hh"
#include "check_debug_abbrev.hh"
#include "check_debug_info.hh"
+#include "check_debug_line.hh"
-checkdescriptor
+checkdescriptor const &
read_cu_headers::descriptor ()
{
static checkdescriptor cd
static reg<check_debug_info> reg_debug_info;
-checkdescriptor
+checkdescriptor const &
check_debug_info::descriptor ()
{
static checkdescriptor cd
.prereq<typeof (*_m_abbrevs)> ()
.prereq<typeof (*_m_cu_headers)> ()
.description (
-
"Checks for low-level structure of .debug_info. In addition it\n"
"checks:\n"
" - for dangling reference to .debug_abbrev section\n"
return NULL;
}
+
+checkdescriptor const &
+check_debug_info_refs::descriptor ()
+{
+ static checkdescriptor cd
+ (checkdescriptor::create ("check_debug_info_refs")
+ .groups ("@low")
+ .prereq<typeof (*_m_info)> ()
+ .prereq<typeof (*_m_line)> ()
+ .description (
+"This pass checks for outstanding unresolved references from\n"
+".debug_info to .debug_line (and perhaps others as they are\n"
+"identified).\n"));
+ return cd;
+}
+
+check_debug_info_refs::check_debug_info_refs (checkstack &stack,
+ dwarflint &lint)
+ : _m_info (lint.check (stack, _m_info))
+ , _m_line (lint.toplev_check (stack, _m_line))
+{
+ for (std::vector<cu>::iterator it = _m_info->cus.begin ();
+ it != _m_info->cus.end (); ++it)
+ if (it->stmt_list.addr != (uint64_t)-1
+ && (_m_line == NULL
+ || !_m_line->has_line_table (it->stmt_list.addr)))
+ wr_error (it->stmt_list.who)
+ << "unresolved reference to .debug_line table "
+ << pri::hex (it->stmt_list.addr) << '.' << std::endl;
+}
+static reg<check_debug_info_refs> reg_debug_info_refs;
#include "low.h"
#include "checks.hh"
#include "check_debug_abbrev.ii"
+#include "check_debug_line.ii"
#include "sections.ii"
/** The pass for reading basic .debug_info data -- the layout of
section<sec_info> *_m_sec_info;
public:
- static checkdescriptor descriptor ();
+ static checkdescriptor const &descriptor ();
std::vector<cu_head> const cu_headers;
read_cu_headers (checkstack &stack, dwarflint &lint);
};
void check_info_structural ();
public:
- static checkdescriptor descriptor ();
+ static checkdescriptor const &descriptor ();
coverage const &cov () const { return _m_cov; }
bool need_ranges () const { return _m_need_ranges; }
cu *find_cu (::Dwarf_Off offset);
};
+/** Check pending references that need other sections to be validated
+ first. */
+class check_debug_info_refs
+ : public check<check_debug_info_refs>
+{
+ check_debug_info *_m_info;
+ check_debug_line *_m_line;
+
+public:
+ static checkdescriptor const &descriptor ();
+ check_debug_info_refs (checkstack &stack, dwarflint &lint);
+};
+
#endif//DWARFLINT_CHECK_DEBUG_INFO_HH