From: teawater <teawater@gmail.com>
To: gdb@sources.redhat.com
Subject: GDB record target 0.0.1 for GDB-6.6 release (It make GDB support Reversible Debugging)
Date: Fri, 10 Aug 2007 09:31:00 -0000 [thread overview]
Message-ID: <daef60380708100231n2a926967q2f55b9a2194b982d@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5010 bytes --]
Hi All,
The attachment is a patch for the GDB-6.6 that will add two commands
("record" and "reverse") and a new target "record" to the GDB-6.6.
The command "record" can record running message such as the program pc
register value and some frame message to a record file that default
name is "now.rec".
The target "record" can open this record file and debug the program.
And if the current target is the "record", you can use command
"reverse" set debug to the reverse debug mode. If you set GDB to the
reverse debug mode. The program will reverse run. Most of GDB command
such as "step", "next" and "breakpoint" can be use in this mode.
Maybe the record function can make GDB debug real time program more
easy than before because you can record all the running message when
the real time program cannot be interrupt and debug it after it was
running.
Now, the record function is not very complete. In the future, I will
make it more useful such as record all the register value, record the
memory change and make it only record the running message of some
program code.
Please give me your thought about the "record". Thanks a lot.
To make and install the GDB record target 0.0.1 with GDB-6.6:
tar vxjf gdb-6.6.tar.bz2
bunzip2 gdb-6.6-record-0.0.1.patch.bz2
patch -p0 < gdb-6.6-record-0.0.1.patch
mkdir bgdb
cd bgdb
../gdb-6.6/configure
make
make install
To use the GDB record function:
cat 1.c
void
cool ()
{
printf ("123");
}
int
main(int argc,char *argv[],char *envp[])
{
int a = 0;
printf ("1\n");
cool ();
a = 1;
a += 2;
return (0);
}
gcc -g 1.c
./gdb a.out
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "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 0x804836c: file 1.c, line 9.
(gdb) r
Starting program: /home/qwang/rec/bgdb/gdb/a.out
Breakpoint 1, main (argc=
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x804837b.
1, argv=0xbfffdae4, envp=0xbfffdaec) at 1.c:9
9 int a = 0;
(gdb) rec
Record the paogram running message to the file "now.rec".
1
During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
register ebx (#3) at 0x0075df5f.
123
Program exited normally.
(gdb) quit
./gdb a.out
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "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) target rec
Record the paogram running message to the file "now.rec".
main (argc=Cannot access memory at address 0x8
) at 1.c:9
9 int a = 0;
(gdb) n
11 printf ("1\n");
(gdb)
13 cool ();
(gdb)
15 a = 1;
(gdb) c
Continuing.
0x00738b09 in ?? ()
(gdb) rev
GDB is set to reverse debug mode.
(gdb) b 16
Breakpoint 1 at 0x804838f: file 1.c, line 16.
(gdb) c
Continuing.
Breakpoint 1, main (argc=Cannot access memory at address 0x8
) at 1.c:16
16 a += 2;
(gdb) n
15 a = 1;
(gdb) n
13 cool ();
(gdb) rev
GDB is set to normal debug mode.
(gdb) s
cool () at 1.c:4
4 printf ("123");
(gdb) n
5 }
(gdb)
main (argc=Cannot access memory at address 0x8
) at 1.c:15
15 a = 1;
(gdb) rev
GDB is set to reverse debug mode.
(gdb) s
cool () at 1.c:4
4 printf ("123");
(gdb) s
0x08048347 3 {
(gdb)
main (argc=Cannot access memory at address 0x8
) at 1.c:13
13 cool ();
(gdb) quit
The program is running. Exit anyway? (y or n) y
Thanks,
teawater
[-- Attachment #2: gdb-6.6-record-0.0.1.patch.bz2 --]
[-- Type: application/x-bzip2, Size: 6836 bytes --]
next reply other threads:[~2007-08-10 9:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 9:31 teawater [this message]
2007-08-10 14:41 ` Eli Zaretskii
2007-08-10 14:53 ` Dave Korn
2007-08-10 16:50 ` Eli Zaretskii
2007-08-10 17:24 ` Dave Korn
2007-08-11 9:37 ` Eli Zaretskii
2007-08-11 23:40 ` Dave Korn
2007-08-10 17:37 ` Paul Koning
2007-08-11 9:37 ` Eli Zaretskii
2007-08-10 14:57 ` Andreas Schwab
2007-08-11 2:15 ` teawater
2007-08-10 18:18 ` Daniel Jacobowitz
2007-08-11 2:21 ` teawater
[not found] ` <daef60380708101837l1fcac433paca59ef60345cd60@mail.gmail.com>
2007-08-13 11:21 ` Daniel Jacobowitz
2007-08-13 3:24 Robert Bu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daef60380708100231n2a926967q2f55b9a2194b982d@mail.gmail.com \
--to=teawater@gmail.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox