summaryrefslogtreecommitdiffstats
path: root/dex2oat
diff options
context:
space:
mode:
authorDavid Srbecky <dsrbecky@google.com>2015-04-22 18:57:06 -0700
committerDavid Srbecky <dsrbecky@google.com>2015-06-19 01:45:18 +0100
commita26cb57f46fd3f27a930d9d688fe8670c1f24754 (patch)
tree13c7e869aad37f3d4a0e2e80b889b4aa479fdcf2 /dex2oat
parent61e4ec36e8f3435a63c45ad91858ecb5ce50ad72 (diff)
downloadart-a26cb57f46fd3f27a930d9d688fe8670c1f24754.zip
art-a26cb57f46fd3f27a930d9d688fe8670c1f24754.tar.gz
art-a26cb57f46fd3f27a930d9d688fe8670c1f24754.tar.bz2
ART stack unwinding fixes for libunwind/gdb/lldb.
dex2oat can already generate unwinding and symbol information which allows tools to create backtrace of mixed native and Java code. This is a cherry pick from aosp/master which fixes several issues. Most notably: * It enables generation of ELF-64 on 64-bit systems (in dex2oat, C compilers already produce ELF-64). Libunwind requires ELF-64 on 64-bit systems for backtraces to work. * It enables loading of ELF files with dlopen. This is required for libunwind to be able to generate backtrace of current process (i.e. the process requesting backtrace of itself). * It adds unit test to test the above (32 vs 64 bit, in-proces vs out-of-process, application code vs framework code). * Some other fixes or clean-ups which should not be of much significance but which are easier to include to make the important CLs cherry-pick cleanly. This is squash of the following commits from aosp/master: 7381010 ART: CFI Test e1bbed2 ART: Blacklist CFI test for non-compiled run-tests aab9f73 ART: Blacklist CFI test for JIT 4437219 ART: Blacklist CFI test for Heap Poisoning a3a49fe Switch to using ELF-64 for 64-bit architectures. 297ed22 Write 64-bit address in DWARF if we are on 64-bit architecture. 24981a1 Set correct size of PT_PHDR ELF segment. 1a146bf Link .dynamic to .dynstr 67a0653 Make some parts of ELF more (pointer) aligned. f50fa82 Enable 64-bit CFI tests. 49e1fab Use dlopen to load oat files. 5dedb80 Add more logging output for dlopen. aa03870 Find the dlopened file using address rather than file path. 82e73dc Release dummy MemMaps corresponding to dlopen. 5c40961 Test that we can unwind framework code. 020c543 Add more log output to the CFI test. 88da3b0 ART: Fix CFI test wrt/ PIC a70e5b9 CFI test: kill the other process in native code. ad5fa8c Support generation of CFI in .debug_frame format. 90688ae Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write. 97dabb7 Fix build breakage in dwarf_test. 388d286 Generate just single ARM mapping symbol. f898087 Split .oat_patches to multiple sections. 491a7fe Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write (again). 8363c77 Add --generate-debug-info flag and remove the other two flags. 461d72a Generate debug info for core.oat files. Bug: 21924613 Change-Id: I3f944a08dd2ed1df4d8a807da4fee423fdd35eb7
Diffstat (limited to 'dex2oat')
-rw-r--r--dex2oat/dex2oat.cc39
1 files changed, 14 insertions, 25 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 7fa4328..d45ab1b 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -230,14 +230,14 @@ NO_RETURN static void Usage(const char* fmt, ...) {
UsageError("");
UsageError(" --no-include-patch-information: Do not include patching information.");
UsageError("");
- UsageError(" --include-debug-symbols: Include ELF symbols in this oat file");
+ UsageError(" -g");
+ UsageError(" --generate-debug-info: Generate debug information for native debugging,");
+ UsageError(" such as stack unwinding information, ELF symbols and DWARF sections.");
+ UsageError(" This generates all the available information. Unneeded parts can be");
+ UsageError(" stripped using standard command line tools such as strip or objcopy.");
+ UsageError(" (enabled by default in debug builds, disabled by default otherwise)");
UsageError("");
- UsageError(" --no-include-debug-symbols: Do not include ELF symbols in this oat file");
- UsageError("");
- UsageError(" --include-cfi: Include call frame information in the .eh_frame section.");
- UsageError(" The --include-debug-symbols option implies --include-cfi.");
- UsageError("");
- UsageError(" --no-include-cfi: Do not include call frame information in the .eh_frame section.");
+ UsageError(" --no-generate-debug-info: Do not generate debug information for native debugging.");
UsageError("");
UsageError(" --runtime-arg <argument>: used to specify various arguments for the runtime,");
UsageError(" such as initial heap size, maximum heap size, and verbose output.");
@@ -499,8 +499,7 @@ class Dex2Oat FINAL {
bool debuggable = false;
bool include_patch_information = CompilerOptions::kDefaultIncludePatchInformation;
- bool include_debug_symbols = kIsDebugBuild;
- bool include_cfi = kIsDebugBuild;
+ bool generate_debug_info = kIsDebugBuild;
bool watch_dog_enabled = true;
bool abort_on_hard_verifier_error = false;
bool requested_specific_compiler = false;
@@ -682,18 +681,13 @@ class Dex2Oat FINAL {
dump_cfg_file_name_ = option.substr(strlen("--dump-cfg=")).data();
} else if (option == "--dump-stats") {
dump_stats_ = true;
- } else if (option == "--include-debug-symbols" || option == "--no-strip-symbols") {
- include_debug_symbols = true;
- } else if (option == "--no-include-debug-symbols" || option == "--strip-symbols") {
- include_debug_symbols = false;
- } else if (option == "--include-cfi") {
- include_cfi = true;
- } else if (option == "--no-include-cfi") {
- include_cfi = false;
+ } else if (option == "--generate-debug-info" || option == "-g") {
+ generate_debug_info = true;
+ } else if (option == "--no-generate-debug-info") {
+ generate_debug_info = false;
} else if (option == "--debuggable") {
debuggable = true;
- include_debug_symbols = true;
- include_cfi = true;
+ generate_debug_info = true;
} else if (option.starts_with("--profile-file=")) {
profile_file_ = option.substr(strlen("--profile-file=")).data();
VLOG(compiler) << "dex2oat: profile file is " << profile_file_;
@@ -933,10 +927,6 @@ class Dex2Oat FINAL {
break;
}
- if (debuggable) {
- // TODO: Consider adding CFI info and symbols here.
- }
-
compiler_options_.reset(new CompilerOptions(compiler_filter,
huge_method_threshold,
large_method_threshold,
@@ -946,8 +936,7 @@ class Dex2Oat FINAL {
include_patch_information,
top_k_profile_threshold,
debuggable,
- include_debug_symbols,
- include_cfi,
+ generate_debug_info,
implicit_null_checks,
implicit_so_checks,
implicit_suspend_checks,