[gdb] Define print functions used by gdb macros in the top level namespace to make them always be available.

This should fix the following errors that sometimes appear when using V8 gdb macros:
  Cannot evaluate function -- may be inlined
or
  No symbol "xxx" in namespace "v8::internal".

Review-Url: https://codereview.chromium.org/2186293002
Cr-Commit-Position: refs/heads/master@{#38145}
This commit is contained in:
ishell 2016-07-28 10:09:10 -07:00 committed by Commit bot
parent 70489a1be5
commit e063b7118c
2 changed files with 47 additions and 6 deletions

View File

@ -1469,3 +1469,44 @@ void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
#endif // defined(DEBUG) || defined(OBJECT_PRINT)
} // namespace internal
} // namespace v8
//
// The following functions are used by our gdb macros.
//
extern void _v8_internal_Print_Object(void* object) {
reinterpret_cast<i::Object*>(object)->Print();
}
extern void _v8_internal_Print_Code(void* object) {
i::Isolate* isolate = i::Isolate::Current();
isolate->FindCodeObject(reinterpret_cast<i::Address>(object))->Print();
}
extern void _v8_internal_Print_TypeFeedbackVector(void* object) {
if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
printf("Not a type feedback vector\n");
} else {
reinterpret_cast<i::TypeFeedbackVector*>(object)->Print();
}
}
extern void _v8_internal_Print_DescriptorArray(void* object) {
if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
printf("Not a descriptor array\n");
} else {
reinterpret_cast<i::DescriptorArray*>(object)->Print();
}
}
extern void _v8_internal_Print_TransitionArray(void* object) {
if (reinterpret_cast<i::Object*>(object)->IsSmi()) {
printf("Not a transition array\n");
} else {
reinterpret_cast<i::TransitionArray*>(object)->Print();
}
}
extern void _v8_internal_Print_StackTrace() {
i::Isolate* isolate = i::Isolate::Current();
isolate->PrintStack(stdout);
}

View File

@ -4,7 +4,7 @@
# Print HeapObjects.
define job
print ((v8::internal::HeapObject*)($arg0))->Print()
call _v8_internal_Print_Object((void*)($arg0))
end
document job
Print a v8 JavaScript object
@ -13,7 +13,7 @@ end
# Print Code objects containing given PC.
define jco
job (v8::internal::Isolate::Current()->FindCodeObject((v8::internal::Address)$arg0))
call _v8_internal_Print_Code((void*)($arg0))
end
document jco
Print a v8 Code object from an internal code address
@ -22,7 +22,7 @@ end
# Print TypeFeedbackVector
define jfv
print ((v8::internal::TypeFeedbackVector*)($arg0))->Print()
call _v8_internal_Print_TypeFeedbackVector((void*)($arg0))
end
document jfv
Print a v8 TypeFeedbackVector object
@ -31,7 +31,7 @@ end
# Print DescriptorArray.
define jda
print ((v8::internal::DescriptorArray*)($arg0))->Print()
call _v8_internal_Print_DescriptorArray((void*)($arg0))
end
document jda
Print a v8 DescriptorArray object
@ -40,7 +40,7 @@ end
# Print TransitionArray.
define jta
print ((v8::internal::TransitionArray*)($arg0))->Print()
call _v8_internal_Print_TransitionArray((void*)($arg0))
end
document jta
Print a v8 TransitionArray object
@ -49,7 +49,7 @@ end
# Print JavaScript stack trace.
define jst
print v8::internal::Isolate::Current()->PrintStack((FILE*) stdout, 1)
call _v8_internal_Print_StackTrace()
end
document jst
Print the current JavaScript stack trace