binutils-gdb/gdb/dwarf2
Carl Love a0eda3df5b PowerPC, fix support for printing the function return value for non-trivial values.
Currently, a non-trivial return value from a function cannot currently be
reliably determined on PowerPC.  This is due to the fact that the PowerPC
ABI uses register r3 to store the address of the buffer containing the
non-trivial return value when the function is called.  The PowerPC ABI
does not guarantee the value in register r3 is not modified in the
function.  Thus the value in r3 cannot be reliably used to obtain the
return addreses on exit from the function.

This patch adds a new gdbarch method to allow PowerPC to access the value
of r3 on entry to a function. On PowerPC, the new gdbarch method attempts
to use the DW_OP_entry_value for the DWARF entries, when exiting the
function, to determine the value of r3 on entry to the function.  This
requires the use of the -fvar-tracking compiler option to compile the
user application thus generating the DW_OP_entry_value in the binary.  The
DW_OP_entry_value entries in the binary file allows GDB to resolve the
DW_TAG_call_site entries.  This new gdbarch method is used to get the
return buffer address, in the case of a function returning a nontrivial
data type, on exit from the function.  The GDB function should_stop checks
to see if RETURN_BUF is non-zero.  By default, RETURN_BUF will be set to
zero by the new gdbarch method call for all architectures except PowerPC.
The get_return_value function will be used to obtain the return value on
all other architectures as is currently being done if RETURN_BUF is zero.
On PowerPC, the new gdbarch method will return a nonzero address in
RETURN_BUF if the value can be determined.  The value_at function uses the
return buffer address to get the return value.

This patch fixes five testcase failures in gdb.cp/non-trivial-retval.exp.
The correct function return values are now reported.

Note this patch is dependent on patch: "PowerPC, function
ppc64_sysv_abi_return_value add missing return value convention".

This patch has been tested on Power 10 and x86-64 with no regressions.
2022-11-14 16:22:37 -05:00
..
abbrev-cache.c Introduce DWARF abbrev cache 2022-04-12 09:31:16 -06:00
abbrev-cache.h Add comments to dwarf2/abbrev-cache.h 2022-04-16 13:58:34 -06:00
abbrev.c Fix method naming bug in new DWARF indexer 2022-04-22 06:40:49 -06:00
abbrev.h Statically examine abbrev properties 2022-04-12 09:31:16 -06:00
attribute.c Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
attribute.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
comp-unit-head.c internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
comp-unit-head.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
cooked-index.c [gdb/symtab] Add get/set functions for per_cu->lang/unit_type 2022-07-04 10:28:42 +02:00
cooked-index.h Fix incorrect .gdb_index with new DWARF scanner 2022-10-21 09:54:38 -06:00
cu.c gdb: remove TYPE_LENGTH 2022-09-21 11:05:21 -04:00
cu.h gdb: Fix issue with Clang CLI macros 2022-11-03 14:08:17 +01:00
die.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
dwz.c Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
dwz.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
expr.c internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
expr.h Change GDB to use frame_info_ptr 2022-10-10 11:57:10 +02:00
file-and-dir.h Add "fullname" handling to file_and_directory 2022-04-12 09:31:16 -06:00
frame-tailcall.c Change GDB to use frame_info_ptr 2022-10-10 11:57:10 +02:00
frame-tailcall.h Change GDB to use frame_info_ptr 2022-10-10 11:57:10 +02:00
frame.c gdb: remove spurious spaces after frame_info_ptr 2022-10-25 11:04:58 -04:00
frame.h gdb: remove spurious spaces after frame_info_ptr 2022-10-25 11:04:58 -04:00
index-cache.c Use gdb_bfd_ref_ptr in objfile 2022-08-03 13:26:58 -06:00
index-cache.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
index-common.c Add new overload of dwarf5_djb_hash 2022-04-12 09:31:16 -06:00
index-common.h Add new overload of dwarf5_djb_hash 2022-04-12 09:31:16 -06:00
index-write.c Fix incorrect .gdb_index with new DWARF scanner 2022-10-21 09:54:38 -06:00
index-write.h Rename write_psymtabs_to_index 2022-04-12 09:31:16 -06:00
leb.c internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
leb.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
line-header.c gdbsupport: change path_join parameter to array_view<const char *> 2022-09-21 11:36:01 -04:00
line-header.h gdb: add "id" fields to identify symtabs and subfiles 2022-07-29 20:54:49 -04:00
loc.c PowerPC, fix support for printing the function return value for non-trivial values. 2022-11-14 16:22:37 -05:00
loc.h PowerPC, fix support for printing the function return value for non-trivial values. 2022-11-14 16:22:37 -05:00
macro.c gdb: Fix issue with Clang CLI macros 2022-11-03 14:08:17 +01:00
macro.h gdb: Fix issue with Clang CLI macros 2022-11-03 14:08:17 +01:00
mapped-index.h Fix crash when creating index from index 2022-05-04 08:38:05 -06:00
public.h Always use dwarf2_initialize_objfile 2022-04-21 12:18:25 -06:00
read.c gdb: Fix issue with Clang CLI macros 2022-11-03 14:08:17 +01:00
read.h gdb: Fix issue with Clang CLI macros 2022-11-03 14:08:17 +01:00
sect-names.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
section.c Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
section.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
stringify.c Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
stringify.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
tag.h Fix .debug_names regression with new indexer 2022-04-29 13:16:44 -06:00