Commit b240733f authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[gdb] Add helper for creating an object from a pointer

Since the new Objects were introduced, we can no longer cast integers to
and Object pointer and call methods on them in gdb (due to how gdb's
expression evaluator deals with temporaries). So, we add a new helper
method to our gdbinit, "$job", which takes an address and returns an
Object that is now exists in real (stack) memory.

Bug: v8:8994
Change-Id: I760a007e7d2303e3a4b1fecb87e094fb9974e91e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1523329
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60245}
parent d77a2a6c
......@@ -2691,6 +2691,10 @@ inline i::Object GetObjectFromRaw(void* object) {
//
// The following functions are used by our gdb macros.
//
V8_EXPORT_PRIVATE extern i::Object _v8_internal_Get_Object(void* object) {
return GetObjectFromRaw(object);
}
V8_EXPORT_PRIVATE extern void _v8_internal_Print_Object(void* object) {
GetObjectFromRaw(object)->Print();
}
......
......@@ -163,3 +163,17 @@ def dcheck_stop_handler(event):
gdb.events.stop.connect(dcheck_stop_handler)
end
# Install a $job function which returns an Object given a tagged pointer.
# Use with print or call, casting as needed, e.g.
#
# gdb$ p (v8::internal::SharedFunctionInfo)$job(0x31412531)
python
class Job(gdb.Function):
def __init__(self):
super(Job,self).__init__("job")
def invoke(self, address):
# TODO(leszeks): Detect the type of the object and cast it.
return gdb.parse_and_eval("_v8_internal_Get_Object")(address)
Job()
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment