Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB record target 0.0.1 for GDB-6.6 release (It make GDB support Reversible Debugging)
@ 2007-08-10  9:31 teawater
  2007-08-10 14:41 ` Eli Zaretskii
  2007-08-10 18:18 ` Daniel Jacobowitz
  0 siblings, 2 replies; 15+ messages in thread
From: teawater @ 2007-08-10  9:31 UTC (permalink / raw)
  To: gdb

[-- 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 --]

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: GDB record target 0.0.1 for GDB-6.6 release (It make GDB support Reversible Debugging)
@ 2007-08-13  3:24 Robert Bu
  0 siblings, 0 replies; 15+ messages in thread
From: Robert Bu @ 2007-08-13  3:24 UTC (permalink / raw)
  To: gdb

> ------------------------------------------------------------------------
>
> 主题:
> Re: GDB record target 0.0.1 for GDB-6.6 release (It make GDB support
> Reversible Debugging)
> 发件人:
> Daniel Jacobowitz <drow@false.org>
> 日期:
> Fri, 10 Aug 2007 14:18:17 -0400
> 收件人:
> teawater <teawater@gmail.com>
>
> 收件人:
> teawater <teawater@gmail.com>
> 抄送:
> gdb@sources.redhat.com
>
>
> On Fri, Aug 10, 2007 at 05:31:51PM +0800, teawater wrote:
>> 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.
>
> I took a look at your patch.  The record command single steps the
> program until it exits, right?  That will not be very useful for real
> time programs, because it will be extraordinarily slow the first time.
>
> You might want to take a look at my paper in this year's GCC Summit
> proceedings:
>
>   http://gcc.gnu.org/wiki/HomePage?action=AttachFile&do=get&target=GCC2007-Proceedings.pdf
>
> We'll be publishing the code for "reverse-step" using qemu soon.

The qemu method is appropriate for native-debugging. However, it's
really not possible for remote-debugging, in which case the mothod of
this patch may apply if we can put up with the poor performance.

> We're not trying to hold on to it, especially - just haven't found the
> time yet to submit it.  This is basically similar to what you've done,
> except higher performance.
>
> Actually, your work also reminds me of Amber:
>   http://weblogs.mozillazine.org/roc/archives/2006/12/more_about_ambe.html
>
>
>

robert

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-08-13 11:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10  9:31 GDB record target 0.0.1 for GDB-6.6 release (It make GDB support Reversible Debugging) teawater
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox