This is the mail archive of the gdb-patches@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.2 for GDB-6.7.1 release(It make GDB support I386-Linux Reversible Debugging)


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.
Record 0.1.2 in the previous version on the basis of an increase of
the I386-Linux system call support.
The next step is to raise the speed of record.
I hope that you put to me valuable advice, for example, on what
function more demand, which is not convenient for them to use
function. Thanks a lot.
More information can be obtained want to
http://sourceforge.net/projects/record/. You can get the patch and the
GDB that patched in there.

Record patch add 3 commands to GDB:
record(rec) Use to start the record and reverse function.
stoprecord(srec) Use to stop the record and reverse function.
reverse(rev) When the record and reverse function is started, It use
to set GDB to the reverse debug mode or the normal debug mode. When
GDB is set to the reverse debug mode, you can use GDB commands (Such
as continue, step, print) to control and debug the program.

To make and install the GDB record patch 0.1.1 with GDB-6.7.1:
tar vxjf gdb-6.7.1.tar.bz2
patch -p0 < gdb-6.7.1-record-0.1.2.patch
mkdir bgdb
cd bgdb
../gdb-6.7.1/configure
make
make install
gdbrecord

To make and install the GDB-6.7.1-record:
tar vxjf gdb-6.7.1-record-0.1.2.tar.bz2
mkdir bgdb
cd bgdb
../gdb-6.7.1-record/configure
make
make install
gdbrecord

The following is how to use the record:
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
gdbrecord a.out
GNU gdb 6.7.1
Record 0.1.2
Copyright (C) 2007 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"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
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]
/home/qwang/rec/bgdb/gdb/.gdbinit:8: Error in sourced command file:
No breakpoint number 0.
(gdb) quit
[qwang@venus gdb]$ clear
[qwang@venus gdb]$ ./gdbrecord a.out
GNU gdb 6.7.1
Record 0.1.2
Copyright (C) 2007 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"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
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]
/home/qwang/rec/bgdb/gdb/.gdbinit:8: Error in sourced command file:
No breakpoint number 0.
(gdb) b main
Breakpoint 1 at 0x804838b: file 1.c, line 19.
(gdb) r
Starting program: /home/qwang/rec/bgdb/gdb/a.out

Breakpoint 1, main () at 1.c:19
19 int b = 0;
(gdb) rec
record: record and reverse function is started.
(gdb) n
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x80483aa.
20 int c = 1;
(gdb)
22 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
a = 0 b = 0 c = 1
During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
register ebx (#3) at 0x00ccff5f.
23 b = cool ();
(gdb)
a = 3
24 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
a = 3 b = 3 c = 1
26 c += 1;
(gdb) c
Continuing.
a = 3 b = 3 c = 2
a = 1 b = 3 c = 2
The next instruction is syscall munmap. It will free the memory addr =
0xb75f7000 len = 4096. Do you want to pause the program.([y] or n)
0x00cda33f in munmap ()
from /lib/tls/libc.so.6
record: record pause the program.
(gdb) rev
record: GDB is set to reverse debug mode.
(gdb) s
Single stepping until exit from function munmap,
which has no line number information.
main () at 1.c:32
32 }
(gdb) n
31 return (0);
(gdb)
0x0804840e 29 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
28 a -= 2;
(gdb)
0x080483ee 27 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
0x080483d6 26 c += 1;
(gdb)
0x080483d0 24 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
0x080483b7 23 b = cool ();
(gdb) s
cool () at 1.c:10
10 a += 3;
(gdb) n
0x08048365 9 {
(gdb)
main () at 1.c:23
23 b = cool ();
(gdb)
0x080483af 22 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
20 int c = 1;
(gdb) rev
record: GDB is set to normal debug mode.
(gdb) s
22 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
23 b = cool ();
(gdb)
cool () at 1.c:10
10 a += 3;
(gdb)
12 cool2();
(gdb)
cool2 () at 1.c:5
5 printf ("a = %d\n", a);
(gdb)
6 }
(gdb)
cool () at 1.c:14
14 return (a);
(gdb)
15 }
(gdb)
main () at 1.c:24
24 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
26 c += 1;
(gdb)
27 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
28 a -= 2;
(gdb)
29 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb)
31 return (0);
(gdb) b 22
Breakpoint 2 at 0x8048399: file 1.c, line 22.
(gdb) rev
record: GDB is set to reverse debug mode.
(gdb) c
Continuing.

Breakpoint 2, main () at 1.c:22
22 printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb) p a=100
$1 = 100
(gdb) p b=200
$2 = 200
(gdb) p c=300
$3 = 300
(gdb) srec
record: record and reverse function is stopped.
(gdb) rec
record: record and reverse function is started.
(gdb) c
Continuing.
a = 100 b = 200 c = 300
a = 103
a = 103 b = 103 c = 300
a = 103 b = 103 c = 301
a = 101 b = 103 c = 301
The next instruction is syscall munmap. It will free the memory addr =
0xb75f6000 len = 4096. Do you want to pause the program.([y] or n)
0x00cda33f in munmap ()
from /lib/tls/libc.so.6
record: record pause the program.
(gdb) 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]