Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13)

Issue 224001: Fix assert failure in dump_syms caused by binary linked with gold....

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 6 months ago by raymes
Modified:
13 years, 6 months ago
Reviewers:
ccoutant, thestig1, jimb
CC:
google-breakpad-dev_googlegroups.com, raymes
Base URL:
http://google-breakpad.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Fix assert failure in dump_syms caused by binary linked with gold.

In dwarf_cu_to_module.cc, in AssignLinesToFunctions(), here are the
assertions at the top of the loop:

   // Assert the first invariant (see above).

At the bottom of the loop, it's advancing the iterators to preserve
the loop invariants:

   // Advance iterators as needed. If lines overlap or functions overlap,
   // then we could go around more than once. We don't worry too much
   // about what result we produce in that case, just as long as we don't
   // hang or crash.
   while (func_it != functions->end()
          && current >= (*func_it)->address
     func_it++;
   func = (func_it != functions->end()) ? *func_it : NULL;
   while (line_it != lines_.end()
          && current >= line_it->address
     line_it++;
   line = (line_it != lines_.end()) ? &*line_it : NULL;

   // We must make progress.
   assert(next_transition > current);
   current = next_transition;

In the loops that advance the func_it and line_it iterators, current
should be replaced by next_transition. As written, when there are
overlapping entries, it's not always advancing the iterators far
enough for the next iteration of the loop.

The difference between gnu ld and gold that's causing this is how the
two linkers apply relocations that reference discarded symbols. In gnu
ld, the addend is ignored, while gold applies the relocation with the
addend. As a result, the entries for discarded functions all appear as
zero-length functions, and they don't actually overlap.

TESTED: Ran make check inside dump_syms directory and ran on binary that was
previously failing. Both succeeded.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M src/common/dwarf_cu_to_module.cc View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 3
ccoutant
LGTM
13 years, 6 months ago #1
jimb
On 2010/11/08 18:37:25, ccoutant wrote: > LGTM src/common/dwarf_cu_to_module_unittest.cc has everything you need to write a ...
13 years, 6 months ago #2
jimb
13 years, 6 months ago #3
You probably want to copy the case that begins:

  TEST_F(FuncLinePairing, GapThenFunction) {
and just fix up the line and function lists to recreate the situation that
caused the assertion.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted