[PATCH 1/2] perf doc: Update jitdump unwind info specification

From: Namhyung Kim
Date: Tue Jan 09 2024 - 19:55:02 EST


Currently the jitdump spec says the EH frame header is followed by the
actual EH frame data. But in fact, it's the opposite way.

I've checked this with the v8 javascript engine which, I believe, is the
actual user of this feature.

https://github.com/v8/v8/blob/04f51bc70a38fbea743588e41290bea40830a486/src/diagnostics/eh-frame.cc#L157

Also, the unwind_data_size field should have the size of both unwind
table and the header sections. The jit_add_eh_frame_info() in genelf.c
calculates the table size by subtracting the header size from it.

Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Cc: Stefano Sanfilippo <ssanfilippo@xxxxxxxxxxxx>
Cc: Steve MacLean <Steve.MacLean@xxxxxxxxxxxxx>
Reported-by: Pablo Galindo <pablogsal@xxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/Documentation/jitdump-specification.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/jitdump-specification.txt b/tools/perf/Documentation/jitdump-specification.txt
index 79936355d819..5c3fbbbebf14 100644
--- a/tools/perf/Documentation/jitdump-specification.txt
+++ b/tools/perf/Documentation/jitdump-specification.txt
@@ -155,10 +155,10 @@ The record is used to describe the unwinding information for a jitted function.

The record has the following fields following the fixed-size record header in order:

-uint64_t unwind_data_size : the size in bytes of the unwinding data table at the end of the record
-uint64_t eh_frame_hdr_size : the size in bytes of the DWARF EH Frame Header at the start of the unwinding data table at the end of the record
+uint64_t unwind_data_size : the size in bytes of the unwinding data (EH Frame table and EH Frame Header) at the end of the record
+uint64_t eh_frame_hdr_size : the size in bytes of the DWARF EH Frame Header at the end of the record
uint64_t mapped_size : the size of the unwinding data mapped in memory
-const char unwinding_data[n]: an array of unwinding data, consisting of the EH Frame Header, followed by the actual EH Frame
+const char unwinding_data[n]: an array of unwinding data, consisting of the actual EH Frame, followed by the EH Frame Header


The EH Frame header follows the Linux Standard Base (LSB) specification as described in the document at https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
--
2.43.0.472.g3155946c3a-goog