Commit Graph

14 Commits

Author SHA1 Message Date
Indu Bhagat
604b972e61 doc: sframe: add appendix for generating stack traces
Add an appendix to provide a rough outline to show how to generate stack
traces using the SFrame format.  Such content should hopefully aid the
reader assimmilate the information in the specification.

libsframe/
	* doc/sframe-spec.texi: Add new appendix.
2024-07-09 10:23:31 -07:00
Indu Bhagat
6dacff8a2f doc: sframe: segregate the ABI/arch-specific components
The recipe to interpret the SFrame FRE stack offsets is
ABI/arch-specific.

Although, there is other information in the specification that is
ABI-specific (like pauth_key usage in AArch64), those pieces of
information are now assimmilated in the SFrame specification in a way
that it is fairly difficult to carve then out into a ABI/arch-specific
section without confusing the readers.

For future though, the specification must strive to keep the generic
parts and ABI/arch-specific parts clearly laid out in separate sections.

libsframe/
	* doc/sframe-spec.texi: Reorder and adapt the contents.
2024-07-09 10:23:31 -07:00
Indu Bhagat
f8ed9c5722 doc: sframe: small improvements for readability
Update some of the content to make the specification document hopefully
clearer:
  - Fix some typos.
  - Use Title case consistently for headings.
  - Update text around detection of foreign endianness.
  - Split the structure field "Name" in each table to two separate
    colunms for additional attention: "Type" and "Name".
  - Rename "SFrame endianness" section to "SFrame magic number and
    endianness"
  - Update text around provisions for extending SFrame for future
    ABIs/architectures.  Make it clear by tagging all provisions with an
    explicit index item "Provisions for future ABIs".
  - Add a paragraph on sort order of SFrame FDEs.
  - Add a statement for SFRAME_F_FRAME_POINTER flag.
  - Add a statement to assert that SFrame version 1 is now obsolete and
    should not be used.

libsframe/
	* doc/sframe-spec.texi: Small improvements for readability.
2024-06-25 22:27:12 -07:00
Alan Modra
fd67aa1129 Update year range in copyright notice of binutils files
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:

1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
   author I haven't committed, 'Kalray SA.', to cover gas testsuite
   files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
2024-01-04 22:58:12 +10:30
Indu Bhagat
a5cddf7b64 doc: sframe: update specification for SFRAME_VERSION_2
Add details for the changes made from Version 1 to Version 2 of the format.

Also add details about alignment in the SFrame format.  A portion of the
SFrame stack trace format has an unaligned on-disk representation.  Add
description at relevant points in the specificatin to clarify the
alignment related details.
2023-06-29 16:32:26 -07:00
Indu Bhagat
3169b734cf libsframe: fix sframe_find_fre for pltN entries
For a toy application on x86_64, for example, following is the SFrame
stack trace information for the 3 pltN entries of 16 bytes each:

   func idx [1]: pc = 0x401030, size = 48 bytes
   STARTPC[m]      CFA       FP        RA
   0000000000000000  sp+8      u         u
   000000000000000b  sp+16     u         u

The data in first column is the start_ip_offset.  Also note that the FDE
is of type SFRAME_FDE_TYPE_PCMASK (denoted by the [m] on LHS).

Where each pltN (note: excluding plt0 entry) entry looks like:

  401030: jmp    *0x2fca(%rip)
  401036: push   $0x0
  40103b: jmp    401020<_init+0x20>

  401040: jmp    *0x2fc2(%rip)
  401046: push   $0x1
  40104b: jmp    401020<_init+0x20>

  401050: jmp    *0x2fba(%rip)
  401056: push   $0x2
  40105b: jmp    401020<_init+0x20>

Now, to find SFrame stack trace information from an FDE of type
SFRAME_FDE_TYPE_PCMASK, sframe_find_fre () was doing an operation
like,
  (start_ip_offset & 0xf) >= (pc & 0xf)

This works for pltN entry of size, say, less than 16 bytes.  But if the
pltN entries or similar code stubs (for which SFrame FDE of type
SFRAME_FDE_TYPE_PCMASK may be used), evolve to be of size > 16 bytes,
this will cease to work.

