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 breakpoints/22921] breakpoint in PLT corrupts function argument in $rcx


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

--- Comment #1 from Stas Sergeev <stsp at users dot sourceforge.net> ---
Also it is very interesting to see the problem
in interactive mode. Remove any .gdbinit, then do:

---
$ make
$ gdb ./tst
...
Reading symbols from ./tst...done.
(gdb) b DynAlloc
Function "DynAlloc" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (DynAlloc) pending.
(gdb) r
Starting program: /home/stas/tests/fdpp/tst 
warning: Corrupted shared library list: 0x613e90 != 0x7ffff7ffd990

Breakpoint 1, 0x00007ffff6caaff0 in DynAlloc(char const*, unsigned int,
unsigned int)@plt () from ./libfdpp.so
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-7.2.1-2.fc27.x86_64 libstdc++-7.2.1-2.fc27.x86_64
(gdb) p /x $rcx
$1 = 0x200
(gdb) disas
Dump of assembler code for function _Z8DynAllocPKcjj@plt:
=> 0x00007ffff6caaff0 <+0>:     jmpq   *0x24d62a(%rip)        # 0x7ffff6ef8620
   0x00007ffff6caaff6 <+6>:     pushq  $0xc1
   0x00007ffff6caaffb <+11>:    jmpq   0x7ffff6caa3d0
End of assembler dump.
(gdb) si
0x00007ffff6caaff6 in DynAlloc(char const*, unsigned int, unsigned int)@plt ()
   from ./libfdpp.so
(gdb) disas
Dump of assembler code for function _Z8DynAllocPKcjj@plt:
   0x00007ffff6caaff0 <+0>:     jmpq   *0x24d62a(%rip)        # 0x7ffff6ef8620
=> 0x00007ffff6caaff6 <+6>:     pushq  $0xc1
   0x00007ffff6caaffb <+11>:    jmpq   0x7ffff6caa3d0
End of assembler dump.
(gdb) p /x $rcx
$2 = 0x7ffff6caaff6
(gdb) 
---

In the above example I did "si" inside PLT, which
just followed the "jmp" instruction. As can be seen,
$rcx is valid before that "si" and is corrupted after.
This only happens if SIGALRM comes in between.

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