[Bug tdep/25096] New: amd64_push_arguments places values in wrong register

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu Oct 10 21:03:00 GMT 2019


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

            Bug ID: 25096
           Summary: amd64_push_arguments places values in wrong register
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider this test-case:
...
$ cat test.c
struct s
{
  int c;
  struct {
      int a;
      float b;
  } s1;
};

struct s ref = {
  0,
  {
    'a',
    'b'
  }
};

int
check (struct s arg)
{
  return arg.s1.a == 'a' && arg.s1.b == 'b' && arg.c == 0;
}

int
main (void)
{
  return check (ref);
}
...

Calling 'check (ref)' at runtime gets us '1':
...
$ g++ test.c -g
$ ./a.out ; echo $?
1
...

But letting gdb do the call gets us '0':
...
$ gdb a.out -batch -ex start -ex "p check (ref)"
Temporary breakpoint 1 at 0x400518: file test.c, line 27.

Temporary breakpoint 1, main () at test.c:27
27        return check (ref);
$1 = 0
...

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


More information about the Gdb-prs mailing list