To match the range covered by the SFrame FRE, one should instead perform
a modulo operation.  The constant for the modulo operation must be the
size of the pltN entry.  Further, this constant should ideally be
encoded in the format, as it may be different for each ABI.

In SFrame Version 2 of the format, we will move towards encoding it
explicitly in the SFrame FDE.  For now, fix up the logic to at least
move towards modulo operation.

libsframe/
	* sframe.c (sframe_fre_check_range_p): New definition.
	(sframe_find_fre): Refactor a bit and use the new definition
	above.
include/
	* sframe.h (SFRAME_FDE_TYPE_PCMASK): Update comment.
libsframe/doc/
	* sframe-spec.texi: Fix the text for SFRAME_FDE_TYPE_PCMASK FDE
	type.
2023-06-29 11:03:32 -07:00
Indu Bhagat
540034ec40 sframe/doc: minor improvements for readability
libsframe/
	* sframe-spec.texi: Cosmetic fixes.
2023-05-25 23:44:15 -07:00
Indu Bhagat
469b6d54d3 libsframe/doc: use "stack trace" instead of "unwind" for SFrame
SFrame format is meant for generating stack traces only.

libsframe/
	* doc/sframe-spec.texi: Use "stack trace" instead of "unwind".
2023-02-02 00:47:22 -08:00
Indu Bhagat
436bcab712 libsframe/doc: fix some warnings
'make pdf' in libsframe shows some warnings, some of which (especially
the Overfull warnings) are causing undesirable effects on the rendered
output.  Few examples of the warnings:

  Underfull \hbox (badness 10000) in paragraph at lines 406--407
   @texttt pauth_

  Underfull \hbox (badness 10000) in paragraph at lines 407--410
   @textrm Specify which key is used for signing the return

  ...

  Overfull \hbox (2.0987pt too wide) in paragraph at lines 412--413
   @texttt fdetype[]|

  ...

  Overfull \hbox (28.87212pt too wide) in paragraph at lines 446--447
   @textrm SFRAME[]FDE[]TYPE[]PCMASK|

  ...

This patch adjusts column widths of the affected cells to fix a subset
of these warnings.  For the rest of the warnings, use explicit newline
command to fix them.

libsframe/
	* doc/sframe-spec.texi: Fix various underfull and overfull
	warnings.
2023-01-24 10:08:14 -08:00
Alan Modra
d87bef3a7b Update year range in copyright notice of binutils files
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2023-01-01 21:50:11 +10:30
Indu Bhagat
2440ed038a sframe: doc: update documentation for pauth key in SFrame FDE
ChangeLog:

	* libsframe/doc/sframe-spec.texi
2022-12-22 09:58:21 -08:00
Indu Bhagat
6e09ae77a1 sframe: doc: update spec for the mangled-RA bit in FRE
ChangeLog:

	* libsframe/doc/sframe-spec.texi
2022-12-16 22:02:11 -08:00
Indu Bhagat
cbff1430f8 sframe/doc: remove usage of xrefautomaticsectiontitle
xrefautomaticsectiontitle appears to be available from texinfo 5.0 or
greater.  As such, it is not worthwhile to add requirement for a minimum
necessary makeinfo version.  So remove the usage of it.

Also align node name with section title where possible.

ChangeLog:

	* libsframe/doc/sframe-spec.texi: Remove usage of
	xrefautomaticsectiontitle.
2022-11-24 10:14:08 -08:00
Indu Bhagat
c1c57352f5 doc: add SFrame spec file
ChangeLog:

	* libsframe/Makefile.am: Add info-in-builddir to
	  AUTOMAKE_OPTIONS. Include doc/local.mk.
	* libsframe/Makefile.in: Regenerated.
	* libsframe/configure: Likewise.
	* libsframe/configure.ac: Check for makeinfo and set BUILD_INFO.
	* libsframe/doc/local.mk: New file.
	* libsframe/doc/sframe-spec.texi: Likewise.
2022-11-15 15:50:05 -08:00