From e6c22a06c9ce355db6244d937c3fa1a2b59d96d4 Mon Sep 17 00:00:00 2001 From: Salome Thirot Date: Tue, 30 Jun 2020 11:43:59 +0100 Subject: [PATCH] Modify --trace-deopt output for signed addresses Modify the output of --trace-deopt to specify which version of the caller's pc (signed with PAC or unsigned) is shown when CFI is enabled. Change-Id: I77006839997a5f50d37d65facbba24d8a86a1509 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2274867 Commit-Queue: Martyn Capewell Reviewed-by: Georg Neis Cr-Commit-Position: refs/heads/master@{#68629} --- src/deoptimizer/deoptimizer.cc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/deoptimizer/deoptimizer.cc b/src/deoptimizer/deoptimizer.cc index 066be82116..d00fe9eefa 100644 --- a/src/deoptimizer/deoptimizer.cc +++ b/src/deoptimizer/deoptimizer.cc @@ -65,7 +65,7 @@ class FrameWriter { void PushCallerPc(intptr_t pc) { top_offset_ -= kPCOnStackSize; frame_->SetCallerPc(top_offset_, pc); - DebugPrintOutputValue(pc, "caller's pc\n"); + DebugPrintOutputPc(pc, "caller's pc\n"); } void PushCallerFp(intptr_t fp) { @@ -114,6 +114,20 @@ class FrameWriter { } } + void DebugPrintOutputPc(intptr_t value, const char* debug_hint = "") { +#ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY + if (trace_scope_ != nullptr) { + PrintF(trace_scope_->file(), + " " V8PRIxPTR_FMT ": [top + %3d] <- " V8PRIxPTR_FMT + " (signed) " V8PRIxPTR_FMT " (unsigned) ; %s", + output_address(top_offset_), top_offset_, value, + PointerAuthentication::StripPAC(value), debug_hint); + } +#else + DebugPrintOutputValue(value, debug_hint); +#endif + } + void DebugPrintOutputObject(Object obj, unsigned output_offset, const char* debug_hint = "") { if (trace_scope_ != nullptr) { @@ -840,9 +854,10 @@ void Deoptimizer::DoComputeOutputFrames() { MessageFor(deopt_kind_)); PrintFunctionName(); PrintF(trace_scope_->file(), - " @%d => node=%d, pc=" V8PRIxPTR_FMT ", caller sp=" V8PRIxPTR_FMT - ", took %0.3f ms]\n", - bailout_id_, node_id.ToInt(), output_[index]->GetPc(), + " @%d => node=%d, pc=" V8PRIxPTR_FMT + " (unsigned), caller sp=" V8PRIxPTR_FMT ", took %0.3f ms]\n", + bailout_id_, node_id.ToInt(), + PointerAuthentication::StripPAC(output_[index]->GetPc()), caller_frame_top_, ms); }