This is the mail archive of the mailing list for the GDB 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]

[commit] SIGILL in when running program from GDB on ia64-linux


The debugger on ia64-linux (probably all ia64 targets actually) is
unable to run a program:

    (gdb) start
    Temporary breakpoint 1 at 0x4000000000003612: file foo.adb, line 5.
    Starting program: /taff.a/brobecke/regr/ex/foo 
    Program received signal SIGILL, Illegal instruction.
    0x200000000001b722 in _dl_debug_state () from /lib/

And indeed, when you look at the code at this address:

    (gdb) x /3i 0x200000000001b720
    0x200000000001b720 <_dl_debug_state>:   [MII]       nop.m 0x0
    0x200000000001b721 <_dl_debug_state+1>:             nop.i 0x0
    0x200000000001b722 <_dl_debug_state+2>:             data8 0x108001100

It should looks like this:

   (gdb) x /3i 0x200000000001b720
   0x200000000001b720 <_dl_debug_state>:   [MIB]       nop.m 0x0
   0x200000000001b721 <_dl_debug_state+1>:             nop.i 0x0
   0x200000000001b722 <_dl_debug_state+2>:             br.ret.sptk.many b0;;

What happened is that we inserted our shlib breakpoint on the first
slot of our instruction bundle.  Later on, when we tried to step over it,
we proceeded to remove the breakpoint.  To do that, we first tried to
read the entire instruction bundle, so that we could reinsert the
real instruction in that slot. However, in the meantime, the target_read
had already tried to restore the breakpoint using the shadow contents.
The general mechanism for restoring the shadow contents doesn't work
on ia64, because the instruction is not actually located at the breakpoint
address (0x200000000001b720), but 5 bits later! Also, the instruction
length is also not equal to the length of our shadow contents buffer,
which is measured in bytes, not bits.

The fix was to disable the shadow_contents restoration during memory reads.

2008-04-29  Joel Brobecker  <>

        * ia64-tdep.c (ia64_memory_remove_breakpoint): Set
        show_memory_breakpoints to 1 while reading the instruction bundle.

Tested on ia64-tdep.c. Together with the ia64_convert_from_func_ptr_addr
patch I proposed earlier, this brings the testsuite results back to where
they were with gdb-6.8 (slightly better actually, not sure where, though).

Checked in.


PS: This makes me realize that, in the future, we might want to make
    the shadow contents restoration a gdbarch method.  We might have
    some related issues when parsing function prologues where
    a breakpoint has been inserted.  I'm waiting to see the problem
    in reality before moving in that direction...

Attachment: ia64-tdep.c.diff
Description: Text document

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