This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

i386 return value


Hi,

In i386_retal.c we have:
/* %eax, or pair %eax, %edx.  */
static const Dwarf_Op loc_intreg[] =
  {
    { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
    { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
  };

In i386_regs.c we have:
  switch (regno)
    {
      static const char baseregs[][2] =
        {
          "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
        };

It seems to comment doesn't match the code.  As far as I can see
the order of the registers in i386_regs.c is correct, and
different then x86_64.  Looking at the gdb source, edx is used
for the return value.  So I believe the attached patch should fix
things.  It still passes the regression tests after the change.

The issue was pointed out by Thorsten Glaser <tg@mirbsd.de>


Kurt

diff --git a/backends/i386_retval.c b/backends/i386_retval.c
index c3bab10..95caf40 100644
--- a/backends/i386_retval.c
+++ b/backends/i386_retval.c
@@ -38,7 +38,7 @@
 static const Dwarf_Op loc_intreg[] =
   {
     { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
-    { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
+    { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
   };
 #define nloc_intreg	1
 #define nloc_intregpair	4

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]