[Bug tdep/24104] amd64_push_arguments assert running C++ version of gdb.base/infcall-nested-structs

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Fri Oct 11 08:31:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=24104

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
I've extracted a command line reproducer for this xfail:
...
XFAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-tl: p/d
check_arg_struct_static_06_04 (ref_val_struct_static_06_04) (GDB internal
error)
...

With this test-case:
...
$ cat test3.c
typedef long tl;
struct struct_static_06_04
{
  struct { } es1;
  struct { } es2;
  static tl a;
  struct { } es3;
  static tl b;
  struct { } es4;
  static tl c;
  struct { } es5;
  static tl d;
  struct { } es6;
  static tl e;
  struct { } es7;
  tl f;
};

tl struct_static_06_04::a = 'I';
tl struct_static_06_04::b = 'J';
tl struct_static_06_04::c = 'K';
tl struct_static_06_04::d = 'L';
tl struct_static_06_04::e = 'M';

struct struct_static_06_04 ref_val_struct_static_06_04 = { {}, {}, {}, {}, {},
{}, {}, 'f' };

int
cmp_struct_static_06_04 (struct struct_static_06_04 a,
                         struct struct_static_06_04 b)
{
  return (a.a == b.a && a.b == b.b && a.c == b.c && a.d == b.d && a.e == b.e
          && a.f == b.f);
}

int
check_arg_struct_static_06_04 (struct struct_static_06_04 arg)
{
  return cmp_struct_static_06_04 (arg, ref_val_struct_static_06_04);
}

int
main (void)
{
  return check_arg_struct_static_06_04 (ref_val_struct_static_06_04);
}
...

We get '1' when running on the command line:
...
$ g++ test3.c -g
$ ./a.out; echo $?
1
...

but crash when trying the same call as in main on the gdb prompt:
...
$ gdb a.out -batch -ex start -ex "p check_arg_struct_static_06_04
(ref_val_struct_static_06_04)"
Temporary breakpoint 1 at 0x40054a: file test3.c, line 45.

Temporary breakpoint 1, main () at test3.c:45
45        return check_arg_struct_static_06_04 (ref_val_struct_static_06_04);
src/gdb/amd64-tdep.c:982: internal-error: CORE_ADDR
amd64_push_arguments(regcache*, int, value**, CORE_ADDR,
function_call_return_method): Assertion `!"Unexpected register class."' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list