This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug tdep/22760] New: Step into INT 0x3 instruction results in wrong $pc after it


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

            Bug ID: 22760
           Summary: Step into INT 0x3 instruction results in wrong $pc
                    after it
           Product: gdb
           Version: 8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: b7.10110111 at gmail dot com
  Target Milestone: ---

If we set current instruction bytes to a two-byte encoding of INT 0x03, then
GDB, apparently thinking that it was 0xCC breakpoint, simply increments $pc by
1, leading to next instruction beginning with 0x03. Test code:

$ gdb -q /bin/true -ex starti -ex 'set *(short*)$pc=0x03cd' -ex 'disas/r
$pc,+10' -ex si -ex 'disas/r $pc,+10'
Reading symbols from /bin/true...(no debugging symbols found)...done.
Starting program: /bin/true 

Program stopped.
0x00007ffff7ddb260 in ?? () from /lib64/ld-linux-x86-64.so.2
Dump of assembler code from 0x7ffff7ddb260 to 0x7ffff7ddb26a:
=> 0x00007ffff7ddb260:  cd 03   int    0x3
   0x00007ffff7ddb262:  e7 e8   out    0xe8,eax
   0x00007ffff7ddb264:  c8 06 00 00     enter  0x6,0x0
   0x00007ffff7ddb268:  49 89 c4        mov    r12,rax
End of assembler dump.
0x00007ffff7ddb261 in ?? () from /lib64/ld-linux-x86-64.so.2
Dump of assembler code from 0x7ffff7ddb261 to 0x7ffff7ddb26b:
=> 0x00007ffff7ddb261:  03 e7   add    esp,edi
   0x00007ffff7ddb263:  e8 c8 06 00 00  call   0x7ffff7ddb930
   0x00007ffff7ddb268:  49 89 c4        mov    r12,rax
End of assembler dump.

This doesn't happen on GDB 7.7.1 — there `si` command correctly increases $pc
by 2.
This already happens on 7.11.50.20160412-git, and in current master too.

This affects both x86_64 and i386 targets. Tested on native i386 and x86_64
GDB.

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

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