1 # Copyright 2014 the V8 project authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 # Print HeapObjects. 6 define job 7 call _v8_internal_Print_Object((void*)($arg0)) 8 end 9 document job 10 Print a v8 JavaScript object 11 Usage: job tagged_ptr 12 end 13 14 # Print Code objects containing given PC. 15 define jco 16 call _v8_internal_Print_Code((void*)($arg0)) 17 end 18 document jco 19 Print a v8 Code object from an internal code address 20 Usage: jco pc 21 end 22 23 # Print TypeFeedbackVector 24 define jfv 25 call _v8_internal_Print_TypeFeedbackVector((void*)($arg0)) 26 end 27 document jfv 28 Print a v8 TypeFeedbackVector object 29 Usage: jtv tagged_ptr 30 end 31 32 # Print DescriptorArray. 33 define jda 34 call _v8_internal_Print_DescriptorArray((void*)($arg0)) 35 end 36 document jda 37 Print a v8 DescriptorArray object 38 Usage: jda tagged_ptr 39 end 40 41 # Print TransitionArray. 42 define jta 43 call _v8_internal_Print_TransitionArray((void*)($arg0)) 44 end 45 document jta 46 Print a v8 TransitionArray object 47 Usage: jta tagged_ptr 48 end 49 50 # Print JavaScript stack trace. 51 define jst 52 call _v8_internal_Print_StackTrace() 53 end 54 document jst 55 Print the current JavaScript stack trace 56 Usage: jst 57 end 58 59 # Skip the JavaScript stack. 60 define jss 61 set $js_entry_sp=v8::internal::Isolate::Current()->thread_local_top()->js_entry_sp_ 62 set $rbp=*(void**)$js_entry_sp 63 set $rsp=$js_entry_sp + 2*sizeof(void*) 64 set $pc=*(void**)($js_entry_sp+sizeof(void*)) 65 end 66 document jss 67 Skip the jitted stack on x64 to where we entered JS last. 68 Usage: jss 69 end 70 71 # Print stack trace with assertion scopes. 72 define bta 73 python 74 import re 75 frame_re = re.compile("^#(\d+)\s*(?:0x[a-f\d]+ in )?(.+) \(.+ at (.+)") 76 assert_re = re.compile("^\s*(\S+) = .+<v8::internal::Per\w+AssertType::(\w+)_ASSERT, (false|true)>") 77 btl = gdb.execute("backtrace full", to_string = True).splitlines() 78 for l in btl: 79 match = frame_re.match(l) 80 if match: 81 print("[%-2s] %-60s %-40s" % (match.group(1), match.group(2), match.group(3))) 82 match = assert_re.match(l) 83 if match: 84 if match.group(3) == "false": 85 prefix = "Disallow" 86 color = "\033[91m" 87 else: 88 prefix = "Allow" 89 color = "\033[92m" 90 print("%s -> %s %s (%s)\033[0m" % (color, prefix, match.group(2), match.group(1))) 91 end 92 end 93 document bta 94 Print stack trace with assertion scopes 95 Usage: bta 96 end 97 98 set disassembly-flavor intel 99 set disable-randomization off 100