Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: src/gdb-jit.h

Issue 6371011: Ensures that GDB prints stacktraces correctly for x64 builds when debugging t... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gdb-jit.h
===================================================================
--- src/gdb-jit.h (revision 6445)
+++ src/gdb-jit.h (working copy)
@@ -128,9 +128,107 @@
#define GDBJIT(action) GDBJITInterface::action
+#ifdef V8_TARGET_ARCH_X64
+
+// This is currently only available (needed?) for AMD64.
+class UnwindInfoInterface {
+ public:
+
+ // An architecture dependent enum containing the various _states_ the program
+ // is in at various instructions. This information is used to generate the
+ // instructions for the CFI table. If UnwindInfoInterface is extended to other
+ // architectures, this will need to be selectively defined using #if ...
+ // #endif blocks.
+ enum UnwindInfoState {
+ UNWIND_STATE_AFTER_RBP_PUSH,
+ UNWIND_STATE_AFTER_RBP_SET,
+ UNWIND_STATE_AFTER_RBP_POP,
+ UNWIND_STATE_AFTER_RETURN,
+ UNWIND_STATE_MAX
+ };
+
+ struct UnwindInformation {
+ uintptr_t state_offsets_[UNWIND_STATE_MAX];
+ uintptr_t begin_;
+ };
+
+ UnwindInfoInterface();
+ ~UnwindInfoInterface();
+
+ static void SetStatePosition(uintptr_t pc, UnwindInfoState state);
+ static void SetStartAddress(uintptr_t pc);
+
+ // Unwind information emitted for the JS entry and exit stubs are accurate
+ // only at the call-sites. This is done since the more granular approach
+ // (which is used for regular compiled functions) will probably require
+ // considerable change to the internals. Since people are unlikely to step
+ // through the generated stubs, this is unlikely to be a problem.
+ // It is because of this reason, only the start and the end addresses for
+ // code stubs are required. This function does all the work - there is no
+ // need to create a dummy instance of this class for the mechanism to work
+ // correctly.
+ static void SetCodeStub(uintptr_t begin, uintptr_t length);
+
+ private:
+
+ struct UnwindInformationList {
+ UnwindInformation data_;
+ UnwindInformationList *next_;
+ };
+
+ static UnwindInformationList *info_;
+};
+
+
+#define SET_UNWIND_INFO(stage, pc) \
+ UnwindInfoInterface::SetStatePosition(pc, UnwindInfoInterface::stage)
+
+#define SET_UNWIND_INFO_START_ADDRESS(pc) \
+ UnwindInfoInterface::SetStartAddress(pc)
+
+#define SET_UNWIND_INFO_STUB(begin, len) \
+ UnwindInfoInterface::SetCodeStub(begin, len)
+
+
+inline void UnwindInfoInterface::SetStatePosition(
+ uintptr_t pc, UnwindInfoInterface::UnwindInfoState state) {
+ ASSERT(info_);
+ info_->data_.state_offsets_[state] = pc;
+ if (state)
+ ASSERT(info_->data_.state_offsets_[state-1] < pc);
+}
+
+
+inline void UnwindInfoInterface::SetStartAddress(uintptr_t pc) {
+ ASSERT(info_);
+ info_->data_.begin_ = pc;
+}
+
+
+inline UnwindInfoInterface::UnwindInfoInterface() {
+ UnwindInformationList *ulist = new UnwindInformationList();
+ ulist->next_ = info_;
+ info_ = ulist;
+}
+
+
+#else // V8_TARGET_ARCH_X64
+
+
+#define SET_UNWIND_INFO(stage, pc) ((void) 0)
+#define SET_UNWIND_INFO_START_ADDRESS(pc) ((void) 0)
+#define SET_UNWIND_INFO_STUB(begin, len) ((void) 0)
+
+
+#endif // V8_TARGET_ARCH_X64
+
+
} } // namespace v8::internal
#else
#define GDBJIT(action) ((void) 0)
+#define SET_UNWIND_INFO(stage, pc) ((void) 0)
+#define SET_UNWIND_INFO_START_ADDRESS(pc) ((void) 0)
+#define SET_UNWIND_INFO_STUB(begin, len)
#endif
#endif

Powered by Google App Engine
This is Rietveld 408576698