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]

GDB record patch 0.1.5 for GDB-6.8 release


GDB record patch make GDB support Reversible Debugging.
It make GDB disassemble the instruction that will be executed to get
which memory and register will be changed and record them to record
all program running message. Through these on the use of this
information to achieve the implementation of the GDB Reversible
Debugging function.
To get more message, you can go to http://sourceforge.net/projects/record/ .

The main change of the 0.1.5 is can record the memory or registers
change in command line. And if the inferior in backward part and user
want change the values of  the memory or registers, GDB will ask user
if he want destory next record and record this change or not.
Of course, not everybody like answer the questions each times. Maybe I
need add a set command in next version.
This cool idea is from GDB-patches maillist.Thank you.:)

Another change is add a command "delrecord (drec)". When the inferior
in backward part and user call this command, GDB will destorey next
recorded message and continue record message.
I think this command name is not very clear. Maybe you can help me a
new one. Thanks. :)

The first attachment is 0.1.5 diff with the GDB-6.8 record 0.1.4.
The second one is GDB record patch 0.1.5.

You can read patch in http://sourceware.org/ml/gdb-patches/2008-06/msg00041.html

Example:
cat 1.c
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);

        c += 1;
	printf ("a = %d b = %d c = %d\n", a, b, c);
        a -= 2;
	printf ("a = %d b = %d c = %d\n", a, b, c);

        return (0);
}
gcc -g 1.c
gdb ./a.out
GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-linux-gnu"...
Setting up the environment for debugging gdb.
Function "internal_error" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
Function "info_command" not defined.
Make breakpoint pending on future shared library load? (y or [n])
[answered N; input not from terminal]
/media/disk/bgdb68/gdb/.gdbinit:8: Error in sourced command file:
No breakpoint number 0.
(gdb) b main
Breakpoint 1 at 0x80483c1: file ../../1.c, line 19.
(gdb) r
Starting program: /media/disk/bgdb68/gdb/a.out

Breakpoint 1, main () at ../../1.c:19
19              int     b = 0;
(gdb) rec
record: record and reverse function is started.
(rec) n
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x80483be.
20              int     c = 1;
(rec)
22              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec)
During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
register ebp (#5) at 0xffffe411.
a = 0 b = 0 c = 1
23              b = cool ();
(rec)
a = 3
24              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec)
a = 3 b = 3 c = 1
26              c += 1;
(rec) rev
record: GDB is set to reverse debug mode.
(rev) n
0x0804841a      24              printf ("a = %d b = %d c = %d\n", a, b, c);
(rev)
0x080483f8      23              b = cool ();
(rev)
0x080483ee      22              printf ("a = %d b = %d c = %d\n", a, b, c);
(rev) drec
Delete the next running messages and begin to record the running
message at current address?(y or n) y
(rev) rev
record: GDB is set to normal debug mode.
(rec) n
a = 0 b = 0 c = 1
23              b = cool ();
(rec)
a = 3
24              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec)
a = 3 b = 3 c = 1
26              c += 1;
(rec) p a=9999999999
$1 = 1410065407
(rec) p a
$2 = 1410065407
(rec) n
27              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec) n
a = 1410065407 b = 3 c = 2
28              a -= 2;
(rec) rev
record: GDB is set to reverse debug mode.
(rev) n
0x08048442      27              printf ("a = %d b = %d c = %d\n", a, b, c);
(rev)
26              c += 1;
(rev)
0x0804841a      24              printf ("a = %d b = %d c = %d\n", a, b, c);
(rev) p a
$3 = 3
(rev) n
0x080483f8      23              b = cool ();
(rev)
0x080483ee      22              printf ("a = %d b = %d c = %d\n", a, b, c);
(rev)
20              int     c = 1;
(rev) p a=123
Becuse GDB is not at the end of record list, it will destory the
record in the next if write memory that addr is 0x8049680 and size is
4. Do you want GDB do it?(y or [n]) y
$4 = 123
(rev) rev
record: GDB is set to normal debug mode.
(rec) n
22              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec)
a = 123 b = 0 c = 1
23              b = cool ();
(rec) n
a = 126
24              printf ("a = %d b = %d c = %d\n", a, b, c);
(rec) n
a = 126 b = 126 c = 1
26              c += 1;
(rec) c
Continuing.
a = 126 b = 126 c = 2
a = 124 b = 126 c = 2
The next instruction is syscall exit_group. It will make the program
exit. Do you want to pause the program.([y] or n) y
record: record pause the program.
(rec) quit
The program is running.  Exit anyway? (y or n) y
record: record and reverse function is stopped.


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