rr icon indicating copy to clipboard operation
rr copied to clipboard

GDB backtrace on breakpoints doesn't show up

Open midenok opened this issue 1 year ago • 2 comments

Looks like #3547 fix is not full.

The below reproduces on 5.7.0 Debian release and latest master revision cbab5f75 with any GDB v8-v14. GDB alone works just fine as well as with RR 5.6.0!

Reproduce

#!/bin/bash
cat << EOF > /tmp/rrepro.c
#include <stdio.h>
int main() {
    puts("nice");
}
EOF

gcc /tmp/rrepro.c -o /tmp/rrepro -g3 -O0
rr /tmp/rrepro

cat << EOF > /tmp/rrepro.gdb
set debuginfod enabled off
b puts
commands
    echo ::Print start\n
    print str
    echo ::Backtrace start\n
    backtrace
    echo ::Backtrace end\n
    continue
end
set logging file /tmp/rrepro.log
set logging overwrite on
set logging enabled on
EOF

echo
echo ==Here comes replay execution
rr replay -- -x /tmp/rrepro.gdb -ex continue -nh --batch
echo
echo ==Here what we got into log
cat /tmp/rrepro.log

Result

rr: Saving execution to trace directory `/home/midenok/.local/share/rr/rrepro-18'.
nice

==Here comes replay execution
Really redefine built-in command "restart"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "jump"? (y or n) [answered Y; input not from terminal]
Breakpoint 1 at 0x1050
BFD: warning: system-supplied DSO at 0x6fffd000 has a section extending past end of file
0x00007f572421ed90 in _start () from /lib64/ld-linux-x86-64.so.2

Breakpoint 1, __GI__IO_puts (str=0x55da82882004 "nice") at ./libio/ioputs.c:33
warning: 33     ./libio/ioputs.c: No such file or directory
::Print start
$1 = 0x55da82882004 "nice"
::Backtrace start
#0  __GI__IO_puts (str=0x55da82882004 "nice") at ./libio/ioputs.c:33
#1  0x000055da82881160 in main () at /tmp/rrepro.c:3
::Backtrace end
nice

Program received signal SIGKILL, Killed.
0x0000000070000002 in syscall_traced ()
[Inferior 1 (process 3891308) detached]

==Here what we got into log
0x00007f572421ed90 in _start () from /lib64/ld-linux-x86-64.so.2

Breakpoint 1, __GI__IO_puts (str=0x55da82882004 "nice") at ./libio/ioputs.c:33
warning: 33     ./libio/ioputs.c: No such file or directory
::Print start
$1 = 0x55da82882004 "nice"
::Backtrace start
::Backtrace end

Program received signal SIGKILL, Killed.
0x0000000070000002 in syscall_traced ()
[Inferior 1 (process 3891308) detached]

Expected

/tmp/rrepro.log must contain:

::Backtrace start
#0  __GI__IO_puts (str=0x557ae5594004 "nice") at ./libio/ioputs.c:33
#1  0x0000557ae5593160 in main () at /tmp/rrepro.c:3
::Backtrace end

midenok avatar Feb 18 '24 08:02 midenok

Any news?

midenok avatar Apr 12 '24 19:04 midenok

I've had a brief look at this. It's not the same bug as before, because I can reproduce it with all to_string parameters set to false. Also, this bug is strange because the backtrace appears on stdout but not in the file produced by set logging file. Figuring this out is going to require more debugging of gdb itself, which I'm not currently motivated to do.

rocallahan avatar Apr 15 '24 09:04 rocallahan