diff options
author | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-02-24 22:36:20 +0000 |
---|---|---|
committer | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-02-24 22:36:20 +0000 |
commit | 841ad48a373f3450c075c731560cb02a5bcbc3a3 (patch) | |
tree | 0c562d3ec365a89f6ec499475c3b0407bc9a6ec4 /src/common/linux/dwarf_line_to_module.cc | |
parent | Breakpad processor: Support negative literals in the postfix evaluator. (diff) | |
download | breakpad-841ad48a373f3450c075c731560cb02a5bcbc3a3.tar.xz |
Breakpad Linux symbol dumper: Handle programs linked with --gc-sections.
As explained in the code:
Given the right options, the GNU toolchain will omit unreferenced
functions from the final executable. Unfortunately, when it does so,
it does not remove the associated portions of the line number program;
instead, it lets the symbol references in the DW_LNE_set_address
instructions pointing to the now-deleted code resolve to zero. Given
this input, the DWARF line parser will call AddLine with a series of
lines starting at address zero.
Rather than collecting series of lines describing code that is not
there, we should drop them. Since the linker doesn't explicitly
distinguish references to dropped sections from genuine references to
zero, we must use a heuristic. We have chosen:
- If a line starts at address zero, omit it. (On the platforms
breakpad targets, it is extremely unlikely that there will be code
at address zero.)
- If a line starts immediately after an omitted line, omit it too.
a=jimblandy, r=nealsid
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@538 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/dwarf_line_to_module.cc')
-rw-r--r-- | src/common/linux/dwarf_line_to_module.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/linux/dwarf_line_to_module.cc b/src/common/linux/dwarf_line_to_module.cc index bc1cd507..c740fa30 100644 --- a/src/common/linux/dwarf_line_to_module.cc +++ b/src/common/linux/dwarf_line_to_module.cc @@ -102,6 +102,14 @@ void DwarfLineToModule::AddLine(uint64 address, uint64 length, if (address + length < address) length = -address; + // Should we omit this line? (See the comments for omitted_line_end_.) + if (address == 0 || address == omitted_line_end_) { + omitted_line_end_ = address + length; + return; + } else { + omitted_line_end_ = 0; + } + // Find the source file being referred to. Module::File *file = files_[file_num]; if (!file) { |