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 gdb/16110] New: disas /m misses some instructions


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

            Bug ID: 16110
           Summary: disas /m misses some instructions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: b7.10110111 at gmail dot com

How to reproduce:
0. It's likely to also reproduce without Qt libraries, but it was easiest for
me to find the procedure with Qt
1. Install qtconfig or any other Qt4 app, which calls QByteArray::realloc()
2. Run gdb qtconfig (gdb qtconfig-qt4 on Ubuntu)
3. "r" to make it load all necessary libraries
4. After qtconfig window appears, Ctrl+C in gdb console
5. "disas /m QByteArray::realloc(int)"
6. Here's the output around ::memcpy() call:

1460            ::memcpy(x->array, d->data, x->size);
   0x00007ffff6cb7ff8 <+72>:    lea    r13,[rbx+0x18]
   0x00007ffff6cb8010 <+96>:    movsxd rdx,edx

1461            x->array[x->size] = '\0';
   0x00007ffff6cb8018 <+104>:   movsxd rax,DWORD PTR [rbx+0x8]
   0x00007ffff6cb8024 <+116>:   mov    BYTE PTR [rbx+rax*1+0x18],0x0

1462            x->ref = 1;

7. Now do "disas QByteArray::realloc(int)" without /m
8. Here's the output from 0x00007ffff6cb7ff8 to 0x00007ffff6cb8024 (which are
bounds of code in 6.):

   0x00007ffff6cb7ff8 <+72>:    lea    r13,[rbx+0x18]
   0x00007ffff6cb7ffc <+76>:    mov    rdi,r13
   0x00007ffff6cb7fff <+79>:    mov    edx,DWORD PTR [rax+0x8]
   0x00007ffff6cb8002 <+82>:    mov    rsi,QWORD PTR [rax+0x10]
   0x00007ffff6cb8006 <+86>:    cmp    r12d,edx
   0x00007ffff6cb8009 <+89>:    cmovle edx,r12d
   0x00007ffff6cb800d <+93>:    mov    DWORD PTR [rbx+0x8],edx
   0x00007ffff6cb8010 <+96>:    movsxd rdx,edx
   0x00007ffff6cb8013 <+99>:    call   0x7ffff6c97150 <memcpy@plt>
   0x00007ffff6cb8018 <+104>:   movsxd rax,DWORD PTR [rbx+0x8]
   0x00007ffff6cb801c <+108>:   mov    DWORD PTR [rbx+0x4],r12d
   0x00007ffff6cb8020 <+112>:   mov    QWORD PTR [rbx+0x10],r13
   0x00007ffff6cb8024 <+116>:   mov    BYTE PTR [rbx+rax*1+0x18],0x0

9. See that plenty of instructions is missing in 6. which are only visible in
8..

It is confusing to see results as in 6. in front-ends like QtCreator where you
want to rely on output.

-- 
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]