Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
SFrame FP and RA tracking can represent FP without RA being saved
since commit "sframe: Represent FP without RA on stack". As a result
the s390-specific error test cases for FP without RA saved on stack or
in register now do no longer trigger a warning. Rename and update them
accordingly.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe.exp: Rename s390-specific test
cases.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-err-1.s: Rename
to ...
* cfi-sframe/cfi-sframe-s390-fpra-offset-err-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-2.s: This.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-2.d: Likewise.
Update test verification pattern accordingly.
* cfi-sframe/cfi-sframe-s390-fpra-register-err-1.s: Rename
to ...
* cfi-sframe/cfi-sframe-s390-fpra-register-err-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-2.s: This.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-2.d: Likewise.
Update test verification pattern accordingly.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
If an architecture uses both SFrame RA and FP tracking SFrame assumes
that the RA offset is the 2nd offset and the FP offset is the 3rd offset
following the SFrame FRE. An architecture does not need to store both on
the stack. SFrame cannot represent a FP without RA on stack, since it
cannot distinguish whether the 2nd offset is the RA or FP offset.
Use an invalid SFrame FRE RA offset value of zero as dummy padding to
represent the FP being saved on the stack when the RA is not saved on
the stack.
include/
* sframe.h (SFRAME_FRE_RA_OFFSET_INVALID): New macro defining
the invalid RA offset value used to represent a dummy padding
offset.
gas/
* gen-sframe.c (get_fre_num_offsets): Accommodate for dummy
padding RA offset if FP without RA on stack.
(sframe_get_fre_offset_size): Likewise.
(output_sframe_row_entry): Write a dummy padding RA offset
if FP without RA needs to be represented.
libsframe/
* sframe-dump.c (dump_sframe_func_with_fres): Treat invalid RA
offsets as if they were undefined. Display them as "u*" to
distinguish them.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
GCC on s390x, when in a leaf function, can be observed to save the
frame pointer (FP) and/or return address (RA) register in a floating-
point registers (FPR) instead of on the stack. This is declared using
the following CFI directive:
.cfi_register <fp/ra-regno>, <fpr-regno>
SFrame cannot represent the FP and/or RA being saved in another
register. It does only track the CFA base register (SP/FP), CFA offset
from CFA base register, and FP and RA save area offsets from CFA.
On s390x the FP and/or RA are only saved in another FPR when in a leaf
function. That is a function that does not call any other functions.
Therefore it can ever only be the topmost function in a call chain.
During function return, if the RA would be restored into a non-default
RA register, the function would also only ever be the topmost function
on the call stack.
An unwinder by default has access to all registers of the function that
if the topmost on the call stack. Therefore no further information would
be required for those registers.
Represent the FP/RA in another register on s390, by encoding the
register number shifted by one to the left with the least-significant
bit set in the offset as follows:
offset = (regno << 1) | 1
Add s390-specific SFrame (error) test cases for FP/RA being saved in
FPRs in leaf-function.
gas/
* gen-sframe.c (s390_sframe_xlate_do_register): New s390-
specific function to represent FP/RA in another register on
s390.
(sframe_xlate_do_register): Invoke s390_sframe_xlate_do_register
on s390.
libsframe/
* sframe-dump.c (is_sframe_abi_arch_s390): New helper to test
whether ABI/arch is s390.
(dump_sframe_func_with_fres): Dump FP/RA in another register on
s390.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe.exp: Update s390-specific SFrame
(error) test cases.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-2.s: Rename
to ...
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-2.d:
Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-1.s: This. Test
case no longer triggers a warning, as SFrame can represent FP
and RA saved in registers.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-1.d: Test
case now triggers a different warning, as SFrame can represent
FP and RA saved in registers, but not FP without RA saved in
register.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
This introduces initial support to generate .sframe from CFI directives
in assembler on s390x. Due to the following SFrame limitations it is
incomplete and does not work for most real-world applications (i.e.
generation of SFrame FDE is skipped):
- SFrame FP/RA tracking assumes the register contents to be saved on
the stack (i.e. .cfi_offset). It does not support FP/RA register
contents being saved in other registers (i.e. .cfi_register). GCC
on s390x can be observed to save the FP/RA register contents in
floating-point registers, but only in leaf functions.
- SFrame assumes a static FP register number. The s390x ELF ABI [1]
does not specify any FP register number. GCC and clang on s390x
usually use register 11 as frame pointer.
GCC on s390x can also be observed to use register 14 (e.g. binutils
and glibc builds) in the stack clash protector in the funcion
prologue.
glibc on s390x contains hand-written assembler code that uses
register 12 for the frame pointer.
This s390x support is largely based on the AArch64 support from commit
b52c4ee46657 ("gas: generate .sframe from CFI directives").
SFrame ABI/arch identifier SFRAME_ABI_S390_ENDIAN_BIG is introduced
for s390 and added to the SFrame specification.
According to the s390x ELF ABI [1] the following calling conventions
are used on s390x architecture:
- Register 15 is used as stack pointer (SP). The CFA is initially
located at offset +160 from the SP.
- Register 14 is used as return address (RA).
- There is no dedicated frame pointer. GCC and LLVM currently use
register 11 as frame pointer.
The s390x ELF ABI [1] standard stack frame layout has the following
conventions:
- The return address (RA, r15) may be saved at offset -40 from the
CFA. Unlike x86 AMD64 architecture it is not necessarily saved on
the stack. Also compilers may use a non-standard stack frame layout,
such as but not limited to GCC with option -mpacked-stack.
Therefore SFrame RA tracking is used.
- The potential frame pointer (FP, r11) may be saved at offset -72
from the CFA. It is not necessarily saved on the stack and compilers
may use a non-standard stack frame layout (see above).
Therefore SFrame FP tracking is used.
Support for SFrame is only enabled for z/Architecture (s390x) with
64-bit architecture mode. It is disabled for 32-bit architecture mode
and ESA/390 (s390).
Add s390-specific SFrame test cases. As for the error test cases add
ones that use a non-default frame pointer (FP) register number and ones
that save the return address (RA) in a non-default RA register number.
[1] ELF ABI s390x Supplement:
https://github.com/IBM/s390x-abi/releases
[2] ELF ABI s390 Supplement:
https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_s390.html
https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_s390.pdf
include/
* sframe.h (SFRAME_ABI_S390_ENDIAN_BIG): Define SFrame ABI/arch
identifier for s390x. Reference s390x architecture in comments.
libsframe/
* doc/sframe-spec.texi: Document SFrame ABI/arch identifier for
s390x and reference s390x architecture.
gas/
* config/tc-s390.h: s390x support to generate .sframe from CFI
directives in assembler.
* config/tc-s390.c: Likewise.
* gen-sframe.c: Reference s390x architecture in comments.
* NEWS: Update news.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe.exp: Enable common SFrame test cases
for s390x. Add s390-specific SFrame (error) test cases.
* gas/cfi-sframe/cfi-sframe-s390-1.s: New s390-specific SFrame
test case.
* gas/cfi-sframe/cfi-sframe-s390-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-2.s: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-2.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-err-1.s: New s390-specific
SFrame error test case that uses a non-default frame-pointer
register as CFA base address.
* gas/cfi-sframe/cfi-sframe-s390-err-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-err-2.s: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-err-2.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-err-3.s: New s390-specific
SFrame error test case that uses a non-default return-address
register.
* gas/cfi-sframe/cfi-sframe-s390-err-3.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-1.s: New s390-
specific SFrame test case that saves RA and FP individually
on the stack.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-err-1.s: New s390-
specific SFRame error test case that saves FP and RA
individually, to trigger FP without RA.
* gas/cfi-sframe/cfi-sframe-s390-fpra-offset-err-1.d: Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-1.s: New
s390-specific SFrame error test case that saves FP and RA
individually in registers.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-1.d:
Likewise.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-2.s: New
s390-specific SFrame error test case that saves RA and FP
individually in registers.
* gas/cfi-sframe/cfi-sframe-s390-fpra-register-err-2.d:
Likewise.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
If an architecture uses SFrame return-address (RA) tracking it must
specify the fixed RA offset as invalid. Otherwise, if an architecture
does not use RA tracking, it must specify a valid fixed RA offset.
gas/
* gen-sframe.c: Validate SFrame RA tracking and fixed
RA offset.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
The existence of the macro SFRAME_FRE_RA_TRACKING only ensures the
existence of the macro SFRAME_CFA_RA_REG and the predicate function
sframe_ra_tracking_p. It does not indicate whether SFrame RA tracking
is actually used.
Test the return value of the SFrame RA tracking predicate function
sframe_ra_tracking_p to determine whether RA tracking is used.
This aligns the logic in functions get_fre_num_offsets and
output_sframe_row_entry to the one used in all other places.
gas/
* gen-sframe.c (get_fre_num_offsets, output_sframe_row_entry):
Test predicate to determine whether SFrame RA tracking is used.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
The stack-pointer (SP) register contents on entry can be reconstructed
from the CFA base register tracking information from the current SFrame
FRE and initial FRE from the FDE:
1. Compute CFA from the current CFA base register (SP or FP) and CFA
offset from the SFrame CFA base register tracking information from
the SFrame FRE for the current instruction address:
CFA = <current_base_reg> + <current_cfa_offset>
2. Compute SP from the current CFA and the CFA offset from the SFrame
CFA tracking information from the initial SFrame FRE of the FDE:
SP = CFA - <initial_cfa_offset>
While at it add a comment to the processing of .cfi_val_offset that the
SP can be reconstructed from the CFA base register tracking information.
gas/
* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
FDE if .cfi_register specifies SP register.
(sframe_xlate_do_val_offset): Add comment that this is likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
Do not skip SFrame FDE if .cfi_register specifies RA register without
RA tracking being actually used. Without RA tracking the register
contents can always be restored from the stack using the fixed
RA offset from CFA.
gas/
* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
FDE if .cfi_register specifies RA register without RA tracking
being used.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
CFI opcode DW_CFA_AARCH64_negate_ra_state is multiplexed with
DW_CFA_GNU_window_save. Process DW_CFA_AARCH64_negate_ra_state on
AArch64. Skip generation of SFrame FDE otherwise.
gas/
* gen-sframe.c: Skip SFrame FDE if .cfi_window_save.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
The SFrame format cannot represent the frame pointer (FP) being saved
on the stack without the return address (RA) also being saved on the
stack, if RA tracking is used.
A SFrame FDE is followed by 1-3 offsets with the following information:
Without RA tracking:
1. Offset from base pointer (SP or FP) to locate the CFA
2. Optional: Offset to CFA to restore the frame pointer (FP)
With RA tracking:
1. Offset from base pointer (SP or FP) to locate the CFA
2. Optional: Offset to CFA to restore the return address (RA)
3. Optional: Offset to CFA to restore the frame pointer (FP)
When RA tracking is used and a FDE is followed by two offsets the
SFrame format does not provide any information to distinguish whether
the second offset is the RA or FP offset. SFrame assumes the offset to
be the RA offset, which may be wrong.
Therefore skip generation of SFrame FDE information and print the
following warning, if RA tracking is used and the FP is saved on the
stack without the RA being saved as well:
skipping SFrame FDE due to FP without RA on stack
gas/
* gen-sframe.c (sframe_do_fde): Skip SFrame FDE if FP without RA
on stack, as the SFrame format cannot represent this case.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
The following generic warning message, which is printed whenever the
assembler skips generation of SFrame FDE, is not very helpful for the
user:
skipping SFrame FDE due to DWARF CFI op <name> (0x<hexval>)
Whenever possible print meaningful warning messages, when the assembler
skips generation of SFrame FDE:
- skipping SFrame FDE due to .cfi_def_cfa defining non-SP/FP register
<regno> as CFA base register
- skipping SFrame FDE due to .cfi_def_cfa_register defining non-SP/FP
register <regno> as CFA base register
- skipping SFrame FDE due to .cfi_def_cfa_offset without CFA base
register in effect
- skipping SFrame FDE due to .cfi_def_cfa_offset with non-SP/FP register
<regno> as CFA base register in effect
- skipping SFrame FDE due to .cfi_val_offset specifying {FP|RA} register
- skipping SFrame FDE due to .cfi_remember_state without SFrame FRE
state
- skipping SFrame FDE due to .cfi_register specifying {SP|FP|RA}
register
- skipping SFrame FDE due to non-default return-address register <regno>
gas/
* gen-sframe.h (SFRAME_FRE_BASE_REG_INVAL): New macro for
invalid SFrame FRE CFA base register value of -1.
* gen-sframe.c: User readable warnings if SFrame FDE is not
generated.
gas/testsuite/
* gas/cfi-sframe/common-empty-1.d: Update generic SFrame test
case to updated warning message texts.
* gas/cfi-sframe/common-empty-2.d: Likewise.
* gas/cfi-sframe/common-empty-3.d: Likewise.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
Refactor SFrame processing of CFI opcode DW_CFA_register into a separate
function. This harmonizes the CFI opcode processing.
While at it reword the comment on CFI opcodes that are not processed.
This is a purely mechanical change.
gas/
* gen-sframe.c (sframe_do_cfi_insn, sframe_xlate_do_register):
Refactor SFrame CFI opcode DW_CFA_register processing.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
Print a warning message if SFrame FDE is skipped due to a non-default
DWARF return column (i.e. return address (RA) register number). This
may be caused by the use of CFI directive .cfi_return_column with a
non-default return address (RA) register number in the processed
assembler source code.
Warning: skipping SFrame FDE due to non-default DWARF return column
gas/
* gen-sframe.c: Warn if SFrame FDE is skipped due to non-default
DWARF return column.
gas/testsuite/
* gas/cfi-sframe/common-empty-3.d: Update test case to expect
for new warning message when SFrame FDE is skipped due to
a non-default DWARF return column.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
Do not generate SFrame FDE if DWARF CFI directives .cfi_def_cfa or
.cfi_def_cfa_register specify a CFA base register number other than
the architecture-specific stack-pointer (SP) or frame-pointer (FP)
register numbers.
This also causes the assembler to print a warning message, so that
skipping of the SFrame FDE does not occur silently.
Update the generic ld SFrame test case to be architecture independent.
Do not use CFI directive .cfi_def_cfa, as the specified CFA base
register number is not a valid SP/FP register number on all
architectures. An invalid SP/FP register number will now cause the
assembler to print a warning message and skip SFrame FDE generation.
Remove the offending CFI directive, that cannot be coded architecture-
independent, as the test case requires SFrame information to be
generated. This was reported by the Linaro-TCWG-CI for AArch64.
gas/
* gen-sframe.c: Skip SFrame generation if CFI specifies
non-FP/SP base register.
ld/testsuite/
* ld-sframe/discard.s: Update generic SFrame test case to be
architecture independent.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
SFrame generation prints the DWARF call frame instruction opcode in
hexadecimal. Leverage get_DW_CFA_name to additionally print the
DWARF call frame instruction name in human readable form, while also
respecting fake CFI types. Use "(unknown)", if the DWARF call frame
instruction name is not known.
This changes the following assembler SFrame generation warning message
as follows:
Old:
Warning: skipping SFrame FDE due to DWARF CFI op 0x<hexnum>
New:
Warning: skipping SFrame FDE due to DWARF CFI op <name> (0x<hexnum>)
gas/
* gen-sframe.c (sframe_get_cfi_name): New function to get the
DWARF call frame instruction name for a DWARF call frame
instruction opcode.
(sframe_do_cfi_insn): Use sframe_get_cfi_name to print the
DWARF call frame instruction name for the DWARF call frame
instruction opcode in the warning message.
gas/testsuite/
* gas/cfi-sframe/common-empty-1.d: Update expected SFrame
warning message text for DWARF call frame insn name.
* gas/cfi-sframe/common-empty-2.d: Likewise.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
For the SFrame FRE frame-pointer (FP) offset from CFA a 'u' is displayed
if it is unavailable.
For the SFrame FRE return-address (RA) offset from CFA a 'u' was
displayed if the ABI uses a fixed RA offset from CFA. By chance a
'u' was also displayed if the RA offset is unavailable, as the string
buffer was not initialized after formatting the FP offset. Note that it
could not occur that the FP offset was erroneously displayed as RA
offset, as the SFrame format cannot have a FRE with FP offset without
RA offset.
For the FRE RA offset display 'f' if the ABI uses a fixed RA offset
from CFA. Display a 'u' if it is unavailable.
libsframe/
* sframe-dump.c: Display SFrame fixed RA offset as 'f' in dump.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe-common-4.d: Test for RA displayed
either as 'u' (if RA tracking) or as 'f' (fixed RA offset if no
RA tracking).
* gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
* gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for RA displayed
as 'f' (fixed RA offset), as x86-64 does not use RA tracking.
* gas/scfi/x86_64/scfi-cfi-sections-1.d: Likewise.
* gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise.
ld/testsuite/
* ld-x86-64/sframe-plt-1.d: Test for RA displayed as 'f' (fixed
RA offset), as x86-64 does not use RA tracking.
* ld-x86-64/sframe-simple-1.d: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
The SFrame format allows architectures to specify fixed offsets from the
CFA, if any, from which the frame pointer (FP) and/or return address
(RA) may be recovered. These offsets are stored in the SFrame header.
For instance the SFrame generation in the assembler for x86 AMD64
specifies a fixed offset from the CFA, from which the return address
(RA) may be recovered.
When dumping the SFrame header, for instance in readelf/objdump with
option --sframe, do also dump the specified fixed offsets from the CFA,
if any, from which the frame pointer (FP) and return address (RA) may
be recovered.
Update the common SFrame test case verification patterns to allow for
the optional dumping of the CFA fixed FP/RA offsets. Update the x86-
specific SFrame and SCFI test case verification patterns to require a
CFA fixed RA offset of -8.
libsframe/
* sframe-dump.c: Dump CFA fixed FP and RA offsets.
gas/testsuite/
* gas/cfi-sframe/cfi-sframe-common-1.d: Test for optional fixed
FP and RA offsets.
* gas/cfi-sframe/cfi-sframe-common-2.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-3.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-4.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
* gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for fixed
RA offset.
* gas/cfi-sframe/common-empty-1.d: Test for optional fixed
FP and RA offsets.
* gas/cfi-sframe/common-empty-2.d: Likewise.
* gas/cfi-sframe/common-empty-3.d: Likewise.
* gas/scfi/x86_64/scfi-cfi-sections-1.d: Test for SFrame fixed
RA offset.
* gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise.
ld/testsuite/
* ld-x86-64/sframe-plt-1.d: Test for SFrame fixed RA offset.
* ld-x86-64/sframe-simple-1.d: Likewise.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
Explicitly mention "SFrame" in the descriptions for the architecture-
specific SFrame configuration macros, variables, and functions.
Use the term "frame pointer" (FP) instead of "base pointer". This aligns
with the terminology used in the SFrame specification. Additionally it
helps not to confuse "base-pointer register" with the term "BASE_REG"
used in the specification to denote either the SP or FP register.
Specify what the SFRAME_CFA_*_REG register numbers are used for:
- SP (stack pointer): CFA tracking
- FP (frame pointer): CFA and FP tracking
- RA (return address): RA tracking
Align the descriptions for definitions in the source files to the
declarations in the header files.
gas/
* config/tc-aarch64.h: Enhance architecture-specific SFrame
configuration descriptions.
* config/tc-aarch64.c: Likewise.
* config/tc-i386.h: Likewise.
* config/tc-i386.c: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
gas/
* config/tc-i386.c: Remove unused SFrame CFI RA register
variable.
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
|
|
and fixing some formatting issues.
ChangeLog:
* include/sframe-stacktrace-api.h
* sframe-stacktrace.c
* sframe-state.c
* sframe-state.h
|
|
ChangeLog:
* sframe-state.c
* sframe-state.h
|
|
Use this function consistently and remove unnecessary API
sframest_update_sfinfo.
ChangeLog:
* sframe-stacktrace.c
* sframe-state.c
* sframe-state.h
|
|
ChangeLog:
* sframe-stacktrace.c
* sframe-state.c
* sframe-state.h
|
|
Some struct names and member names were long and unintuitive. Reduce
the technical debt and make the code hopefully easier to maintain.
libsframe/testsuite/
* libsframe.stacktrace/libsframest/sframe-stacktrace.c
* libsframe.stacktrace/libsframest/sframe-state.c
* libsframe.stacktrace/libsframest/sframe-state.h
|
|
libsframe/testsuite/
* libsframe.stacktrace/libsframest/sframe-stacktrace.c
* libsframe.stacktrace/libsframest/sframe-state.c
|
|
libsframe/testsuite/
* libsframe.stacktrace/libsframest/sframe-backtrace.c
|
|
ChangeLog:
* libsframe/testsuite/libsframe.stacktrace/libsframest
/sframe-stacktrace.c (sframe_unwind): Remove unnecessary guards
and arch-specific handling.
|
|
Fix some code formatting nits.
libsframe/testsuite/
* libsframe.stacktrace/libsframest/sframe-stacktrace-err.c:
* libsframe.stacktrace/libsframest/sframe-stacktrace.c:
* libsframe.stacktrace/libsframest/sframe-state.c:
* libsframe.stacktrace/libsframest/sframe-state.h:
* libsframe.stacktrace/stacktrace-inline-2.c:
|
|
instead of host's as and ld. Also disable libsframest build if cross
compiling. The testsuite will consequently also be skipped.
Override the check-am make target and first execute setup.sh to bring in
the as-new / ld-new and use -B<path> to ensure these are picked up for
building:
- libsframest
- libsframe.stacktrace testsuite
Remove the configure time variable HAVE_SFRAME_AS as it is now
unnecessary.
TBD:
- Get review on whether the whole setup.sh way of doing this is OK.
But it seems there is no other way ?
- Check the portability of the setup.sh script.
ChangeLog:
* libsframe/Makefile.am: Override check-am to first run setup.sh
before invoking make. This ensures libsframest is built with
the newly setup tmpdir/libsframe.
* libsframe/Makefile.in: Regenerate.
* libsframe/acinclude.m4: Delete.
* libsframe/aclocal.m4: Remove include for acinclude.m4.
* libsframe/configure: Regenerate.
* libsframe/configure.ac: Remove HAVE_SFRAME_AS. Add a new
AM_CONDITIONAL for CROSS_COMPILE.
* libsframe/setup.sh: New file.
* libsframe/testsuite/config/default.exp: Remove the creation
and setup of tmpdir/lisframe.
* libsframe/testsuite/lib/sframe-lib.exp: Use -B<path> to use
the as/ld from build tree.
* libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk:
Use -B<path> and use the as/ld from build tree.
* libsframe/testsuite/libsframe.stacktrace/stacktrace.exp: Skip
testing if cross build.
|
|
Add a configure time check for dl_iterate_phdr and run
libsframe.stacktrace testsuite using libsframest. libsframest is the
library for stack tracing using the SFrame stack trace format.
libsframest is not installed anymore but used in the testsuite only.
TBD:
- More renamings are in order.
- Cleanup the .exp files.
- Disable (libsframest based) stack tracer tests in a cross build
|
|
Keep a testcase with an explicit -O2 for testing purposes.
|
|
With -O2 and above, the compiler performs a sibling call optimization as
main () and it's callee have compatible stack usage. As for generating
stack traces though, there is nothing that any stack trace or unwind
format can do here. Use -fno-optimize-sibling-calls to at least ensure
the testcase checkes for the complete stack trace.
ChangeLog:
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk:
Use -fno-optimize-sibling-calls.
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk:
Likewise.
|
|
ChangeLog:
* libsframe/sframe-backtrace-regs.h: New file.
* libsframe/sframe-backtrace.c: Use the new abstractions.
|
|
[Changes in V4]
- Addressed Mike's review comments.
- Be careful with the use of # and dnl in configure.ac
- Add AC_CANONICAL_TARGET as we check for target.
- Remove the LC_ALL=C bits.
- Minor code fixups in the testcases
- Removed unnecessary unistd.h.
- use ATTRIBUTE_NOCLONE consistently.
- Other minor cleanups.
[End of changes in V4]
[Changes in V3]
- Added two new tests with attributes -f(no-)omit-frame-pointer.
- Minor adjustments due to buildsystem changes in libsframe.
[End of changes in V3]
[Changes in V2]
- minor changes in filenames in the testsuite.
[End of changes in V2]
Add tests for backtracing using SFrame section.
ChangeLog:
* libsframe/Makefile.in: Regenerated.
* libsframe/configure: Regenerated.
* libsframe/configure.ac: Check for cross compilation.
* libsframe/testsuite/Makefile.in: Regenerated.
* libsframe/testsuite/config/default.exp: Load
sframe-lib.exp.
* libsframe/testsuite/libsframe.decode/Makefile.in:
Regenerated.
* libsframe/testsuite/libsframe.encode/Makefile.in:
Regenerated.
* libsframe/testsuite/lib/sframe-lib.exp: New file. Add
procedures for handling unwinder tests.
* libsframe/testsuite/libsframe.unwind/backtrace.c: New test.
* libsframe/testsuite/libsframe.unwind/backtrace.lk: New test.
* libsframe/testsuite/libsframe.unwind/inline-cmds.c: New test.
* libsframe/testsuite/libsframe.unwind/inline-cmds.lk: New test.
* libsframe/testsuite/libsframe.unwind/inline.c: New test.
* libsframe/testsuite/libsframe.unwind/inline.lk: New test.
* libsframe/testsuite/libsframe.unwind/solib-lib1.c: New test.
* libsframe/testsuite/libsframe.unwind/solib-lib2.c: New test.
* libsframe/testsuite/libsframe.unwind/solib-main.c: New test.
* libsframe/testsuite/libsframe.unwind/solib-main.d: New test.
* libsframe/testsuite/libsframe.unwind/solib.exp: New file.
* libsframe/testsuite/libsframe.unwind/solib-lib1.h: New test.
* libsframe/testsuite/libsframe.unwind/solib-lib2.h: New test.
* libsframe/testsuite/libsframe.unwind/tailcall.c: New test.
* libsframe/testsuite/libsframe.unwind/tailcall.lk: New test.
* libsframe/testsuite/libsframe.unwind/ttest.c: New test.
* libsframe/testsuite/libsframe.unwind/ttest.lk: New test.
* libsframe/testsuite/libsframe.unwind/unwind.exp: New file.
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c:
Likewise.
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk:
Likewise.
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c:
Likewise.
* libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk:
Likewise.
|
|
[Changes in V4]
- Renamed ESFRAME_* enum error code names to SFRAME_ERR_*.
- Addressed review comments by Mike.
- Use AC_CACHE_CHECK macro in sframe.m4
- Delete config/sframe.m4. Add into libsframe/acinclude.m4.
- Code fixups.
[End of changes in V4]
[Changes in V3]
- Use the updated APIs from libsframe.
- Use sframe_decoder_get_fixed_ra_offset on AMD64 instead of magic
number -8.
[End of changes in V3]
[Changes in V2]
- Minor formatting fixes.
[End of changes in V2]
A simple unwinder based on SFrame format.
The unwinder is made available via libsframebt library.
Buildsystem changes have been made to build libsframebt only when
--gsframe support is available in the assembler. These buildsystem
changes are necessary because the SFrame based unwinder the SFrame
unwind info for itself to work.
include/ChangeLog:
* sframe-backtrace-api.h: New file.
ChangeLog:
* libsframe/acinclude.m4: New file.
* libsframe/Makefile.am: Build backtrace functionality in its
own library. Install libsframebt conditionally.
* libsframe/Makefile.in: Regenerate.
* libsframe/aclocal.m4: Regenerate.
* libsframe/configure: Regenerate.
* libsframe/configure.ac: Check if gas supports --gsframe
command line option.
* libsframe/sframe-backtrace-err.c: New file.
* libsframe/sframe-backtrace.c: New file.
|
|
In certain cases we were calculating the jump displacement incorrectly
when deciding whether to relax a branch. This meant for some branches,
such as a very long backwards conditional branch, relaxation was not
done when it should have been. The result was to error later, because
the actual jump displacement was too large to fit in the original
instruction.
This patch fixes up the displacement calculation so that those branches
are correctly relaxed and no longer result in an error. In addition, it
changes md_convert_frag to install fixups for the JAL instructions in
the resulting relaxations rather than encoding the displacement value
directly.
gas/
* config/tc-bpf.c (relaxed_branch_length): Correct displacement
calculation when relaxing.
(md_convert_frag): Likewise. Install fixups for JAL
instructions resulting from relaxation.
* testsuite/gas/bpf/jump-relax-ja-be.d: Correct and expand test.
* testsuite/gas/bpf/jump-relax-ja.d: Likewise.
* testsuite/gas/bpf/jump-relax-ja.s: Likewise.
* testsuite/gas/bpf/jump-relax-jump-be.d: Likewise.
* testsuite/gas/bpf/jump-relax-jump.d: Likewise.
* testsuite/gas/bpf/jump-relax-jump.s: Likewise.
|
|
Add type annotations to ada-unicode.py, just enough to make pyright
happy:
$ pyright --version
pyright 1.1.359
$ pyright ada-unicode.py
0 errors, 0 warnings, 0 informations
Introduce a `Range` class instead of using separate variables and
tuples, to make the code and type annotations a bit cleaner.
When running ada-unicode.py, I get a diff for ada-casefold.h, but I get
the same diff before and after this patch, so that is a separate issue.
Change-Id: I0d8975a57f9fb115703178ae197dc6b6b8b4eb7a
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Most files including gdbcmd.h currently rely on it to access things
actually declared in cli/cli-cmds.h (setlist, showlist, etc). To make
things easy, replace all includes of gdbcmd.h with includes of
cli/cli-cmds.h. This might lead to some unused includes of
cli/cli-cmds.h, but it's harmless, and much faster than going through
the 170 or so files by hand.
Change-Id: I11f884d4d616c12c05f395c98bbc2892950fb00f
Approved-By: Tom Tromey <tom@tromey.com>
|
|
They are defined in cli/cli-style.c.
Change-Id: Ic478a3985ff0fd773bd7ba85bb144c6e914d0be6
Approved-By: Tom Tromey <tom@tromey.com>
|
|
There is no corresponding definition for print_command_line.
There is already a declaration for print_command_lines in
cli/cli-script.h (the implementation is in cli/cli-script.c).
Change-Id: Ic9e67ed04703306d614383ead14e2b2b059b2a8e
Approved-By: Tom Tromey <tom@tromey.com>
|
|
These functions are implemented in top.c, move their declarations to
top.h.
Change-Id: I8893ef91d955156a6530734fefe8002d78c3e5fc
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Gas should not emit ADD/SUB relocation pairs for label differences
if they are in the same section without code flag even relax enabled.
Because the real value is not be affected by relaxation and it can be
compute out in assembly stage. Thus, correct the `TC_FORCE_RELOCATION
_SUB_SAME` and the label differences in same section without code
flag can be resolved in fixup_segment().
|
|
Absolute address symbols cannot be used with -shared.
We output more information to the user than just BFD_ASSETR.
|
|
When scanning relocations and determining whether TLS type transition is
possible, it will try to obtain the symbol got type. If the symbol got
type record has not yet been allocated space and initialized, it will
cause ld to crash. So when uninitialized, the symbol is set to GOT_UNKNOWN.
|
|
|
|
Factor the test for libc debug info out of gdb.base/relativedebug.exp to
a new procedure.
Also, change the "info sharedlibrary" test to explicitly detect when
libc has debug info.
Approved-by: Kevin Buettner <kevinb@redhat.com>
|
|
The 'PacketSize' attribute of the qSupported packet was
documented to be the maximum size of the packet including
the frame and checksum bytes, however this is not how it
was treated in the code. In reality, PacketSize is the
maximum size of the data in the RSP packets, not including
the framing or checksum bytes.
For instance, GDB's remote.c treats it as the maximum
number of data bytes. See remote_read_bytes_1, where the
size of the request is capped at PacketSize/2 (for
hex-encoding).
Also see gdbserver's server.cc, where the internal buffer
is sized as PBUFSIZ and PBUFSIZ-1 is used as PacketSize.
In gdbserver's case, the buffer is not used for any of the
framing or checksum characters. (I am not certain where the -1
comes from. I think it comes from back when there were no
binary packets, so packets were treated as strings with
null terminators).
It also seems like gdbservers in the wild treat it in
this way:
Embocosm doc:
https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html#id3078000
A quick glance over openocd's gdb_server.c gdb_put_packet_inner()
function shows that the internal buffer also excludes the framing
and checksum.
Likewise, qEmu's gdbstub.c allocates PacketSize bytes for
the internal packet contents, and PacketSize+4 for the
full frame.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Pedro Alves <pedro@palves.net>
|
|
Consider the following test-case:
...
$ cat hello.c
int main()
{
printf("hello ");
#include "world.inc"
$ cat world.inc
printf("world\n");
return 0;
}
$ gcc -g hello.c
...
The line table for the compilation unit, consisting just of
function main, is translated into these two gdb line tables, one for hello.c
and one for world.inc:
...
compunit_symtab: hello.c
symtab: hello.c
INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PROLOGUE-END EPILOGUE-BEGIN
0 3 0x400557 0x400557 Y
1 4 0x40055b 0x40055b Y
2 END 0x40056a 0x40056a Y
compunit_symtab: hello.c
symtab: world.inc
INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PROLOGUE-END EPILOGUE-BEGIN
0 1 0x40056a 0x40056a Y
1 2 0x400574 0x400574 Y
2 3 0x400579 0x400579 Y
3 END 0x40057b 0x40057b Y
...
The epilogue of main starts at 0x400579:
...
400579: 5d pop %rbp
40057a: c3 ret
...
Now, say we have an epilogue_begin marker in the line table at 0x400579.
We won't find it using find_epilogue_using_linetable, because it does:
...
const struct symtab_and_line sal = find_pc_line (start_pc, 0);
...
which gets us the line table for hello.c.
Fix this by using "find_pc_line (end_pc - 1, 0)" instead.
Tested on x86_64-linux.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
PR symtab/31622
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31622
|
|
An out of bounds array access in find_epilogue_using_linetable causes random
test failures like these:
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $fba_value == $fn_fba
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: check frame-id matches
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: bt 2
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: up
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $sp_value == $::main_sp
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: $fba_value == $::main_fba
FAIL: gdb.base/unwind-on-each-insn-amd64.exp: foo: instruction 6: [string equal $fid $::main_fid]
Here the read happens below the first element of the line
table, and the test failure depends on the value that is
read from there.
It also happens that std::lower_bound returns a pointer exactly at the upper
bound of the line table, also here the read value is undefined, that happens
in this test:
FAIL: gdb.dwarf2/dw2-epilogue-begin.exp: confirm watchpoint doesn't trigger
Fixes: 528b729be1a2 ("gdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table")
Co-Authored-By: Tom de Vries <tdevries@suse.de>
PR symtab/31268
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31268
|