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. 6define job 7call _v8_internal_Print_Object((void*)($arg0)) 8end 9document job 10Print a v8 JavaScript object 11Usage: job tagged_ptr 12end 13 14# Print Code objects containing given PC. 15define jco 16call _v8_internal_Print_Code((void*)($arg0)) 17end 18document jco 19Print a v8 Code object from an internal code address 20Usage: jco pc 21end 22 23# Print TypeFeedbackVector 24define jfv 25call _v8_internal_Print_TypeFeedbackVector((void*)($arg0)) 26end 27document jfv 28Print a v8 TypeFeedbackVector object 29Usage: jtv tagged_ptr 30end 31 32# Print DescriptorArray. 33define jda 34call _v8_internal_Print_DescriptorArray((void*)($arg0)) 35end 36document jda 37Print a v8 DescriptorArray object 38Usage: jda tagged_ptr 39end 40 41# Print TransitionArray. 42define jta 43call _v8_internal_Print_TransitionArray((void*)($arg0)) 44end 45document jta 46Print a v8 TransitionArray object 47Usage: jta tagged_ptr 48end 49 50# Print JavaScript stack trace. 51define jst 52call _v8_internal_Print_StackTrace() 53end 54document jst 55Print the current JavaScript stack trace 56Usage: jst 57end 58 59# Skip the JavaScript stack. 60define jss 61set $js_entry_sp=v8::internal::Isolate::Current()->thread_local_top()->js_entry_sp_ 62set $rbp=*(void**)$js_entry_sp 63set $rsp=$js_entry_sp + 2*sizeof(void*) 64set $pc=*(void**)($js_entry_sp+sizeof(void*)) 65end 66document jss 67Skip the jitted stack on x64 to where we entered JS last. 68Usage: jss 69end 70 71# Print stack trace with assertion scopes. 72define bta 73python 74import re 75frame_re = re.compile("^#(\d+)\s*(?:0x[a-f\d]+ in )?(.+) \(.+ at (.+)") 76assert_re = re.compile("^\s*(\S+) = .+<v8::internal::Per\w+AssertType::(\w+)_ASSERT, (false|true)>") 77btl = gdb.execute("backtrace full", to_string = True).splitlines() 78for 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))) 91end 92end 93document bta 94Print stack trace with assertion scopes 95Usage: bta 96end 97 98set disassembly-flavor intel 99set disable-randomization off 100