This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 6/8] DWARF-5: call sites
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Victor Leschuk <vleschuk at accesssoftek dot com>
- Date: Sun, 12 Feb 2017 21:23:29 +0100
- Subject: [PATCH 6/8] DWARF-5: call sites
- Authentication-results: sourceware.org; auth=none
- References: <148693097396.9024.2288256732840761882.stgit@host1.jankratochvil.net>
Hi,
this patch updates all call sites related DWARF-5 renames.
Jan
gdb/ChangeLog
2017-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* block.c (call_site_for_pc): Rename DW_OP_GNU_*, DW_TAG_GNU_* and
DW_AT_GNU_*.
* common/common-exceptions.h (enum errors): Likewise.
* dwarf2-frame.c (class dwarf_expr_executor): Likewise.
* dwarf2expr.c (dwarf_block_to_dwarf_reg)
(dwarf_expr_context::execute_stack_op): Likewise.
* dwarf2expr.h (struct dwarf_expr_context, struct dwarf_expr_piece):
Likewise.
* dwarf2loc.c (dwarf_evaluate_loc_desc::get_base_type)
(dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value)
(show_entry_values_debug, call_site_to_target_addr)
(func_addr_to_tail_call_list, func_verify_no_selftailcall)
(dwarf_expr_reg_to_entry_parameter, dwarf_entry_parameter_to_value)
(entry_data_value_free_closure, value_of_dwarf_reg_entry)
(value_of_dwarf_block_entry, indirect_pieced_value)
(symbol_needs_eval_context::push_dwarf_reg_entry_value):
(disassemble_dwarf_expression): Likewise.
* dwarf2read.c (process_die, inherit_abstract_dies)
(read_call_site_scope): Likewise.
* gdbtypes.h (struct func_type, struct call_site_parameter)
(struct call_site): Likewise.
* stack.c (read_frame_arg): Likewise.
* std-operator.def (OP_VAR_ENTRY_VALUE): Likewise.
gdb/doc/ChangeLog
2017-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Print Settings, Tail Call Frames): Rename DW_OP_GNU_*,
DW_TAG_GNU_* and DW_AT_GNU_*.
gdb/testsuite/ChangeLog
2017-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-entry-value-param.exp <COMPILE>: Use -gdwarf-5.
* gdb.arch/amd64-entry-value.exp: Rename DW_OP_GNU_*, DW_TAG_GNU_* and
DW_AT_GNU_*.
---
gdb/block.c | 4 -
gdb/common/common-exceptions.h | 2
gdb/doc/gdb.texinfo | 10 +-
gdb/dwarf2-frame.c | 2
gdb/dwarf2expr.c | 23 +++--
gdb/dwarf2expr.h | 10 +-
gdb/dwarf2loc.c | 59 +++++++------
gdb/dwarf2read.c | 93 +++++++++++++-------
gdb/gdbtypes.h | 22 ++---
gdb/stack.c | 5 -
gdb/std-operator.def | 2
gdb/testsuite/gdb.arch/amd64-entry-value-param.exp | 2
gdb/testsuite/gdb.arch/amd64-entry-value.exp | 6 +
13 files changed, 139 insertions(+), 101 deletions(-)
diff --git a/gdb/block.c b/gdb/block.c
index 670a49d..2f44460 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -239,8 +239,8 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
/* DW_TAG_gnu_call_site will be missing just if GCC could not determine
the call target. */
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_GNU_entry_value resolving cannot find "
- "DW_TAG_GNU_call_site %s in %s"),
+ _("DW_OP_entry_value resolving cannot find "
+ "DW_TAG_call_site %s in %s"),
paddress (gdbarch, pc),
(msym.minsym == NULL ? "???"
: MSYMBOL_PRINT_NAME (msym.minsym)));
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index c4a2f59..49f309f 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -87,7 +87,7 @@ enum errors {
means the register was not saved in the frame. */
OPTIMIZED_OUT_ERROR,
- /* DW_OP_GNU_entry_value resolving failed. */
+ /* DW_OP_entry_value resolving failed. */
NO_ENTRY_VALUE_ERROR,
/* Target throwing an error has been closed. Current command should be
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 35804c1..f769d81 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -9857,7 +9857,7 @@ this feature will behave in the @code{default} setting the same way as with the
@code{no} setting.
This functionality is currently supported only by DWARF 2 debugging format and
-the compiler has to produce @samp{DW_TAG_GNU_call_site} tags. With
+the compiler has to produce @samp{DW_TAG_call_site} tags. With
@value{NGCC}, you need to specify @option{-O -g} during compilation, to get
this information.
@@ -12025,7 +12025,7 @@ some cases @value{GDBN} can determine that @code{C} was tail-called from
return address set up as if @code{B} called @code{C} normally.
This functionality is currently supported only by DWARF 2 debugging format and
-the compiler has to produce @samp{DW_TAG_GNU_call_site} tags. With
+the compiler has to produce @samp{DW_TAG_call_site} tags. With
@value{NGCC}, you need to specify @option{-O -g} during compilation, to get
this information.
@@ -12078,8 +12078,8 @@ static void __attribute__((noinline, noclone)) a (void) @{ x++; @}
static void __attribute__((noinline, noclone)) c (void) @{ a (); @}
int main (void) @{ x (); return 0; @}
-Breakpoint 1, DW_OP_GNU_entry_value resolving cannot find
-DW_TAG_GNU_call_site 0x40039a in main
+Breakpoint 1, DW_OP_entry_value resolving cannot find
+DW_TAG_call_site 0x40039a in main
a () at t.c:3
3 static void __attribute__((noinline, noclone)) a (void) @{ x++; @}
(gdb) bt
@@ -12155,7 +12155,7 @@ int main (void) @{ a (5); return 0; @}
(gdb) bt
#0 c (i=i@@entry=0) at t.c:2
-#1 0x0000000000400428 in a (DW_OP_GNU_entry_value resolving has found
+#1 0x0000000000400428 in a (DW_OP_entry_value resolving has found
function "a" at 0x400420 can call itself via tail calls
i=<optimized out>) at t.c:6
#2 0x000000000040036e in main () at t.c:7
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index c5ad0dd..f8dd1df 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -361,7 +361,7 @@ class dwarf_expr_executor : public dwarf_expr_context
union call_site_parameter_u kind_u,
int deref_size) OVERRIDE
{
- invalid ("DW_OP_GNU_entry_value");
+ invalid ("DW_OP_entry_value");
}
CORE_ADDR get_object_address () OVERRIDE
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 6ba4831..fbbb6c4 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -423,7 +423,7 @@ dwarf_block_to_dwarf_reg (const gdb_byte *buf, const gdb_byte *buf_end)
return *buf - DW_OP_reg0;
}
- if (*buf == DW_OP_GNU_regval_type)
+ if (*buf == DW_OP_regval_type || *buf == DW_OP_GNU_regval_type)
{
buf++;
buf = gdb_read_uleb128 (buf, buf_end, &dwarf_reg);
@@ -805,12 +805,13 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_stack_value");
goto no_push;
+ case DW_OP_implicit_pointer:
case DW_OP_GNU_implicit_pointer:
{
int64_t len;
if (this->ref_addr_size == -1)
- error (_("DWARF-2 expression error: DW_OP_GNU_implicit_pointer "
+ error (_("DWARF-2 expression error: DW_OP_implicit_pointer "
"is not allowed in frame context"));
/* The referred-to DIE of sect_offset kind. */
@@ -825,7 +826,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
this->location = DWARF_VALUE_IMPLICIT_POINTER;
dwarf_expr_require_composition (op_ptr, op_end,
- "DW_OP_GNU_implicit_pointer");
+ "DW_OP_implicit_pointer");
}
break;
@@ -963,6 +964,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_deref:
case DW_OP_deref_size:
+ case DW_OP_deref_type:
case DW_OP_GNU_deref_type:
{
int addr_size = (op == DW_OP_deref ? this->addr_size : *op_ptr++);
@@ -972,7 +974,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
pop ();
- if (op == DW_OP_GNU_deref_type)
+ if (op == DW_OP_deref_type || op == DW_OP_GNU_deref_type)
{
cu_offset type_die;
@@ -1299,6 +1301,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
}
goto no_push;
+ case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
{
uint64_t len;
@@ -1307,7 +1310,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
op_ptr = safe_read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end)
- error (_("DW_OP_GNU_entry_value: too few bytes available."));
+ error (_("DW_OP_entry_value: too few bytes available."));
kind_u.dwarf_reg = dwarf_block_to_dwarf_reg (op_ptr, op_ptr + len);
if (kind_u.dwarf_reg != -1)
@@ -1332,7 +1335,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
goto no_push;
}
- error (_("DWARF-2 expression error: DW_OP_GNU_entry_value is "
+ error (_("DWARF-2 expression error: DW_OP_entry_value is "
"supported only for single DW_OP_reg* "
"or for DW_OP_breg*(0)+DW_OP_deref*"));
}
@@ -1350,6 +1353,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
}
goto no_push;
+ case DW_OP_const_type:
case DW_OP_GNU_const_type:
{
cu_offset type_die;
@@ -1368,6 +1372,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
}
break;
+ case DW_OP_regval_type:
case DW_OP_GNU_regval_type:
{
cu_offset type_die;
@@ -1382,7 +1387,9 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
}
break;
+ case DW_OP_convert:
case DW_OP_GNU_convert:
+ case DW_OP_reinterpret:
case DW_OP_GNU_reinterpret:
{
cu_offset type_die;
@@ -1399,7 +1406,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = fetch (0);
pop ();
- if (op == DW_OP_GNU_convert)
+ if (op == DW_OP_convert || op == DW_OP_GNU_convert)
result_val = value_cast (type, result_val);
else if (type == value_type (result_val))
{
@@ -1407,7 +1414,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
}
else if (TYPE_LENGTH (type)
!= TYPE_LENGTH (value_type (result_val)))
- error (_("DW_OP_GNU_reinterpret has wrong size"));
+ error (_("DW_OP_reinterpret has wrong size"));
else
result_val
= value_from_contents (type,
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index 017488c..2df310f 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -164,7 +164,7 @@ struct dwarf_expr_context
/* Return the PC for the frame. */
virtual CORE_ADDR get_frame_pc ()
{
- error (_("%s is invalid in this context"), "DW_OP_GNU_implicit_pointer");
+ error (_("%s is invalid in this context"), "DW_OP_implicit_pointer");
}
/* Return the thread-local storage address for
@@ -187,10 +187,10 @@ struct dwarf_expr_context
return builtin_type (this->gdbarch)->builtin_int;
}
- /* Push on DWARF stack an entry evaluated for DW_TAG_GNU_call_site's
+ /* Push on DWARF stack an entry evaluated for DW_TAG_call_site's
parameter matching KIND and KIND_U at the caller of specified BATON.
- If DEREF_SIZE is not -1 then use DW_AT_GNU_call_site_data_value instead of
- DW_AT_GNU_call_site_value. */
+ If DEREF_SIZE is not -1 then use DW_AT_call_data_value instead of
+ DW_AT_call_value. */
virtual void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
union call_site_parameter_u kind_u,
int deref_size) = 0;
@@ -248,7 +248,7 @@ struct dwarf_expr_piece
/* Used for DWARF_VALUE_IMPLICIT_POINTER. */
struct
{
- /* The referent DIE from DW_OP_GNU_implicit_pointer. */
+ /* The referent DIE from DW_OP_implicit_pointer. */
sect_offset die;
/* The byte offset into the resulting data. */
LONGEST offset;
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 39a067d..2c9051d 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -589,9 +589,9 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
{
struct type *result = dwarf2_get_die_type (die_offset, per_cu);
if (result == NULL)
- error (_("Could not find type for DW_OP_GNU_const_type"));
+ error (_("Could not find type for DW_OP_const_type"));
if (size != 0 && TYPE_LENGTH (result) != size)
- error (_("DW_OP_GNU_const_type has different sizes for type and data"));
+ error (_("DW_OP_const_type has different sizes for type and data"));
return result;
}
@@ -641,7 +641,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
/* DEREF_SIZE size is not verified here. */
if (data_src == NULL)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("Cannot resolve DW_AT_GNU_call_site_data_value"));
+ _("Cannot resolve DW_AT_call_data_value"));
scoped_restore save_frame = make_scoped_restore (&this->frame,
caller_frame);
@@ -733,7 +733,7 @@ show_entry_values_debug (struct ui_file *file, int from_tty,
value);
}
-/* Find DW_TAG_GNU_call_site's DW_AT_GNU_call_site_target address.
+/* Find DW_TAG_call_site's DW_AT_call_target address.
CALLER_FRAME (for registers) can be NULL if it is not known. This function
always returns valid address or it throws NO_ENTRY_VALUE_ERROR. */
@@ -758,8 +758,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_AT_GNU_call_site_target is not specified "
- "at %s in %s"),
+ _("DW_AT_call_target is not specified at %s in %s"),
paddress (call_site_gdbarch, call_site->pc),
(msym.minsym == NULL ? "???"
: MSYMBOL_PRINT_NAME (msym.minsym)));
@@ -771,7 +770,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_AT_GNU_call_site_target DWARF block resolving "
+ _("DW_AT_call_target DWARF block resolving "
"requires known frame which is currently not "
"available at %s in %s"),
paddress (call_site_gdbarch, call_site->pc),
@@ -784,8 +783,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
val = dwarf2_evaluate_loc_desc (caller_core_addr_type, caller_frame,
dwarf_block->data, dwarf_block->size,
dwarf_block->per_cu);
- /* DW_AT_GNU_call_site_target is a DWARF expression, not a DWARF
- location. */
+ /* DW_AT_call_target is a DWARF expression, not a DWARF location. */
if (VALUE_LVAL (val) == lval_memory)
return value_address (val);
else
@@ -835,7 +833,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
if (sym == NULL || BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) != addr)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_TAG_GNU_call_site resolving failed to find function "
+ _("DW_TAG_call_site resolving failed to find function "
"name for address %s"),
paddress (gdbarch, addr));
@@ -893,7 +891,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
msym = lookup_minimal_symbol_by_pc (verify_addr);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_GNU_entry_value resolving has found "
+ _("DW_OP_entry_value resolving has found "
"function \"%s\" at %s can call itself via tail "
"calls"),
(msym.minsym == NULL ? "???"
@@ -1235,7 +1233,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
struct gdbarch *caller_gdbarch = frame_unwind_arch (frame);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_GNU_entry_value resolving callee gdbarch %s "
+ _("DW_OP_entry_value resolving callee gdbarch %s "
"(of %s (%s)) does not match caller gdbarch %s"),
gdbarch_bfd_arch_info (gdbarch)->printable_name,
paddress (gdbarch, func_addr),
@@ -1249,7 +1247,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
struct bound_minimal_symbol msym
= lookup_minimal_symbol_by_pc (func_addr);
- throw_error (NO_ENTRY_VALUE_ERROR, _("DW_OP_GNU_entry_value resolving "
+ throw_error (NO_ENTRY_VALUE_ERROR, _("DW_OP_entry_value resolving "
"requires caller of %s (%s)"),
paddress (gdbarch, func_addr),
(msym.minsym == NULL ? "???"
@@ -1266,7 +1264,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
target_msym = lookup_minimal_symbol_by_pc (target_addr).minsym;
func_msym = lookup_minimal_symbol_by_pc (func_addr).minsym;
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_GNU_entry_value resolving expects callee %s at %s "
+ _("DW_OP_entry_value resolving expects callee %s at %s "
"but the called frame is for %s at %s"),
(target_msym == NULL ? "???"
: MSYMBOL_PRINT_NAME (target_msym)),
@@ -1290,10 +1288,10 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
struct minimal_symbol *msym
= lookup_minimal_symbol_by_pc (caller_pc).minsym;
- /* DW_TAG_GNU_call_site_parameter will be missing just if GCC could not
+ /* DW_TAG_call_site_parameter will be missing just if GCC could not
determine its value. */
throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find matching parameter "
- "at DW_TAG_GNU_call_site %s at %s"),
+ "at DW_TAG_call_site %s at %s"),
paddress (gdbarch, caller_pc),
msym == NULL ? "???" : MSYMBOL_PRINT_NAME (msym));
}
@@ -1303,8 +1301,8 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
}
/* Return value for PARAMETER matching DEREF_SIZE. If DEREF_SIZE is -1, return
- the normal DW_AT_GNU_call_site_value block. Otherwise return the
- DW_AT_GNU_call_site_data_value (dereferenced) block.
+ the normal DW_AT_call_value block. Otherwise return the
+ DW_AT_call_data_value (dereferenced) block.
TYPE and CALLER_FRAME specify how to evaluate the DWARF block into returned
struct value.
@@ -1328,9 +1326,9 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
/* DEREF_SIZE size is not verified here. */
if (data_src == NULL)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("Cannot resolve DW_AT_GNU_call_site_data_value"));
+ _("Cannot resolve DW_AT_call_data_value"));
- /* DW_AT_GNU_call_site_value is a DWARF expression, not a DWARF
+ /* DW_AT_call_value is a DWARF expression, not a DWARF
location. Postprocessing of DWARF_VALUE_MEMORY would lose the type from
DWARF block. */
data = (gdb_byte *) alloca (size + 1);
@@ -1381,7 +1379,7 @@ entry_data_value_free_closure (struct value *v)
/* Vector for methods for an entry value reference where the referenced value
is stored in the caller. On the first dereference use
- DW_AT_GNU_call_site_data_value in the caller. */
+ DW_AT_call_data_value in the caller. */
static const struct lval_funcs entry_data_value_funcs =
{
@@ -1396,7 +1394,7 @@ static const struct lval_funcs entry_data_value_funcs =
/* Read parameter of TYPE at (callee) FRAME's function entry. KIND and KIND_U
are used to match DW_AT_location at the caller's
- DW_TAG_GNU_call_site_parameter.
+ DW_TAG_call_site_parameter.
Function always returns non-NULL value. It throws NO_ENTRY_VALUE_ERROR if it
cannot resolve the parameter for any reason. */
@@ -1420,7 +1418,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
type, caller_frame,
caller_per_cu);
- /* Check if DW_AT_GNU_call_site_data_value cannot be used. If it should be
+ /* Check if DW_AT_call_data_value cannot be used. If it should be
used and it is not available do not fall back to OUTER_VAL - dereferencing
TYPE_CODE_REF with non-entry data value would give current value - not the
entry value. */
@@ -1448,7 +1446,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
/* Read parameter of TYPE at (callee) FRAME's function entry. DATA and
SIZE are DWARF block used to match DW_AT_location at the caller's
- DW_TAG_GNU_call_site_parameter.
+ DW_TAG_call_site_parameter.
Function always returns non-NULL value. It throws NO_ENTRY_VALUE_ERROR if it
cannot resolve the parameter for any reason. */
@@ -1472,7 +1470,7 @@ value_of_dwarf_block_entry (struct type *type, struct frame_info *frame,
suppressed during normal operation. The expression can be arbitrary if
there is no caller-callee entry value binding expected. */
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DWARF-2 expression error: DW_OP_GNU_entry_value is supported "
+ _("DWARF-2 expression error: DW_OP_entry_value is supported "
"only for single DW_OP_reg* or for DW_OP_fbreg(*)"));
}
@@ -2227,7 +2225,7 @@ indirect_pieced_value (struct value *value)
return NULL;
if (bit_length != 0)
- error (_("Invalid use of DW_OP_GNU_implicit_pointer"));
+ error (_("Invalid use of DW_OP_implicit_pointer"));
piece = p;
break;
@@ -2806,7 +2804,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
per_cu_dwarf_call (this, die_offset, per_cu);
}
- /* DW_OP_GNU_entry_value accesses require a caller, therefore a
+ /* DW_OP_entry_value accesses require a caller, therefore a
frame. */
void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
@@ -4163,6 +4161,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_implicit_pointer:
case DW_OP_GNU_implicit_pointer:
{
ul = extract_unsigned_integer (data, offset_size,
@@ -4177,6 +4176,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_deref_type:
case DW_OP_GNU_deref_type:
{
int addr_size = *data++;
@@ -4193,6 +4193,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_const_type:
case DW_OP_GNU_const_type:
{
cu_offset type_die;
@@ -4207,6 +4208,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_regval_type:
case DW_OP_GNU_regval_type:
{
uint64_t reg;
@@ -4226,7 +4228,9 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_convert:
case DW_OP_GNU_convert:
+ case DW_OP_reinterpret:
case DW_OP_GNU_reinterpret:
{
cu_offset type_die;
@@ -4248,6 +4252,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
}
break;
+ case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
data = safe_read_uleb128 (data, end, &ul);
fputc_filtered ('\n', stream);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index aec0fa7..1b671e4 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8361,6 +8361,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_catch_block:
read_lexical_block_scope (die, cu);
break;
+ case DW_TAG_call_site:
case DW_TAG_GNU_call_site:
read_call_site_scope (die, cu);
break;
@@ -11314,11 +11315,12 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_cu *child_origin_cu;
/* We are trying to process concrete instance entries:
- DW_TAG_GNU_call_site DIEs indeed have a DW_AT_abstract_origin tag, but
+ DW_TAG_call_site DIEs indeed have a DW_AT_abstract_origin tag, but
it's not relevant to our analysis here. i.e. detecting DIEs that are
present in the abstract instance but not referenced in the concrete
one. */
- if (child_die->tag == DW_TAG_GNU_call_site)
+ if (child_die->tag == DW_TAG_call_site
+ || child_die->tag == DW_TAG_GNU_call_site)
continue;
/* For each CHILD_DIE, find the corresponding child of
@@ -11653,7 +11655,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
local_using_directives = newobj->local_using_directives;
}
-/* Read in DW_TAG_GNU_call_site and insert it to CU->call_site_htab. */
+/* Read in DW_TAG_call_site and insert it to CU->call_site_htab. */
static void
read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
@@ -11669,11 +11671,17 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- attr = dwarf2_attr (die, DW_AT_low_pc, cu);
+ attr = dwarf2_attr (die, DW_AT_call_return_pc, cu);
+ if (attr == NULL)
+ {
+ /* This was a pre-DWARF-5 GNU extension alias
+ for DW_AT_call_return_pc. */
+ attr = dwarf2_attr (die, DW_AT_low_pc, cu);
+ }
if (!attr)
{
complaint (&symfile_complaints,
- _("missing DW_AT_low_pc for DW_TAG_GNU_call_site "
+ _("missing DW_AT_call_return_pc for DW_TAG_call_site "
"DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (objfile));
return;
@@ -11690,7 +11698,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (*slot != NULL)
{
complaint (&symfile_complaints,
- _("Duplicate PC %s for DW_TAG_GNU_call_site "
+ _("Duplicate PC %s for DW_TAG_call_site "
"DIE 0x%x [in module %s]"),
paddress (gdbarch, pc), die->offset.sect_off,
objfile_name (objfile));
@@ -11703,11 +11711,12 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
for (child_die = die->child; child_die && child_die->tag;
child_die = sibling_die (child_die))
{
- if (child_die->tag != DW_TAG_GNU_call_site_parameter)
+ if (child_die->tag != DW_TAG_call_site_parameter
+ && child_die->tag != DW_TAG_GNU_call_site_parameter)
{
complaint (&symfile_complaints,
- _("Tag %d is not DW_TAG_GNU_call_site_parameter in "
- "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
+ _("Tag %d is not DW_TAG_call_site_parameter in "
+ "DW_TAG_call_site child DIE 0x%x [in module %s]"),
child_die->tag, child_die->offset.sect_off,
objfile_name (objfile));
continue;
@@ -11725,7 +11734,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
call_site->pc = pc;
- if (dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
+ if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu)
+ || dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
{
struct die_info *func_die;
@@ -11735,10 +11745,12 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
&& func_die->tag != DW_TAG_subroutine_type;
func_die = func_die->parent);
- /* DW_AT_GNU_all_call_sites is a superset
- of DW_AT_GNU_all_tail_call_sites. */
+ /* DW_AT_call_all_calls is a superset
+ of DW_AT_call_all_tail_calls. */
if (func_die
+ && !dwarf2_flag_true_p (func_die, DW_AT_call_all_calls, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
+ && !dwarf2_flag_true_p (func_die, DW_AT_call_all_tail_calls, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_tail_call_sites, cu))
{
/* TYPE_TAIL_CALL_LIST is not interesting in functions where it is
@@ -11766,15 +11778,22 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else
complaint (&symfile_complaints,
- _("Cannot find function owning DW_TAG_GNU_call_site "
+ _("Cannot find function owning DW_TAG_call_site "
"DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (objfile));
}
}
- attr = dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
+ attr = dwarf2_attr (die, DW_AT_call_target, cu);
if (attr == NULL)
- attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
+ attr = dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
+ if (attr == NULL)
+ attr = dwarf2_attr (die, DW_AT_call_origin, cu);
+ if (attr == NULL)
+ {
+ /* This was a pre-DWARF-5 GNU extension alias for DW_AT_call_origin. */
+ attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
+ }
SET_FIELD_DWARF_BLOCK (call_site->target, NULL);
if (!attr || (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0))
/* Keep NULL DWARF_BLOCK. */;
@@ -11812,7 +11831,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
target_physname = dwarf2_physname (NULL, target_die, target_cu);
if (target_physname == NULL)
complaint (&symfile_complaints,
- _("DW_AT_GNU_call_site_target target DIE has invalid "
+ _("DW_AT_call_target target DIE has invalid "
"physname, for referencing DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (objfile));
else
@@ -11826,7 +11845,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
<= PC_BOUNDS_INVALID)
complaint (&symfile_complaints,
- _("DW_AT_GNU_call_site_target target DIE has invalid "
+ _("DW_AT_call_target target DIE has invalid "
"low pc, for referencing DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (objfile));
else
@@ -11838,7 +11857,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else
complaint (&symfile_complaints,
- _("DW_TAG_GNU_call_site DW_AT_GNU_call_site_target is neither "
+ _("DW_TAG_call_site DW_AT_call_target is neither "
"block nor reference, for DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile_name (objfile));
@@ -11851,7 +11870,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct call_site_parameter *parameter;
struct attribute *loc, *origin;
- if (child_die->tag != DW_TAG_GNU_call_site_parameter)
+ if (child_die->tag != DW_TAG_call_site_parameter
+ && child_die->tag != DW_TAG_GNU_call_site_parameter)
{
/* Already printed the complaint above. */
continue;
@@ -11862,10 +11882,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
/* DW_AT_location specifies the register number or DW_AT_abstract_origin
specifies DW_TAG_formal_parameter. Value of the data assumed for the
- register is contained in DW_AT_GNU_call_site_value. */
+ register is contained in DW_AT_call_value. */
loc = dwarf2_attr (child_die, DW_AT_location, cu);
- origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
+ origin = dwarf2_attr (child_die, DW_AT_call_parameter, cu);
+ if (origin == NULL)
+ {
+ /* This was a pre-DWARF-5 GNU extension alias
+ for DW_AT_call_parameter. */
+ origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
+ }
if (loc == NULL && origin != NULL && attr_form_is_ref (origin))
{
sect_offset offset;
@@ -11878,9 +11904,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
binding can be done only inside one CU. Such referenced DIE
therefore cannot be even moved to DW_TAG_partial_unit. */
complaint (&symfile_complaints,
- _("DW_AT_abstract_origin offset is not in CU for "
- "DW_TAG_GNU_call_site child DIE 0x%x "
- "[in module %s]"),
+ _("DW_AT_call_parameter offset is not in CU for "
+ "DW_TAG_call_site child DIE 0x%x [in module %s]"),
child_die->offset.sect_off, objfile_name (objfile));
continue;
}
@@ -11891,7 +11916,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
{
complaint (&symfile_complaints,
_("No DW_FORM_block* DW_AT_location for "
- "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
+ "DW_TAG_call_site child DIE 0x%x [in module %s]"),
child_die->offset.sect_off, objfile_name (objfile));
continue;
}
@@ -11910,19 +11935,21 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
complaint (&symfile_complaints,
_("Only single DW_OP_reg or DW_OP_fbreg is supported "
"for DW_FORM_block* DW_AT_location is supported for "
- "DW_TAG_GNU_call_site child DIE 0x%x "
+ "DW_TAG_call_site child DIE 0x%x "
"[in module %s]"),
child_die->offset.sect_off, objfile_name (objfile));
continue;
}
}
- attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
+ attr = dwarf2_attr (child_die, DW_AT_call_value, cu);
+ if (attr == NULL)
+ attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
if (!attr_form_is_block (attr))
{
complaint (&symfile_complaints,
- _("No DW_FORM_block* DW_AT_GNU_call_site_value for "
- "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
+ _("No DW_FORM_block* DW_AT_call_value for "
+ "DW_TAG_call_site child DIE 0x%x [in module %s]"),
child_die->offset.sect_off, objfile_name (objfile));
continue;
}
@@ -11934,13 +11961,15 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
parameter->data_value_size = 0;
call_site->parameter_count++;
- attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
+ attr = dwarf2_attr (child_die, DW_AT_call_data_value, cu);
+ if (attr == NULL)
+ attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
if (attr)
{
if (!attr_form_is_block (attr))
complaint (&symfile_complaints,
- _("No DW_FORM_block* DW_AT_GNU_call_site_data_value for "
- "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
+ _("No DW_FORM_block* DW_AT_call_data_value for "
+ "DW_TAG_call_site child DIE 0x%x [in module %s]"),
child_die->offset.sect_off, objfile_name (objfile));
else
{
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 5852160..e094ece 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1041,12 +1041,12 @@ struct func_type
unsigned int is_noreturn : 1;
- /* * Only those DW_TAG_GNU_call_site's in this function that have
- DW_AT_GNU_tail_call set are linked in this list. Function
+ /* * Only those DW_TAG_call_site's in this function that have
+ DW_AT_call_tail_call set are linked in this list. Function
without its tail call list complete
- (DW_AT_GNU_all_tail_call_sites or its superset
- DW_AT_GNU_all_call_sites) has TAIL_CALL_LIST NULL, even if some
- DW_TAG_GNU_call_site's exist in such function. */
+ (DW_AT_call_all_tail_calls or its superset
+ DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
+ DW_TAG_call_site's exist in such function. */
struct call_site *tail_call_list;
@@ -1106,13 +1106,12 @@ struct call_site_parameter
union call_site_parameter_u u;
- /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_value. It
- is never NULL. */
+ /* * DW_TAG_formal_parameter's DW_AT_call_value. It is never NULL. */
const gdb_byte *value;
size_t value_size;
- /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_data_value.
+ /* * DW_TAG_formal_parameter's DW_AT_call_data_value.
It may be NULL if not provided by DWARF. */
const gdb_byte *data_value;
@@ -1120,8 +1119,7 @@ struct call_site_parameter
};
/* * A place where a function gets called from, represented by
- DW_TAG_GNU_call_site. It can be looked up from
- symtab->call_site_htab. */
+ DW_TAG_call_site. It can be looked up from symtab->call_site_htab. */
struct call_site
{
@@ -1135,7 +1133,7 @@ struct call_site
struct call_site *tail_call_next;
- /* * Describe DW_AT_GNU_call_site_target. Missing attribute uses
+ /* * Describe DW_AT_call_target. Missing attribute uses
FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */
struct call_site_target target;
@@ -1149,7 +1147,7 @@ struct call_site
struct dwarf2_per_cu_data *per_cu;
- /* * Describe DW_TAG_GNU_call_site's DW_TAG_formal_parameter. */
+ /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
struct call_site_parameter parameter[1];
};
diff --git a/gdb/stack.c b/gdb/stack.c
index 6cd4110..aa3a80e 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -407,10 +407,9 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
/* Initialize it just to avoid a GCC false warning. */
struct value *val_deref = NULL, *entryval_deref;
- /* DW_AT_GNU_call_site_value does match with the current
+ /* DW_AT_call_value does match with the current
value. If it is a reference still try to verify if
- dereferenced DW_AT_GNU_call_site_data_value does not
- differ. */
+ dereferenced DW_AT_call_data_value does not differ. */
TRY
{
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index 5ce39c2..4650726 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -129,7 +129,7 @@ OP (OP_VAR_VALUE)
/* OP_VAR_ENTRY_VALUE takes one struct symbol * in the following element,
followed by another OP_VAR_ENTRY_VALUE, making three exp_elements.
somename@entry may mean parameter value as present at the entry of the
- current function. Implemented via DW_OP_GNU_entry_value. */
+ current function. Implemented via DW_OP_entry_value. */
OP (OP_VAR_ENTRY_VALUE)
/* OP_LAST is followed by an integer in the next exp_element.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
index c0072ac..aa14856 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
@@ -19,7 +19,7 @@ set opts {}
if [info exists COMPILE] {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1"
set srcfile ${srcfile2}
- lappend opts debug optimize=-O2
+ lappend opts optimize=-O2 additional_flags=-gdwarf-5
} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
verbose "Skipping amd64-entry-value-param."
return
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index ee6bff5..d041b37 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -159,7 +159,7 @@ gdb_test_no_output "set print entry-values default" "entry_invalid: set print en
gdb_test "frame" {\(inv=<optimized out>\).*} "entry_invalid: frame: default"
-# Test @entry values for DW_AT_GNU_call_site_data_value parameters.
+# Test @entry values for DW_AT_call_data_value parameters.
gdb_continue_to_breakpoint "entry_reference: reference"
@@ -188,7 +188,7 @@ gdb_test "p regparam@entry" " = \\(int &\\) @$addr: 1" "entry_reference: p regpa
gdb_test "p ®param@entry" " = \\(int \\*\\) $addr" "entry_reference: p ®param@entry"
gdb_test "p regcopy" " = 1" "entry_reference: p regcopy"
gdb_test "p nodataparam" " = \\(int &\\) @0x\[0-9a-f\]+: 22" "entry_reference: p nodataparam"
-gdb_test "p nodataparam@entry" "Cannot resolve DW_AT_GNU_call_site_data_value" "entry_reference: p nodataparam@entry"
+gdb_test "p nodataparam@entry" "Cannot resolve DW_AT_call_data_value" "entry_reference: p nodataparam@entry"
# Test virtual tail call frames.
@@ -249,5 +249,5 @@ gdb_test "bt" "^bt\r\n#0 +d \\(i=<optimized out>, j=<optimized out>\\)\[^\r\n\]*
"self: bt"
gdb_test_no_output "set debug entry-values 1"
-gdb_test "bt" "DW_OP_GNU_entry_value resolving has found function \"self\\(int\\)\" at 0x\[0-9a-f\]+ can call itself via tail calls\r\n.*" \
+gdb_test "bt" "DW_OP_entry_value resolving has found function \"self\\(int\\)\" at 0x\[0-9a-f\]+ can call itself via tail calls\r\n.*" \
"self: bt debug entry-values"