aboutsummaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2015-04-09 11:52:21 -0700
committerCary Coutant <ccoutant@google.com>2015-04-09 11:53:01 -0700
commit437ddf0c4cb63fdb68c4bd1cc155144db344d0c5 (patch)
tree125d12fcbbc64bc9b76e629407a64c687ac12000 /gold/dwarf_reader.cc
parentcd6faa73f8e3b888ee8b73a733382a5587aca202 (diff)
downloadgdb-437ddf0c4cb63fdb68c4bd1cc155144db344d0c5.zip
gdb-437ddf0c4cb63fdb68c4bd1cc155144db344d0c5.tar.gz
gdb-437ddf0c4cb63fdb68c4bd1cc155144db344d0c5.tar.bz2
Improve ODR checking in gold.
gold/ * debug.h (DEBUG_LOCATION): New. (DEBUG_ALL): Include DEBUG_LOCATION. (debug_string_to_enum): Add DEBUG_LOCATION. * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug output to print correct context. (Sized_dwarf_line_info::do_addr2line): Add debug output. Return up to 4 more locations at the beginning of the function. * symtab.cc (Symbol_table::detect_odr_violations): Get canonical result before sorting list of line numbers. * testsuite/debug_msg.sh: Allow range of line numbers for canonical results on optimized code.
Diffstat (limited to 'gold/dwarf_reader.cc')
-rw-r--r--gold/dwarf_reader.cc32
1 files changed, 26 insertions, 6 deletions
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc
index e7c95ce..59b85b8 100644
--- a/gold/dwarf_reader.cc
+++ b/gold/dwarf_reader.cc
@@ -2205,13 +2205,33 @@ Sized_dwarf_line_info<size, big_endian>::do_addr2line(
return "";
std::string result = this->format_file_lineno(*it);
+ gold_debug(DEBUG_LOCATION, "do_addr2line: canonical result: %s",
+ result.c_str());
if (other_lines != NULL)
- for (++it; it != offsets->end() && it->offset == offset; ++it)
- {
- if (it->line_num == -1)
- continue; // The end of a previous function.
- other_lines->push_back(this->format_file_lineno(*it));
- }
+ {
+ unsigned int last_file_num = it->file_num;
+ int last_line_num = it->line_num;
+ // Return up to 4 more locations from the beginning of the function
+ // for fuzzy matching.
+ for (++it; it != offsets->end(); ++it)
+ {
+ if (it->offset == offset && it->line_num == -1)
+ continue; // The end of a previous function.
+ if (it->line_num == -1)
+ break; // The end of the current function.
+ if (it->file_num != last_file_num || it->line_num != last_line_num)
+ {
+ other_lines->push_back(this->format_file_lineno(*it));
+ gold_debug(DEBUG_LOCATION, "do_addr2line: other: %s",
+ other_lines->back().c_str());
+ last_file_num = it->file_num;
+ last_line_num = it->line_num;
+ }
+ if (it->offset > offset && other_lines->size() >= 4)
+ break;
+ }
+ }
+
return result;
}