From 8546cc9aeb05e866e1fb6a9e4130d53ea330baa8 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Mon, 25 Jan 2016 17:31:49 +0000 Subject: [PATCH] Revert "Add option to generate compressed backtrace info." This reverts commit 5fdcc3c931b70204fd8c491afa66f57f8428490f. Change-Id: I9c1f5aad6933a46af6717e3a90a51f76111f9c8a --- compiler/Android.mk | 2 - compiler/dex/quick/codegen_util.cc | 2 +- compiler/driver/compiler_options.cc | 6 --- compiler/driver/compiler_options.h | 12 ----- compiler/elf_builder.h | 17 ++----- compiler/elf_writer_debug.cc | 81 ------------------------------ compiler/elf_writer_debug.h | 4 -- compiler/elf_writer_quick.cc | 9 ++-- compiler/jni/quick/jni_compiler.cc | 2 +- compiler/oat_writer.cc | 2 +- compiler/optimizing/optimizing_compiler.cc | 2 +- dex2oat/dex2oat.cc | 5 -- oatdump/oatdump.cc | 4 +- test/137-cfi/expected.txt | 1 - test/137-cfi/run | 6 +-- 15 files changed, 14 insertions(+), 141 deletions(-) diff --git a/compiler/Android.mk b/compiler/Android.mk index fb483a5ef..458973684 100644 --- a/compiler/Android.mk +++ b/compiler/Android.mk @@ -274,8 +274,6 @@ define build-libart-compiler endif endif - LOCAL_STATIC_LIBRARIES += liblzma - LOCAL_MODULE_TAGS := optional ifeq ($$(art_static_or_shared), static) LOCAL_MODULE_CLASS := STATIC_LIBRARIES diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index af6f91f21..d68835a9c 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -1076,7 +1076,7 @@ Mir2Lir::Mir2Lir(CompilationUnit* cu, MIRGraph* mir_graph, ArenaAllocator* arena pc_rel_temp_(nullptr), dex_cache_arrays_min_offset_(std::numeric_limits::max()), cfi_(&last_lir_insn_, - cu->compiler_driver->GetCompilerOptions().GenerateAnyDebugInfo(), + cu->compiler_driver->GetCompilerOptions().GetGenerateDebugInfo(), arena), in_to_reg_storage_mapping_(arena) { switch_tables_.reserve(4); diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc index e0b1d8b2b..2644528e5 100644 --- a/compiler/driver/compiler_options.cc +++ b/compiler/driver/compiler_options.cc @@ -37,7 +37,6 @@ CompilerOptions::CompilerOptions() debuggable_(false), native_debuggable_(kDefaultNativeDebuggable), generate_debug_info_(kDefaultGenerateDebugInfo), - generate_mini_debug_info_(kDefaultGenerateMiniDebugInfo), implicit_null_checks_(true), implicit_so_checks_(true), implicit_suspend_checks_(false), @@ -92,7 +91,6 @@ CompilerOptions::CompilerOptions(CompilerFilter compiler_filter, debuggable_(debuggable), native_debuggable_(kDefaultNativeDebuggable), generate_debug_info_(generate_debug_info), - generate_mini_debug_info_(kDefaultGenerateMiniDebugInfo), implicit_null_checks_(implicit_null_checks), implicit_so_checks_(implicit_so_checks), implicit_suspend_checks_(implicit_suspend_checks), @@ -217,10 +215,6 @@ bool CompilerOptions::ParseCompilerOption(const StringPiece& option, UsageFn Usa generate_debug_info_ = true; } else if (option == "--no-generate-debug-info") { generate_debug_info_ = false; - } else if (option == "--generate-mini-debug-info") { - generate_mini_debug_info_ = true; - } else if (option == "--no-generate-mini-debug-info") { - generate_mini_debug_info_ = false; } else if (option == "--debuggable") { debuggable_ = true; } else if (option == "--native-debuggable") { diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 5294af8b2..d47fc2ad4 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -51,7 +51,6 @@ class CompilerOptions FINAL { static constexpr double kDefaultTopKProfileThreshold = 90.0; static const bool kDefaultNativeDebuggable = false; static const bool kDefaultGenerateDebugInfo = false; - static const bool kDefaultGenerateMiniDebugInfo = false; static const bool kDefaultIncludePatchInformation = false; static const size_t kDefaultInlineDepthLimit = 3; static const size_t kDefaultInlineMaxCodeUnits = 32; @@ -171,20 +170,10 @@ class CompilerOptions FINAL { return native_debuggable_; } - // This flag controls whether the compiler collects debugging information. - // The other flags control how the information is written to disk. - bool GenerateAnyDebugInfo() const { - return GetGenerateDebugInfo() || GetGenerateMiniDebugInfo(); - } - bool GetGenerateDebugInfo() const { return generate_debug_info_; } - bool GetGenerateMiniDebugInfo() const { - return generate_mini_debug_info_; - } - bool GetImplicitNullChecks() const { return implicit_null_checks_; } @@ -277,7 +266,6 @@ class CompilerOptions FINAL { bool debuggable_; bool native_debuggable_; bool generate_debug_info_; - bool generate_mini_debug_info_; bool implicit_null_checks_; bool implicit_so_checks_; bool implicit_suspend_checks_; diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h index 3d24d1991..46484b1cd 100644 --- a/compiler/elf_builder.h +++ b/compiler/elf_builder.h @@ -165,15 +165,10 @@ class ElfBuilder FINAL { } } - // Write this section as "NOBITS" section. (used for the .bss section) - // This means that the ELF file does not contain the initial data for this section - // and it will be zero-initialized when the ELF file is loaded in the running program. - void WriteNoBitsSection(Elf_Word size) { - DCHECK_NE(header_.sh_flags & SHF_ALLOC, 0u); - Start(); - header_.sh_type = SHT_NOBITS; + // Set desired allocation size for .bss section. + void SetSize(Elf_Word size) { + CHECK_EQ(header_.sh_type, (Elf_Word)SHT_NOBITS); header_.sh_size = size; - End(); } // This function always succeeds to simplify code. @@ -351,12 +346,6 @@ class ElfBuilder FINAL { other_sections_.push_back(std::move(s)); } - // Set where the next section will be allocated in the virtual address space. - void SetVirtualAddress(Elf_Addr address) { - DCHECK_GE(address, virtual_address_); - virtual_address_ = address; - } - void Start() { // Reserve space for ELF header and program headers. // We do not know the number of headers until later, so diff --git a/compiler/elf_writer_debug.cc b/compiler/elf_writer_debug.cc index 94e5d7696..a64c9f15b 100644 --- a/compiler/elf_writer_debug.cc +++ b/compiler/elf_writer_debug.cc @@ -40,11 +40,6 @@ #include "stack_map.h" #include "utils.h" -// liblzma. -#include "XzEnc.h" -#include "7zCrc.h" -#include "XzCrc64.h" - namespace art { namespace dwarf { @@ -1410,76 +1405,6 @@ void WriteDebugInfo(ElfBuilder* builder, WriteDebugSections(builder, method_infos); } -static void XzCompress(const std::vector* src, std::vector* dst) { - // Configure the compression library. - CrcGenerateTable(); - Crc64GenerateTable(); - CLzma2EncProps lzma2Props; - Lzma2EncProps_Init(&lzma2Props); - lzma2Props.lzmaProps.level = 1; // Fast compression. - Lzma2EncProps_Normalize(&lzma2Props); - CXzProps props; - XzProps_Init(&props); - props.lzma2Props = &lzma2Props; - // Implement the required interface for communication (written in C so no virtual methods). - struct XzCallbacks : public ISeqInStream, public ISeqOutStream, public ICompressProgress { - static SRes ReadImpl(void* p, void* buf, size_t* size) { - auto* ctx = static_cast(reinterpret_cast(p)); - *size = std::min(*size, ctx->src_->size() - ctx->src_pos_); - memcpy(buf, ctx->src_->data() + ctx->src_pos_, *size); - ctx->src_pos_ += *size; - return SZ_OK; - } - static size_t WriteImpl(void* p, const void* buf, size_t size) { - auto* ctx = static_cast(reinterpret_cast(p)); - const uint8_t* buffer = reinterpret_cast(buf); - ctx->dst_->insert(ctx->dst_->end(), buffer, buffer + size); - return size; - } - static SRes ProgressImpl(void* , UInt64, UInt64) { - return SZ_OK; - } - size_t src_pos_; - const std::vector* src_; - std::vector* dst_; - }; - XzCallbacks callbacks; - callbacks.Read = XzCallbacks::ReadImpl; - callbacks.Write = XzCallbacks::WriteImpl; - callbacks.Progress = XzCallbacks::ProgressImpl; - callbacks.src_pos_ = 0; - callbacks.src_ = src; - callbacks.dst_ = dst; - // Compress. - SRes res = Xz_Encode(&callbacks, &callbacks, &props, &callbacks); - CHECK_EQ(res, SZ_OK); -} - -template -void WriteMiniDebugInfo(ElfBuilder* parent_builder, - const ArrayRef& method_infos) { - const InstructionSet isa = parent_builder->GetIsa(); - std::vector buffer; - buffer.reserve(KB); - VectorOutputStream out("Mini-debug-info ELF file", &buffer); - std::unique_ptr> builder(new ElfBuilder(isa, &out)); - builder->Start(); - // Write .rodata and .text as NOBITS sections. - // This allows tools to detect virtual address relocation of the parent ELF file. - builder->SetVirtualAddress(parent_builder->GetRoData()->GetAddress()); - builder->GetRoData()->WriteNoBitsSection(parent_builder->GetRoData()->GetSize()); - builder->SetVirtualAddress(parent_builder->GetText()->GetAddress()); - builder->GetText()->WriteNoBitsSection(parent_builder->GetText()->GetSize()); - WriteDebugSymbols(builder.get(), method_infos); - WriteCFISection(builder.get(), method_infos, DW_DEBUG_FRAME_FORMAT); - builder->End(); - CHECK(builder->Good()); - std::vector compressed_buffer; - compressed_buffer.reserve(buffer.size() / 4); - XzCompress(&buffer, &compressed_buffer); - parent_builder->WriteSection(".gnu_debugdata", &compressed_buffer); -} - template static ArrayRef WriteDebugElfFileForMethodInternal( const dwarf::MethodDebugInfo& method_info) { @@ -1552,12 +1477,6 @@ template void WriteDebugInfo( ElfBuilder* builder, const ArrayRef& method_infos, CFIFormat cfi_format); -template void WriteMiniDebugInfo( - ElfBuilder* builder, - const ArrayRef& method_infos); -template void WriteMiniDebugInfo( - ElfBuilder* builder, - const ArrayRef& method_infos); } // namespace dwarf } // namespace art diff --git a/compiler/elf_writer_debug.h b/compiler/elf_writer_debug.h index e19da088d..e4bc856c5 100644 --- a/compiler/elf_writer_debug.h +++ b/compiler/elf_writer_debug.h @@ -35,10 +35,6 @@ void WriteDebugInfo(ElfBuilder* builder, const ArrayRef& method_infos, CFIFormat cfi_format); -template -void WriteMiniDebugInfo(ElfBuilder* builder, - const ArrayRef& method_infos); - ArrayRef WriteDebugElfFileForMethod(const dwarf::MethodDebugInfo& method_info); ArrayRef WriteDebugElfFileForClasses(const InstructionSet isa, diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc index 6bf080a08..7b1bdd72e 100644 --- a/compiler/elf_writer_quick.cc +++ b/compiler/elf_writer_quick.cc @@ -137,7 +137,9 @@ template void ElfWriterQuick::SetBssSize(size_t bss_size) { auto* bss = builder_->GetBss(); if (bss_size != 0u) { - bss->WriteNoBitsSection(bss_size); + bss->Start(); + bss->SetSize(bss_size); + bss->End(); } } @@ -150,13 +152,8 @@ template void ElfWriterQuick::WriteDebugInfo( const ArrayRef& method_infos) { if (compiler_options_->GetGenerateDebugInfo()) { - // Generate all the debug information we can. dwarf::WriteDebugInfo(builder_.get(), method_infos, kCFIFormat); } - if (compiler_options_->GetGenerateMiniDebugInfo()) { - // Generate only some information and compress it. - dwarf::WriteMiniDebugInfo(builder_.get(), method_infos); - } } template diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc index e92046057..52a238233 100644 --- a/compiler/jni/quick/jni_compiler.cc +++ b/compiler/jni/quick/jni_compiler.cc @@ -95,7 +95,7 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver* driver, // Assembler that holds generated instructions std::unique_ptr jni_asm(Assembler::Create(instruction_set, instruction_set_features)); - jni_asm->cfi().SetEnabled(driver->GetCompilerOptions().GenerateAnyDebugInfo()); + jni_asm->cfi().SetEnabled(driver->GetCompilerOptions().GetGenerateDebugInfo()); // Offsets into data structures // TODO: if cross compiling these offsets are for the host not the target diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 4bc3a555d..c74c41f0c 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -798,7 +798,7 @@ class OatWriter::InitCodeMethodVisitor : public OatDexMethodVisitor { } } - if (writer_->compiler_driver_->GetCompilerOptions().GenerateAnyDebugInfo()) { + if (writer_->compiler_driver_->GetCompilerOptions().GetGenerateDebugInfo()) { // Record debug information for this function if we are doing that. const uint32_t quick_code_start = quick_code_offset - writer_->oat_header_->GetExecutableOffset() - thumb_offset; diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 3fac91401..fffd00535 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -676,7 +676,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena, return nullptr; } codegen->GetAssembler()->cfi().SetEnabled( - compiler_driver->GetCompilerOptions().GenerateAnyDebugInfo()); + compiler_driver->GetCompilerOptions().GetGenerateDebugInfo()); PassObserver pass_observer(graph, codegen.get(), diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 4a9f7fcf9..918a01b08 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -318,11 +318,6 @@ NO_RETURN static void Usage(const char* fmt, ...) { UsageError(""); UsageError(" --no-generate-debug-info: Do not generate debug information for native debugging."); UsageError(""); - UsageError(" --generate-mini-debug-info: Generate minimal amount of LZMA-compressed"); - UsageError(" debug information necessary to print backtraces. (disabled by default)"); - UsageError(""); - UsageError(" --no-generate-mini-debug-info: Do do generated backtrace info."); - UsageError(""); UsageError(" --debuggable: Produce code debuggable with Java debugger."); UsageError(""); UsageError(" --native-debuggable: Produce code debuggable with native debugger (like LLDB)."); diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 61d415276..7b9ce5bd1 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -142,7 +142,9 @@ class OatSymbolizer FINAL { text->End(); if (oat_file_->BssSize() != 0) { - bss->WriteNoBitsSection(oat_file_->BssSize()); + bss->Start(); + bss->SetSize(oat_file_->BssSize()); + bss->End(); } builder_->WriteDynamicSection(elf_file->GetPath()); diff --git a/test/137-cfi/expected.txt b/test/137-cfi/expected.txt index 8db785369..6a5618ebc 100644 --- a/test/137-cfi/expected.txt +++ b/test/137-cfi/expected.txt @@ -1,2 +1 @@ JNI_OnLoad called -JNI_OnLoad called diff --git a/test/137-cfi/run b/test/137-cfi/run index 66575fcd2..9c567b681 100755 --- a/test/137-cfi/run +++ b/test/137-cfi/run @@ -14,8 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Test with full DWARF debugging information. -${RUN} "$@" -Xcompiler-option --generate-debug-info - -# Test with minimal compressed debugging information. -${RUN} "$@" -Xcompiler-option --generate-mini-debug-info +exec ${RUN} "$@" -Xcompiler-option --generate-debug-info -- 2.11.0