[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Elfutils segfault on IA64






On Wed, Oct 2, 2013 at 1:51 PM, Kurt Roeckx <kurt@roeckx.be> wrote:
On Wed, Oct 02, 2013 at 01:43:56PM -0500, Patrick Baggett wrote:
> I set the breakpoint, and it is called as you expected:
> (gdb) bt
> #0  ppc_register_info (ebl=0x6000000000004120, regno=-1, name=0x0,
> namelen=0, prefix=0x0, setname=0x0, bits=0x0, type=0x0) at ppc_regs.c:45

It's for the regno=1 case that I want to know that it properly
sets everything.  Can you watch what happens?


Breakpoint 1, ppc_register_info (ebl=0x6000000000004120, regno=-1, name=0x0, namelen=0, prefix=0x0, setname=0x0, bits=0x0, type=0x0) at ppc_regs.c:45
45        if (name == NULL)
(gdb) continue
Continuing.

Breakpoint 1, ppc_register_info (ebl=0x6000000000004120, regno=0, name=0x60000fffffffb328 "\355\377", namelen=32, prefix=0x60000fffffffb318, setname=0x60000fffffffb320, bits=0x60000fffffffb314, type=0x60000fffffffb310) at ppc_regs.c:45
45        if (name == NULL)
(gdb) continue
Continuing.
        integer reg0 (r0): undefined

Breakpoint 1, ppc_register_info (ebl=0x6000000000004120, regno=1, name=0x60000fffffffb328 "r0", namelen=32, prefix=0x60000fffffffb318, setname=0x60000fffffffb320, bits=0x60000fffffffb314, type=0x60000fffffffb310) at ppc_regs.c:45
45        if (name == NULL)
(gdb) bt
#0  ppc_register_info (ebl=0x6000000000004120, regno=1, name=0x60000fffffffb328 "r0", namelen=32, prefix=0x60000fffffffb318, setname=0x60000fffffffb320, bits=0x60000fffffffb314, type=0x60000fffffffb310) at ppc_regs.c:45
#1  0x20000000000ba2c0 in ebl_register_info (ebl=0x6000000000004120, regno=1, name=0x60000fffffffb328 "r0", namelen=32, prefix=0x60000fffffffb318, setname=0x60000fffffffb320, bits=0x60000fffffffb314, type=0x60000fffffffb310)
    at eblreginfo.c:48
#2  0x20000000000a4fa0 in dwfl_module_register_names (mod=0x60000000000062d0, func=<optimized out>, arg=0x60000fffffffb3a0) at dwfl_module_register_names.c:63
#3  0x4000000000001bd0 in handle_cfi (stuff=0x60000fffffffb3a0, pc=268436672, which=0x4000000000002318 ".debug_frame", dwfl=0x60000000000042f0, cfi=<optimized out>) at addrcfi.c:153
#4  handle_cfi (dwfl=0x60000000000042f0, which=0x4000000000002318 ".debug_frame", cfi=0x6000000000007420, pc=268436672, stuff=0x60000fffffffb3a0) at addrcfi.c:107
#5  0x4000000000001f50 in handle_address (pc=268436672, dwfl=0x60000000000042f0) at addrcfi.c:167
#6  0x40000000000010b0 in main (argc=4, argv=0x60000fffffffb678) at addrcfi.c:216
(gdb) step
48        if (regno < 0 || regno > 1155 || namelen < 8)
(gdb) step
52        *bits = ebl->machine == EM_PPC64 ? 64 : 32;
(gdb) step
51        *prefix = "";
(gdb) step
46          return 1156;
(gdb) step
51        *prefix = "";
(gdb) step
45        if (name == NULL)
(gdb) step
48        if (regno < 0 || regno > 1155 || namelen < 8)
(gdb) step
52        *bits = ebl->machine == EM_PPC64 ? 64 : 32;
(gdb) step
54                 : regno < 64 ? DW_ATE_float : DW_ATE_unsigned);
(gdb) step
51        *prefix = "";
(gdb) step
52        *bits = ebl->machine == EM_PPC64 ? 64 : 32;
(gdb) step
54                 : regno < 64 ? DW_ATE_float : DW_ATE_unsigned);
(gdb) step
56        if (regno < 32 || regno == 64 || regno == 66)
(gdb) step
53        *type = (regno < 32 ? DW_ATE_signed
(gdb) step
56        if (regno < 32 || regno == 64 || regno == 66)
(gdb) step
57          *setname = "integer";
(gdb) step
72        switch (regno)
(gdb) step
57          *setname = "integer";
(gdb) step
72        switch (regno)
(gdb) step
75            name[0] = 'r';
(gdb) step
77            namelen = 2;
(gdb) step
75            name[0] = 'r';
(gdb) step
76            name[1] = regno + '0';
(gdb) step
78            break;
(gdb) step
75            name[0] = 'r';
(gdb) step
195       name[namelen++] = '\0';
(gdb) step
76            name[1] = regno + '0';
(gdb) step
195       name[namelen++] = '\0';
(gdb) step
196       return namelen;
(gdb) step
ebl_register_info (ebl=0x6000000000004120, regno=1, name=0x60000fffffffb328 "r1", namelen=32, prefix=0x60000fffffffb318, setname=0x60000fffffffb320, bits=0x60000fffffffb314, type=0x60000fffffffb310) at eblreginfo.c:50
50      }
(gdb)


That's rather confusing to read. The code was compiled with "-O2 -g", perhaps I should try -O0 first to rule out a compiler bug? If so, how do I build it with -O0?

Patrick

Reply to: