summaryrefslogtreecommitdiffstats
path: root/compiler/elf_writer_debug.cc
diff options
context:
space:
mode:
authorDavid Srbecky <dsrbecky@google.com>2015-04-12 13:12:26 +0100
committerDavid Srbecky <dsrbecky@google.com>2015-04-13 23:35:56 +0100
commit626a1666015b0fa201e979870baf06afa93b65e7 (patch)
treeefeab75defdadffd5f354c51ce9146c88001a434 /compiler/elf_writer_debug.cc
parent67592a44cd5600b3c007b9215e3e5296a61118e8 (diff)
downloadart-626a1666015b0fa201e979870baf06afa93b65e7.tar.gz
art-626a1666015b0fa201e979870baf06afa93b65e7.tar.bz2
art-626a1666015b0fa201e979870baf06afa93b65e7.zip
Append [DEDUPED] suffix to all deduped methods in the symbol table.
This resolves old TODO in the code. The first method was never marked as deduped and only the subsequent copies were recognised. Therefore the suffix might have been missing in backtraces. Change-Id: I4882d90f3049f7e196cd38c8987ba02960dab338
Diffstat (limited to 'compiler/elf_writer_debug.cc')
-rw-r--r--compiler/elf_writer_debug.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/elf_writer_debug.cc b/compiler/elf_writer_debug.cc
index f7811dd18b..6fe05a483d 100644
--- a/compiler/elf_writer_debug.cc
+++ b/compiler/elf_writer_debug.cc
@@ -16,6 +16,8 @@
#include "elf_writer_debug.h"
+#include <unordered_set>
+
#include "compiled_method.h"
#include "driver/compiler_driver.h"
#include "dex_file-inl.h"
@@ -193,6 +195,15 @@ void WriteDebugSections(const CompilerDriver* compiler,
cunit_high_pc = std::max(cunit_high_pc, method_info.high_pc_);
}
+ // Find all addresses (low_pc) which contain deduped methods.
+ // The first instance of method is not marked deduped_, but the rest is.
+ std::unordered_set<uint32_t> deduped_addresses;
+ for (auto it = method_infos.begin(); it != method_infos.end(); ++it) {
+ if (it->deduped_) {
+ deduped_addresses.insert(it->low_pc_);
+ }
+ }
+
// Write .debug_info section.
size_t debug_abbrev_offset = debug_abbrev->size();
DebugInfoEntryWriter<> info(false /* 32 bit */, debug_abbrev);
@@ -205,10 +216,8 @@ void WriteDebugSections(const CompilerDriver* compiler,
for (auto method_info : method_infos) {
std::string method_name = PrettyMethod(method_info.dex_method_index_,
*method_info.dex_file_, true);
- if (method_info.deduped_) {
- // TODO We should place the DEDUPED tag on the first instance of a deduplicated symbol
- // so that it will show up in a debuggerd crash report.
- method_name += " [ DEDUPED ]";
+ if (deduped_addresses.find(method_info.low_pc_) != deduped_addresses.end()) {
+ method_name += " [DEDUPED]";
}
info.StartTag(DW_TAG_subprogram, DW_CHILDREN_no);
info.WriteStrp(DW_AT_name, method_name.data(), debug_str);