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

Fwd: Bug in reversible GDB


---------- Forwarded message ----------
From: Colin Paul Gloster <Colin_Paul_Gloster@acm.org>
Date: Mon, Jul 6, 2009 at 20:33
Subject: Bug in reversible GDB
To: Hui Zhu <teawater@gmail.com>


On Fri, 3 Jul 2009, Hui Zhu wrote:

|--------------------------------------------------------------------------------|
|"[..]
? ? ? ? ? |
|
 ? ? ? ? ?|
|Process record and replay target (This is the new name ) ?is already
 ? ? ? ? ?|
|in the gdb-cve-head.
 ? ? ? ? ?|
|You can get more message from
http://sourceware.org/gdb/wiki/ReversibleDebugging|
|
 ? ? ? ? ?|
|BTW, The AMD64 patch ?still not in, you can get it from the link in
? ? ? ? ? |
|this wiki page.
? ? ? ? ? |
|
 ? ? ? ? ?|
|[..]"
? ? ? ? ? |
|--------------------------------------------------------------------------------|


Hi Hui,

Thank you for the work. It seems that it may become excellent. I am
yet to see it being perfect though.

I give an example of buggy behavior based on
HTTP://SourceForge.net/forum/forum.php?forum_id=832141
...

#include<stdio.h>
int a = 0;
void
cool2 ()
{
printf ("a = %d\n", a);
}
int
cool ()
{
a += 3;

cool2();

return (a);
}
int
main()
{
int b = 0;
int c = 1;

printf ("a = %d b = %d c = %d\n", a, b, c);
b = cool ();
printf ("a = %d b = %d c = %d\n", a, b, c);

/*Line 27.*/c += 1;
/*Line 28.*/printf ("a = %d b = %d c = %d\n", a, b, c);
/*Line 29.*/a -= 2;
/*Line 30.*/printf ("a = %d b = %d c = %d\n", a, b, c);

/*Line 32.*/return (0);
}


gdb ./C_program_for_testing_reversible_debugging
GNU gdb (GDB) 6.8.50.20090629-cvs (actually
gdb-weekly-CVS-6.8.50.20090630.tar.bz2 patched as per
HTTP://Sourceware.org/ml/gdb-patches/2009-06/msg00797.html
and
HTTP://Sourceware.org/ml/gdb-patches/2009-06/msg00798.html
and
HTTP://Sourceware.org/ml/gdb-patches/2009-06/msg00799.html
)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. ?Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x401050: file
C_program_for_testing_reversible_debugging.c, line 20.
(gdb) run
Starting program: /home/Colin_Paul/C_program_for_testing_reversible_debugging

Breakpoint 1, main () at C_program_for_testing_reversible_debugging.c:20
20 ? ? ?int b = 0;
(gdb) record
(gdb) break C_program_for_testing_reversible_debugging.c:32
Breakpoint 2 at 0x4010ea: file
C_program_for_testing_reversible_debugging.c, line 32.
(gdb) continue
Continuing.
a = 0 b = 0 c = 1
a = 3
a = 3 b = 3 c = 1
a = 3 b = 3 c = 2
a = 1 b = 3 c = 2

Breakpoint 2, main () at C_program_for_testing_reversible_debugging.c:32
32 ? ? ?return (0);
(gdb) reverse-step
28 ? ? ?printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb) reverse-step
27 ? ? ?c += 1;
(gdb)


I would have hoped that reverse-step from the 32nd line would reach
the 30th line instead of the 27th line, and that the second
reverse-step would reach the 29th line instead of the 28th line.

I noticed that reverse-next behaved exactly the same as reverse-step...
gdb ./C_program_for_testing_reversible_debugging
GNU gdb (GDB) 6.8.50.20090629-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. ?Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x401050: file
C_program_for_testing_reversible_debugging.c, line 20.
(gdb) run
Starting program: /home/Colin_Paul/C_program_for_testing_reversible_debugging

Breakpoint 1, main () at C_program_for_testing_reversible_debugging.c:20
20 ? ? ?int b = 0;
(gdb) record
(gdb) break C_program_for_testing_reversible_debugging.c:32
Breakpoint 2 at 0x4010ea: file
C_program_for_testing_reversible_debugging.c, line 32.
(gdb) continue
Continuing.
a = 0 b = 0 c = 1
a = 3
a = 3 b = 3 c = 1
a = 3 b = 3 c = 2
a = 1 b = 3 c = 2

Breakpoint 2, main () at C_program_for_testing_reversible_debugging.c:32
32 ? ? ?return (0);
(gdb) reverse-
reverse-continue ?reverse-next ? ? ?reverse-search ? ?reverse-stepi
reverse-finish ? ?reverse-nexti ? ? reverse-step
(gdb) reverse-next
28 ? ? ?printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb) reverse-next
27 ? ? ?c += 1;
(gdb) quit
The program is running. ?Quit anyway (and kill it)? (y or n) y

The operating system I used was Bluewhite64 GNU/Linux 12.2 (
uname -a
Linux bluewhite64 2.6.27.7 #1 SMP Fri Dec 5 01:27:18 EET 2008 x86_64
Intel(R) Core(TM)2 Quad ?CPU ? Q9450 ?@ 2.66GHz GenuineIntel GNU/Linux
). I used that operating system's default compiler (
gcc -v
Reading specs from /usr/lib/gcc/x86_64-pc-linux/4.2.4/specs
Target: x86_64-pc-linux
Configured with: ../gcc-4.2.4/configure --prefix=/usr --enable-shared
--enable-languages=ada,c,c++,fortran,java,objc --disable-multilib
--enable-threads=posix --enable-__cxa_atexit --disable-checking
--with-gnu-ld --verbose --build=x86_64-pc-linux
--target=x86_64-pc-linux --host=x86_64-pc-linux
Thread model: posix
gcc version 4.2.4
). I compiled with
gcc -g C_program_for_testing_reversible_debugging.c -o
C_program_for_testing_reversible_debugging

Good luck.

With best regards,
Colin Paul


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