[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 09:02:00 GMT 2019


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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Using:
...
$ readelf -s a.out | grep ref
    52: 0000000000601030    16 OBJECT  GLOBAL DEFAULT   22 ref
...

we see that ref is of size 16.

And using objdump -d (when compiling at -O2 and preventing check from being
inlined by adding noinline/noclone attributes) we find that ref+8 is passed in
%rdi:
...
00000000004003f0 <main>:
  4003f0:       48 8b 3d 41 0c 20 00    mov    0x200c41(%rip),%rdi        #
601038 <ref+0x8>
  4003f7:       e9 e4 00 00 00          jmpq   4004e0 <_Z5check1s>
  4003fc:       0f 1f 40 00             nopl   0x0(%rax)
...

At the point of the assert, the arg has been classified as:
...
(gdb) p theclass
$1 = {AMD64_NO_CLASS, AMD64_INTEGER}
...
and we assert because AMD64_NO_CLASS is not handled.

Using this:
...
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index b00b1e192bf..fdb207ced53 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -962,6 +962,9 @@ if (return_method == return_method_struct)
                  offset = 8;
                  break;

+               case AMD64_NO_CLASS:
+                 continue;
+
                default:
                  gdb_assert (!"Unexpected register class.");
                }
...
the test-case passes.

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


More information about the Gdb-prs mailing list