forked from Imagelibrary/binutils-gdb
Display @entry parameter values even for references. * ada-valprint.c (ada_val_print_1) <TYPE_CODE_REF>: Try also coerce_ref_if_computed. * c-valprint.c (c_val_print) <TYPE_CODE_REF>: Likewise. * dwarf2expr.c (dwarf_block_to_dwarf_reg_deref): New function. (execute_stack_op) <DW_OP_GNU_entry_value>: Add -1 deref_size to the existing push_dwarf_reg_entry_value call. Add new detection calling dwarf_block_to_dwarf_reg_deref. Update the error message. (ctx_no_push_dwarf_reg_entry_value): New parameter deref_size. * dwarf2expr.h (struct dwarf_expr_context_funcs) <push_dwarf_reg_entry_value>: Add new parameter deref_size, describe it in the comment. (ctx_no_push_dwarf_reg_entry_value): Add new parameter deref_size. (dwarf_block_to_dwarf_reg_deref): New declaration. * dwarf2loc.c (dwarf_entry_parameter_to_value): Add new parameter deref_size, describe it in the function comment. New variables data_src and size, fetch the alternative block accoring to DEREF_SIZE. (dwarf_expr_push_dwarf_reg_entry_value): Add new parameter deref_size, describe it in the function comment. Fetch the alternative block accoring to DEREF_SIZE. (entry_data_value_coerce_ref, entry_data_value_copy_closure) (entry_data_value_free_closure, entry_data_value_funcs): New. (value_of_dwarf_reg_entry): New variables checked_type, target_type, outer_val, target_val, val and addr. Try to fetch and create also referenced value content. (pieced_value_funcs): NULL value for coerce_ref. (needs_dwarf_reg_entry_value): Add new parameter deref_size. * f-valprint.c (f_val_print) <TYPE_CODE_REF>: Try also coerce_ref_if_computed. * opencl-lang.c (opencl_value_funcs): NULL value for coerce_ref. * p-valprint.c (pascal_val_print) <TYPE_CODE_REF>: Likewise. * stack.c (read_frame_arg): Compare also dereferenced values. * value.c (value_computed_funcs): Make the parameter v const, use value_lval_const for it. (value_lval_const, coerce_ref_if_computed): New function. (coerce_ref): New variable retval. Call also coerce_ref_if_computed. * value.h (struct lval_funcs): New field coerce_ref. (value_computed_funcs): Make the parameter v const. (value_lval_const, coerce_ref_if_computed): New declarations. gdb/testsuite/ Display @entry parameter values even for references. * gdb.arch/amd64-entry-value.cc (reference, datap, datap_input): New functions. (main): New variables regvar, nodatavarp, stackvar1, stackvar2. Call reference and datap_input. * gdb.arch/amd64-entry-value.exp (reference, breakhere_reference): New breakpoints. (continue to breakpoint: entry_reference: reference) (entry_reference: bt at entry) (continue to breakpoint: entry_reference: breakhere_reference) (entry_reference: bt, entry_reference: ptype regparam) (entry_reference: p regparam, entry_reference: ptype regparam@entry) (entry_reference: p regparam@entry, entry_reference: p ®param@entry) (entry_reference: p regcopy, entry_reference: p nodataparam) (entry_reference: p nodataparam@entry): New tests.
234 lines
4.4 KiB
C++
234 lines
4.4 KiB
C++
/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
Copyright 2011 Free Software Foundation, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
static volatile int v;
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
e (int i, double j)
|
|
{
|
|
v = 0;
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
d (int i, double j)
|
|
{
|
|
i++;
|
|
j++;
|
|
e (i, j);
|
|
e (v, v);
|
|
asm ("breakhere:");
|
|
e (v, v);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
locexpr (int i)
|
|
{
|
|
i = i;
|
|
asm ("breakhere_locexpr:");
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
c (int i, double j)
|
|
{
|
|
d (i * 10, j * 10);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
a (int i, double j)
|
|
{
|
|
c (i + 1, j + 1);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
b (int i, double j)
|
|
{
|
|
c (i + 2, j + 2);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb_z (int i)
|
|
{
|
|
d (i + 7, i + 7.5);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb_y (int i)
|
|
{
|
|
amb_z (i + 6);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb_x (int i)
|
|
{
|
|
amb_y (i + 5);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb (int i)
|
|
{
|
|
if (i < 0)
|
|
amb_x (i + 3);
|
|
else
|
|
amb_x (i + 4);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb_b (int i)
|
|
{
|
|
amb (i + 2);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
amb_a (int i)
|
|
{
|
|
amb_b (i + 1);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone)) self (int i);
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
self2 (int i)
|
|
{
|
|
self (i);
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
self (int i)
|
|
{
|
|
if (i == 200)
|
|
{
|
|
/* GCC would inline `self' as `cmovne' without the `self2' indirect. */
|
|
self2 (i + 1);
|
|
}
|
|
else
|
|
{
|
|
e (v, v);
|
|
d (i + 2, i + 2.5);
|
|
}
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
stacktest (int r1, int r2, int r3, int r4, int r5, int r6, int s1, int s2,
|
|
double d1, double d2, double d3, double d4, double d5, double d6,
|
|
double d7, double d8, double d9, double da)
|
|
{
|
|
s1 = 3;
|
|
s2 = 4;
|
|
d9 = 3.5;
|
|
da = 4.5;
|
|
e (v, v);
|
|
asm ("breakhere_stacktest:");
|
|
e (v, v);
|
|
}
|
|
|
|
/* nodataparam has DW_AT_GNU_call_site_value but it does not have
|
|
DW_AT_GNU_call_site_data_value. GDB should not display dereferenced @entry
|
|
value for it. */
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
reference (int ®param, int &nodataparam, int r3, int r4, int r5, int r6,
|
|
int &stackparam1, int &stackparam2)
|
|
{
|
|
int regcopy = regparam, nodatacopy = nodataparam;
|
|
int stackcopy1 = stackparam1, stackcopy2 = stackparam2;
|
|
|
|
regparam = 21;
|
|
nodataparam = 22;
|
|
stackparam1 = 31;
|
|
stackparam2 = 32;
|
|
e (v, v);
|
|
asm ("breakhere_reference:");
|
|
e (v, v);
|
|
}
|
|
|
|
static int *__attribute__((noinline, noclone))
|
|
datap ()
|
|
{
|
|
static int two = 2;
|
|
|
|
return &two;
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
datap_input (int *datap)
|
|
{
|
|
(*datap)++;
|
|
}
|
|
|
|
static int __attribute__((noinline, noclone))
|
|
data (void)
|
|
{
|
|
return 10;
|
|
}
|
|
|
|
static int __attribute__((noinline, noclone))
|
|
data2 (void)
|
|
{
|
|
return 20;
|
|
}
|
|
|
|
static int __attribute__((noinline, noclone))
|
|
different (int val)
|
|
{
|
|
val++;
|
|
e (val, val);
|
|
asm ("breakhere_different:");
|
|
return val;
|
|
}
|
|
|
|
static int __attribute__((noinline, noclone))
|
|
validity (int lost, int born)
|
|
{
|
|
lost = data ();
|
|
e (0, 0.0);
|
|
asm ("breakhere_validity:");
|
|
return born;
|
|
}
|
|
|
|
static void __attribute__((noinline, noclone))
|
|
invalid (int inv)
|
|
{
|
|
e (0, 0.0);
|
|
asm ("breakhere_invalid:");
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
d (30, 30.5);
|
|
locexpr (30);
|
|
stacktest (1, 2, 3, 4, 5, 6, 11, 12,
|
|
1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 11.5, 12.5);
|
|
different (5);
|
|
validity (5, data ());
|
|
invalid (data2 ());
|
|
|
|
{
|
|
int regvar = 1, *nodatavarp = datap (), stackvar1 = 11, stackvar2 = 12;
|
|
reference (regvar, *nodatavarp, 3, 4, 5, 6, stackvar1, stackvar2);
|
|
datap_input (nodatavarp);
|
|
}
|
|
|
|
if (v)
|
|
a (1, 1.25);
|
|
else
|
|
b (5, 5.25);
|
|
amb_a (100);
|
|
self (200);
|
|
return 0;
|
|
}
|