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] |
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:
gdb-6.6-record-0.0.1.patch.bz2
Description: BZip2 compressed data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |