Commit 6c30d63a authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[heap] Add instrumentation to GcSafeFindCodeForInnerPointer, pt.2

... in order to ease issues debugging.

Bug: chromium:1241665
Change-Id: I7731a37e642acd0aef02570fb70faf0bc65495ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3353367Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78430}
parent 6072179d
...@@ -642,10 +642,11 @@ void Isolate::PushStackTraceAndDie(void* ptr1, void* ptr2, void* ptr3, ...@@ -642,10 +642,11 @@ void Isolate::PushStackTraceAndDie(void* ptr1, void* ptr2, void* ptr3,
base::OS::Abort(); base::OS::Abort();
} }
void Isolate::PushParamsAndDie(void* ptr1, void* ptr2, void* ptr3, void* ptr4) { void Isolate::PushParamsAndDie(void* ptr1, void* ptr2, void* ptr3, void* ptr4,
void* ptr5, void* ptr6) {
StackTraceFailureMessage message( StackTraceFailureMessage message(
this, StackTraceFailureMessage::kDontIncludeStackTrace, ptr1, ptr2, ptr3, this, StackTraceFailureMessage::kDontIncludeStackTrace, ptr1, ptr2, ptr3,
ptr4); ptr4, ptr5, ptr6);
message.Print(); message.Print();
base::OS::Abort(); base::OS::Abort();
} }
...@@ -655,18 +656,20 @@ void StackTraceFailureMessage::Print() volatile { ...@@ -655,18 +656,20 @@ void StackTraceFailureMessage::Print() volatile {
// to force stack allocation. // to force stack allocation.
base::OS::PrintError( base::OS::PrintError(
"Stacktrace:\n ptr1=%p\n ptr2=%p\n ptr3=%p\n ptr4=%p\n " "Stacktrace:\n ptr1=%p\n ptr2=%p\n ptr3=%p\n ptr4=%p\n "
"failure_message_object=%p\n%s", "ptr5=%p\n ptr6=%p\n failure_message_object=%p\n%s",
ptr1_, ptr2_, ptr3_, ptr4_, this, &js_stack_trace_[0]); ptr1_, ptr2_, ptr3_, ptr4_, ptr5_, ptr6_, this, &js_stack_trace_[0]);
} }
StackTraceFailureMessage::StackTraceFailureMessage( StackTraceFailureMessage::StackTraceFailureMessage(
Isolate* isolate, StackTraceFailureMessage::StackTraceMode mode, void* ptr1, Isolate* isolate, StackTraceFailureMessage::StackTraceMode mode, void* ptr1,
void* ptr2, void* ptr3, void* ptr4) { void* ptr2, void* ptr3, void* ptr4, void* ptr5, void* ptr6) {
isolate_ = isolate; isolate_ = isolate;
ptr1_ = ptr1; ptr1_ = ptr1;
ptr2_ = ptr2; ptr2_ = ptr2;
ptr3_ = ptr3; ptr3_ = ptr3;
ptr4_ = ptr4; ptr4_ = ptr4;
ptr5_ = ptr5;
ptr6_ = ptr6;
// Write a stracktrace into the {js_stack_trace_} buffer. // Write a stracktrace into the {js_stack_trace_} buffer.
const size_t buffer_length = arraysize(js_stack_trace_); const size_t buffer_length = arraysize(js_stack_trace_);
memset(&js_stack_trace_, 0, buffer_length); memset(&js_stack_trace_, 0, buffer_length);
......
...@@ -895,7 +895,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { ...@@ -895,7 +895,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
void* ptr4 = nullptr); void* ptr4 = nullptr);
// Similar to the above but without collecting the stack trace. // Similar to the above but without collecting the stack trace.
V8_NOINLINE void PushParamsAndDie(void* ptr1 = nullptr, void* ptr2 = nullptr, V8_NOINLINE void PushParamsAndDie(void* ptr1 = nullptr, void* ptr2 = nullptr,
void* ptr3 = nullptr, void* ptr4 = nullptr); void* ptr3 = nullptr, void* ptr4 = nullptr,
void* ptr5 = nullptr, void* ptr6 = nullptr);
Handle<FixedArray> CaptureDetailedStackTrace( Handle<FixedArray> CaptureDetailedStackTrace(
int limit, StackTrace::StackTraceOptions options); int limit, StackTrace::StackTraceOptions options);
Handle<FixedArray> CaptureSimpleStackTrace(int limit, FrameSkipMode mode, Handle<FixedArray> CaptureSimpleStackTrace(int limit, FrameSkipMode mode,
...@@ -2503,7 +2504,8 @@ class StackTraceFailureMessage { ...@@ -2503,7 +2504,8 @@ class StackTraceFailureMessage {
explicit StackTraceFailureMessage(Isolate* isolate, StackTraceMode mode, explicit StackTraceFailureMessage(Isolate* isolate, StackTraceMode mode,
void* ptr1 = nullptr, void* ptr2 = nullptr, void* ptr1 = nullptr, void* ptr2 = nullptr,
void* ptr3 = nullptr, void* ptr4 = nullptr); void* ptr3 = nullptr, void* ptr4 = nullptr,
void* ptr5 = nullptr, void* ptr6 = nullptr);
V8_NOINLINE void Print() volatile; V8_NOINLINE void Print() volatile;
...@@ -2517,6 +2519,8 @@ class StackTraceFailureMessage { ...@@ -2517,6 +2519,8 @@ class StackTraceFailureMessage {
void* ptr2_; void* ptr2_;
void* ptr3_; void* ptr3_;
void* ptr4_; void* ptr4_;
void* ptr5_;
void* ptr6_;
void* code_objects_[4]; void* code_objects_[4];
char js_stack_trace_[kStacktraceBufferSize]; char js_stack_trace_[kStacktraceBufferSize];
uintptr_t end_marker_ = kEndMarker; uintptr_t end_marker_ = kEndMarker;
......
...@@ -7178,11 +7178,20 @@ Code Heap::GcSafeFindCodeForInnerPointer(Address inner_pointer) { ...@@ -7178,11 +7178,20 @@ Code Heap::GcSafeFindCodeForInnerPointer(Address inner_pointer) {
} }
} }
// TODO(1241665): Remove once the issue is solved. // TODO(1241665): Remove once the issue is solved.
std::shared_ptr<CodeRange> code_range = CodeRange::GetProcessWideCodeRange();
void* code_range_embedded_blob_code_copy =
code_range ? code_range->embedded_blob_code_copy() : nullptr;
Address flags = (isolate()->is_short_builtin_calls_enabled() ? 1 : 0) |
(code_range ? 2 : 0) |
static_cast<Address>(max_old_generation_size());
isolate()->PushParamsAndDie( isolate()->PushParamsAndDie(
reinterpret_cast<void*>(inner_pointer), reinterpret_cast<void*>(inner_pointer),
const_cast<uint8_t*>(isolate()->embedded_blob_code()), const_cast<uint8_t*>(isolate()->embedded_blob_code()),
const_cast<uint8_t*>(Isolate::CurrentEmbeddedBlobCode()), const_cast<uint8_t*>(Isolate::CurrentEmbeddedBlobCode()),
reinterpret_cast<void*>(Isolate::CurrentEmbeddedBlobCodeSize())); code_range_embedded_blob_code_copy,
reinterpret_cast<void*>(Isolate::CurrentEmbeddedBlobCodeSize()),
reinterpret_cast<void*>(flags));
UNREACHABLE(); UNREACHABLE();
} }
......
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