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 v8::Local handle value. 15define jlh 16call _v8_internal_Print_Object(*(v8::internal::Object**)(*$arg0)) 17end 18document jlh 19Print content of a v8::Local handle 20Usage: jlh local_handle 21end 22 23# Print Code objects containing given PC. 24define jco 25call _v8_internal_Print_Code((void*)($arg0)) 26end 27document jco 28Print a v8 Code object from an internal code address 29Usage: jco pc 30end 31 32# Print FeedbackVector 33define jfv 34call _v8_internal_Print_FeedbackVector((void*)($arg0)) 35end 36document jfv 37Print a v8 FeedbackVector object 38Usage: jfv tagged_ptr 39end 40 41# Print FeedbackMetadata 42define jfm 43call _v8_internal_Print_FeedbackMetadata((void*)($arg0)) 44end 45document jfm 46Print a v8 FeedbackMetadata object 47Usage: jfm tagged_ptr 48end 49 50 51# Print DescriptorArray. 52define jda 53call _v8_internal_Print_DescriptorArray((void*)($arg0)) 54end 55document jda 56Print a v8 DescriptorArray object 57Usage: jda tagged_ptr 58end 59 60# Print LayoutDescriptor. 61define jld 62call _v8_internal_Print_LayoutDescriptor((void*)($arg0)) 63end 64document jld 65Print a v8 LayoutDescriptor object 66Usage: jld tagged_ptr 67end 68 69# Print TransitionArray. 70define jta 71call _v8_internal_Print_TransitionArray((void*)($arg0)) 72end 73document jta 74Print a v8 TransitionArray object 75Usage: jta tagged_ptr 76end 77 78# Print JavaScript stack trace. 79define jst 80call _v8_internal_Print_StackTrace() 81end 82document jst 83Print the current JavaScript stack trace 84Usage: jst 85end 86 87# Skip the JavaScript stack. 88define jss 89set $js_entry_sp=v8::internal::Isolate::Current()->thread_local_top()->js_entry_sp_ 90set $rbp=*(void**)$js_entry_sp 91set $rsp=$js_entry_sp + 2*sizeof(void*) 92set $pc=*(void**)($js_entry_sp+sizeof(void*)) 93end 94document jss 95Skip the jitted stack on x64 to where we entered JS last. 96Usage: jss 97end 98 99# Print stack trace with assertion scopes. 100define bta 101python 102import re 103frame_re = re.compile("^#(\d+)\s*(?:0x[a-f\d]+ in )?(.+) \(.+ at (.+)") 104assert_re = re.compile("^\s*(\S+) = .+<v8::internal::Per\w+AssertType::(\w+)_ASSERT, (false|true)>") 105btl = gdb.execute("backtrace full", to_string = True).splitlines() 106for l in btl: 107 match = frame_re.match(l) 108 if match: 109 print("[%-2s] %-60s %-40s" % (match.group(1), match.group(2), match.group(3))) 110 match = assert_re.match(l) 111 if match: 112 if match.group(3) == "false": 113 prefix = "Disallow" 114 color = "\033[91m" 115 else: 116 prefix = "Allow" 117 color = "\033[92m" 118 print("%s -> %s %s (%s)\033[0m" % (color, prefix, match.group(2), match.group(1))) 119end 120end 121document bta 122Print stack trace with assertion scopes 123Usage: bta 124end 125 126set disassembly-flavor intel 127set disable-randomization off 128