diff options
author | David Srbecky <dsrbecky@google.com> | 2015-04-07 20:29:48 +0100 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2015-04-08 16:36:27 +0100 |
commit | dd97393aca1a3ff2abec4dc4f78d7724300971bc (patch) | |
tree | eed7360a80b7543ec7962b47feb7df0d1a8d438e /compiler/utils/assembler.h | |
parent | 1109fb3cacc8bb667979780c2b4b12ce5bb64549 (diff) | |
download | android_art-dd97393aca1a3ff2abec4dc4f78d7724300971bc.tar.gz android_art-dd97393aca1a3ff2abec4dc4f78d7724300971bc.tar.bz2 android_art-dd97393aca1a3ff2abec4dc4f78d7724300971bc.zip |
Implement CFI for JNI.
CFI is necessary for stack unwinding in gdb, lldb, and libunwind.
Change-Id: I37eb7973f99a6975034cf0e699e138c3a9aba10f
Diffstat (limited to 'compiler/utils/assembler.h')
-rw-r--r-- | compiler/utils/assembler.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 323f93cb42..ebafd3dd1e 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -29,6 +29,7 @@ #include "offsets.h" #include "x86/constants_x86.h" #include "x86_64/constants_x86_64.h" +#include "dwarf/debug_frame_opcode_writer.h" namespace art { @@ -354,6 +355,23 @@ class AssemblerBuffer { friend class AssemblerFixup; }; +// The purpose of this class is to ensure that we do not have to explicitly +// call the AdvancePC method (which is good for convenience and correctness). +class DebugFrameOpCodeWriterForAssembler FINAL + : public dwarf::DebugFrameOpCodeWriter<> { + public: + // This method is called the by the opcode writers. + virtual void ImplicitlyAdvancePC() FINAL; + + explicit DebugFrameOpCodeWriterForAssembler(Assembler* buffer) + : dwarf::DebugFrameOpCodeWriter<>(), + assembler_(buffer) { + } + + private: + Assembler* assembler_; +}; + class Assembler { public: static Assembler* Create(InstructionSet instruction_set); @@ -506,10 +524,18 @@ class Assembler { virtual ~Assembler() {} + /** + * @brief Buffer of DWARF's Call Frame Information opcodes. + * @details It is used by debuggers and other tools to unwind the call stack. + */ + DebugFrameOpCodeWriterForAssembler& cfi() { return cfi_; } + protected: - Assembler() : buffer_() {} + Assembler() : buffer_(), cfi_(this) {} AssemblerBuffer buffer_; + + DebugFrameOpCodeWriterForAssembler cfi_; }; } // namespace art |