Re: gdb 10.1: wrong argument lookup code is used for x86_64 frame

Nat! <[email protected]>
Newsgroups gmane.comp.gdb.devel
Organization Codeon GmbH
Message-ID <[email protected]>
For my purposes, I could fix this by adding a 
amd64_fetch_pointer_argumentfunction to amd64-tdep.c:

```

static CORE_ADDR
amd64_fetch_pointer_argument (struct frame_info *frame, int argi,
               struct type *type)
{
   struct gdbarch *gdbarch = get_frame_arch (frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
   int regnum;
   int len;

   switch( argi)
   {
   case 0  : regnum = AMD64_RDI_REGNUM; break;
   case 1  : regnum = AMD64_RSI_REGNUM; break;
   case 2  : regnum = AMD64_RDX_REGNUM; break;
   case 3  : regnum = AMD64_RCX_REGNUM; break;
   case 4  : regnum = AMD64_R8_REGNUM; break;
   case 5  : regnum = AMD64_R9_REGNUM; break;

   default : sp  = get_frame_register_unsigned( frame, AMD64_RSP_REGNUM);
             len = gdbarch_ptr_bit( gdbarch) / 8;
             return read_memory_unsigned_integer (sp + (len * (argi - 
5)), len, byte_order);
   }
   return( get_frame_register_unsigned( frame, regnum));
}

```

The `default:` code path is probably trash :)


And I put this into `amd64_init_abi`:

```

set_gdbarch_fetch_pointer_argument (gdbarch, amd64_fetch_pointer_argument);
```


Ciao

   Nat!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.