Fix debuggable compiler flag detection for secondary dex files

Compiles secondary dex files like the primary dex file: if it has
been compiled with the --debuggable flag, compile secondary dex files
with the --debuggable flag too.

Therefore, dex files loaded at runtime are compiled the same way as
dex files compiled at install time on the classpath (excluding the
boot image that is not compiled debuggable).

Also adds debuggable key in the oat header and bump the oat version.

Bug: 20944228
Change-Id: I59119f3468adb27ab1d6026f2cefbebbd814224c
diff --git a/runtime/oat.h b/runtime/oat.h
index aaf442a..604e161 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -32,14 +32,18 @@
 class PACKED(4) OatHeader {
  public:
   static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
-  static constexpr uint8_t kOatVersion[] = { '0', '6', '2', '\0' };
+  static constexpr uint8_t kOatVersion[] = { '0', '6', '3', '\0' };
 
   static constexpr const char* kImageLocationKey = "image-location";
   static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
   static constexpr const char* kDex2OatHostKey = "dex2oat-host";
   static constexpr const char* kPicKey = "pic";
+  static constexpr const char* kDebuggableKey = "debuggable";
   static constexpr const char* kClassPathKey = "classpath";
 
+  static constexpr const char kTrueValue[] = "true";
+  static constexpr const char kFalseValue[] = "false";
+
   static OatHeader* Create(InstructionSet instruction_set,
                            const InstructionSetFeatures* instruction_set_features,
                            const std::vector<const DexFile*>* dex_files,
@@ -99,6 +103,7 @@
 
   size_t GetHeaderSize() const;
   bool IsPic() const;
+  bool IsDebuggable() const;
 
  private:
   OatHeader(InstructionSet instruction_set,
@@ -108,6 +113,9 @@
             uint32_t image_file_location_oat_data_begin,
             const SafeMap<std::string, std::string>* variable_data);
 
+  // Returns true if the value of the given key is "true", false otherwise.
+  bool IsKeyEnabled(const char* key) const;
+
   void Flatten(const SafeMap<std::string, std::string>* variable_data);
 
   uint8_t magic_[4];