summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-02 14:07:33 -0800
committerAndreas Gampe <agampe@google.com>2015-03-04 12:19:44 -0800
commit7b2f09eb6b5c74ffc38bd70f0aa74b8f8112e394 (patch)
treebe2f01bfa3e326ea10ee3a670cca8e41a5abaa6d
parentdc47e986941b1a3754447fabea272485f3f0f382 (diff)
downloadart-7b2f09eb6b5c74ffc38bd70f0aa74b8f8112e394.tar.gz
art-7b2f09eb6b5c74ffc38bd70f0aa74b8f8112e394.tar.bz2
art-7b2f09eb6b5c74ffc38bd70f0aa74b8f8112e394.zip
ART: Add debuggable compiler flag
Add a flag to compiler options that shows debuggability. Change-Id: Id17ec72babe2ee88713a0d274eff86508de30666
-rw-r--r--compiler/driver/compiler_options.cc3
-rw-r--r--compiler/driver/compiler_options.h6
-rw-r--r--compiler/jit/jit_compiler.cc1
-rw-r--r--dex2oat/dex2oat.cc8
-rw-r--r--runtime/runtime.cc4
5 files changed, 22 insertions, 0 deletions
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 09ec9a2973..067e1bd7d6 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -30,6 +30,7 @@ CompilerOptions::CompilerOptions()
generate_gdb_information_(false),
include_patch_information_(kDefaultIncludePatchInformation),
top_k_profile_threshold_(kDefaultTopKProfileThreshold),
+ debuggable_(false),
include_debug_symbols_(kDefaultIncludeDebugSymbols),
implicit_null_checks_(true),
implicit_so_checks_(true),
@@ -49,6 +50,7 @@ CompilerOptions::CompilerOptions(CompilerFilter compiler_filter,
bool generate_gdb_information,
bool include_patch_information,
double top_k_profile_threshold,
+ bool debuggable,
bool include_debug_symbols,
bool implicit_null_checks,
bool implicit_so_checks,
@@ -67,6 +69,7 @@ CompilerOptions::CompilerOptions(CompilerFilter compiler_filter,
generate_gdb_information_(generate_gdb_information),
include_patch_information_(include_patch_information),
top_k_profile_threshold_(top_k_profile_threshold),
+ debuggable_(debuggable),
include_debug_symbols_(include_debug_symbols),
implicit_null_checks_(implicit_null_checks),
implicit_so_checks_(implicit_so_checks),
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 122ae4b575..8ae2edf3b5 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -66,6 +66,7 @@ class CompilerOptions FINAL {
bool generate_gdb_information,
bool include_patch_information,
double top_k_profile_threshold,
+ bool debuggable,
bool include_debug_symbols,
bool implicit_null_checks,
bool implicit_so_checks,
@@ -132,6 +133,10 @@ class CompilerOptions FINAL {
return top_k_profile_threshold_;
}
+ bool GetDebuggable() const {
+ return debuggable_;
+ }
+
bool GetIncludeDebugSymbols() const {
return include_debug_symbols_;
}
@@ -193,6 +198,7 @@ class CompilerOptions FINAL {
const bool include_patch_information_;
// When using a profile file only the top K% of the profiled samples will be compiled.
const double top_k_profile_threshold_;
+ const bool debuggable_;
const bool include_debug_symbols_;
const bool implicit_null_checks_;
const bool implicit_so_checks_;
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index 0283791e28..ff98d4af23 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -72,6 +72,7 @@ JitCompiler::JitCompiler() : total_time_(0) {
false,
false,
CompilerOptions::kDefaultTopKProfileThreshold,
+ false, // TODO: Think about debuggability of JIT-compiled code.
false,
false,
false,
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 22665ea6ee..4460523517 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -491,6 +491,7 @@ class Dex2Oat FINAL {
// Profile file to use
double top_k_profile_threshold = CompilerOptions::kDefaultTopKProfileThreshold;
+ bool debuggable = false;
bool include_patch_information = CompilerOptions::kDefaultIncludePatchInformation;
bool include_debug_symbols = kIsDebugBuild;
bool watch_dog_enabled = true;
@@ -679,6 +680,8 @@ class Dex2Oat FINAL {
} else if (option == "--no-include-debug-symbols" || option == "--strip-symbols") {
include_debug_symbols = false;
generate_gdb_information = false; // Depends on debug symbols, see above.
+ } else if (option == "--debuggable") {
+ debuggable = true;
} else if (option.starts_with("--profile-file=")) {
profile_file_ = option.substr(strlen("--profile-file=")).data();
VLOG(compiler) << "dex2oat: profile file is " << profile_file_;
@@ -926,6 +929,10 @@ 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,
@@ -935,6 +942,7 @@ class Dex2Oat FINAL {
generate_gdb_information,
include_patch_information,
top_k_profile_threshold,
+ debuggable,
include_debug_symbols,
implicit_null_checks,
implicit_so_checks,
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 383308cf9e..6d9f20e147 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1674,6 +1674,10 @@ void Runtime::AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::strin
std::string feature_string("--instruction-set-features=");
feature_string += features->GetFeatureString();
argv->push_back(feature_string);
+
+ if (Dbg::IsJdwpConfigured()) {
+ argv->push_back("--debuggable");
+ }
}
void Runtime::UpdateProfilerState(int state) {