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

Side by Side Diff: src/debug.h

Issue 3029033: Fix 'step in' after live edit stack manipulation (Closed)
Patch Set: follow codereview Created 10 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // Getters for the current exception break state. 325 // Getters for the current exception break state.
326 static bool break_on_exception() { return break_on_exception_; } 326 static bool break_on_exception() { return break_on_exception_; }
327 static bool break_on_uncaught_exception() { 327 static bool break_on_uncaught_exception() {
328 return break_on_uncaught_exception_; 328 return break_on_uncaught_exception_;
329 } 329 }
330 330
331 enum AddressId { 331 enum AddressId {
332 k_after_break_target_address, 332 k_after_break_target_address,
333 k_debug_break_return_address, 333 k_debug_break_return_address,
334 k_debug_break_slot_address, 334 k_debug_break_slot_address,
335 k_restarter_frame_function_pointer,
335 k_register_address 336 k_register_address
336 }; 337 };
337 338
338 // Support for setting the address to jump to when returning from break point. 339 // Support for setting the address to jump to when returning from break point.
339 static Address* after_break_target_address() { 340 static Address* after_break_target_address() {
340 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); 341 return reinterpret_cast<Address*>(&thread_local_.after_break_target_);
341 } 342 }
343 static Address* restarter_frame_function_pointer_address() {
344 Object*** address = &thread_local_.restarter_frame_function_pointer_;
345 return reinterpret_cast<Address*>(address);
346 }
342 347
343 // Support for saving/restoring registers when handling debug break calls. 348 // Support for saving/restoring registers when handling debug break calls.
344 static Object** register_address(int r) { 349 static Object** register_address(int r) {
345 return &registers_[r]; 350 return &registers_[r];
346 } 351 }
347 352
348 // Access to the debug break on return code. 353 // Access to the debug break on return code.
349 static Code* debug_break_return() { return debug_break_return_; } 354 static Code* debug_break_return() { return debug_break_return_; }
350 static Code** debug_break_return_address() { 355 static Code** debug_break_return_address() {
351 return &debug_break_return_; 356 return &debug_break_return_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 FRAME_DROPPED_IN_IC_CALL, 413 FRAME_DROPPED_IN_IC_CALL,
409 // The top JS frame had been calling debug break slot stub. Patch the 414 // The top JS frame had been calling debug break slot stub. Patch the
410 // address this stub jumps to in the end. 415 // address this stub jumps to in the end.
411 FRAME_DROPPED_IN_DEBUG_SLOT_CALL, 416 FRAME_DROPPED_IN_DEBUG_SLOT_CALL,
412 // The top JS frame had been calling some C++ function. The return address 417 // The top JS frame had been calling some C++ function. The return address
413 // gets patched automatically. 418 // gets patched automatically.
414 FRAME_DROPPED_IN_DIRECT_CALL 419 FRAME_DROPPED_IN_DIRECT_CALL
415 }; 420 };
416 421
417 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, 422 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
418 FrameDropMode mode); 423 FrameDropMode mode,
424 Object** restarter_frame_function_pointer);
419 425
420 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, 426 // Initializes an artificial stack frame. The data it contains is used for:
421 Handle<Code> code); 427 // a. successful work of frame dropper code which eventually gets control,
428 // b. being compatible with regular stack structure for various stack
429 // iterators.
430 // Returns address of stack allocated pointer to restarted function,
431 // the value that is called 'restarter_frame_function_pointer'. The value
432 // at this address (possibly updated by GC) may be used later when preparing
433 // 'step in' operation.
434 // The implementation is architecture-specific.
435 // TODO(LiveEdit): consider reviewing it as architecture-independent.
436 static Object** SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
437 Handle<Code> code);
438
422 static const int kFrameDropperFrameSize; 439 static const int kFrameDropperFrameSize;
423 440
424 private: 441 private:
425 static bool CompileDebuggerScript(int index); 442 static bool CompileDebuggerScript(int index);
426 static void ClearOneShot(); 443 static void ClearOneShot();
427 static void ActivateStepIn(StackFrame* frame); 444 static void ActivateStepIn(StackFrame* frame);
428 static void ClearStepIn(); 445 static void ClearStepIn();
429 static void ActivateStepOut(StackFrame* frame); 446 static void ActivateStepOut(StackFrame* frame);
430 static void ClearStepOut(); 447 static void ClearStepOut();
431 static void ClearStepNext(); 448 static void ClearStepNext();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 505
489 // Stores the way how LiveEdit has patched the stack. It is used when 506 // Stores the way how LiveEdit has patched the stack. It is used when
490 // debugger returns control back to user script. 507 // debugger returns control back to user script.
491 FrameDropMode frame_drop_mode_; 508 FrameDropMode frame_drop_mode_;
492 509
493 // Top debugger entry. 510 // Top debugger entry.
494 EnterDebugger* debugger_entry_; 511 EnterDebugger* debugger_entry_;
495 512
496 // Pending interrupts scheduled while debugging. 513 // Pending interrupts scheduled while debugging.
497 int pending_interrupts_; 514 int pending_interrupts_;
515
516 // When restarter frame is on stack, stores the address
517 // of the pointer to function being restarted. Otherwise (most of the time)
518 // stores NULL. This pointer is used with 'step in' implementation.
519 Object** restarter_frame_function_pointer_;
498 }; 520 };
499 521
500 // Storage location for registers when handling debug break calls 522 // Storage location for registers when handling debug break calls
501 static JSCallerSavedBuffer registers_; 523 static JSCallerSavedBuffer registers_;
502 static ThreadLocal thread_local_; 524 static ThreadLocal thread_local_;
503 static void ThreadInit(); 525 static void ThreadInit();
504 526
505 // Code to call for handling debug break on return. 527 // Code to call for handling debug break on return.
506 static Code* debug_break_return_; 528 static Code* debug_break_return_;
507 529
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 955 }
934 956
935 static Debug_Address AfterBreakTarget() { 957 static Debug_Address AfterBreakTarget() {
936 return Debug_Address(Debug::k_after_break_target_address); 958 return Debug_Address(Debug::k_after_break_target_address);
937 } 959 }
938 960
939 static Debug_Address DebugBreakReturn() { 961 static Debug_Address DebugBreakReturn() {
940 return Debug_Address(Debug::k_debug_break_return_address); 962 return Debug_Address(Debug::k_debug_break_return_address);
941 } 963 }
942 964
965 static Debug_Address RestarterFrameFunctionPointer() {
966 return Debug_Address(Debug::k_restarter_frame_function_pointer);
967 }
968
943 static Debug_Address Register(int reg) { 969 static Debug_Address Register(int reg) {
944 return Debug_Address(Debug::k_register_address, reg); 970 return Debug_Address(Debug::k_register_address, reg);
945 } 971 }
946 972
947 Address address() const { 973 Address address() const {
948 switch (id_) { 974 switch (id_) {
949 case Debug::k_after_break_target_address: 975 case Debug::k_after_break_target_address:
950 return reinterpret_cast<Address>(Debug::after_break_target_address()); 976 return reinterpret_cast<Address>(Debug::after_break_target_address());
951 case Debug::k_debug_break_return_address: 977 case Debug::k_debug_break_return_address:
952 return reinterpret_cast<Address>(Debug::debug_break_return_address()); 978 return reinterpret_cast<Address>(Debug::debug_break_return_address());
953 case Debug::k_debug_break_slot_address: 979 case Debug::k_debug_break_slot_address:
954 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); 980 return reinterpret_cast<Address>(Debug::debug_break_slot_address());
981 case Debug::k_restarter_frame_function_pointer:
982 return reinterpret_cast<Address>(
983 Debug::restarter_frame_function_pointer_address());
955 case Debug::k_register_address: 984 case Debug::k_register_address:
956 return reinterpret_cast<Address>(Debug::register_address(reg_)); 985 return reinterpret_cast<Address>(Debug::register_address(reg_));
957 default: 986 default:
958 UNREACHABLE(); 987 UNREACHABLE();
959 return NULL; 988 return NULL;
960 } 989 }
961 } 990 }
962 private: 991 private:
963 Debug::AddressId id_; 992 Debug::AddressId id_;
964 int reg_; 993 int reg_;
(...skipping 19 matching lines...) Expand all
984 1013
985 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); 1014 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread);
986 }; 1015 };
987 1016
988 1017
989 } } // namespace v8::internal 1018 } } // namespace v8::internal
990 1019
991 #endif // ENABLE_DEBUGGER_SUPPORT 1020 #endif // ENABLE_DEBUGGER_SUPPORT
992 1021
993 #endif // V8_DEBUG_H_ 1022 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698