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]

Re: [Precord RFA/RFC] Check Linux sys_brk release memory in process record and replay.


Sorry I forget the patch.

On Tue, May 5, 2009 at 21:07, Hui Zhu <teawater@gmail.com> wrote:
> Hi guys,
>
> This patch will make linux-record can check if the sys_brk will
> release the memory or not. ?If memory will be released, gdb will query
> to user.
>
> For example:
> cat m.c
> #include <sys/types.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <unistd.h>
> #include <errno.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <stdint.h>
>
> int
> main(int argc,char *argv[],char *envp[])
> {
> ? ? ? ?sbrk (10);
> ? ? ? ?sbrk (-10);
>
> ? ? ? ?return (0);
> }
>
> gdb m
> GNU gdb (GDB) 6.8.50.20090505-cvs
> Copyright (C) 2009 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".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> (gdb) start
> Temporary breakpoint 1 at 0x8048385: file m.c, line 14.
> Starting program: /home/teawater/gdb/m
>
> Temporary breakpoint 1, main (argc=<value optimized out>, argv=<value
> optimized out>,
> ? ?envp=<value optimized out>) at m.c:14
> 14 ? ? ? ? ? ? ?sbrk (10);
> (gdb) record
> (gdb) n
> 15 ? ? ? ? ? ? ?sbrk (-10);
> (gdb)
> The next instruction is syscall brk. ?It will release the memory that
> will cause process record target get error. ?Do you want to stop the
> inferior?([y] or n)
> Process record: inferior program stopped.
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0xb7fe3405 in __kernel_vsyscall ()
>
>
> 2009-05-05 ?Hui Zhu ?<teawater@gmail.com>
>
> ? ? ? ?Add a architecture process record and replay reset interface
> ? ? ? ?and i386 and i386-linux record and replay reset functions.
>
> ? ? ? ?* gdbarch.sh (process_record_reset): This interface point to
> ? ? ? ?the function that reset the architecture process record and
> ? ? ? ?replay.
> ? ? ? ?* record.c (record_open): Call process_record_reset.
> ? ? ? ?* i386-tdep.c (i386_linux_record_reset): New function. Call
> ? ? ? ?tdep interface "i386_record_reset".
> ? ? ? ?(i386_gdbarch_init): Set "i386_linux_record_reset" to GDBARCH
> ? ? ? ?"process_record_reset" interface.
> ? ? ? ?* i386-tdep.h (gdbarch_tdep): New function pointer
> ? ? ? ?i386_record_reset that point to the function that can reset
> ? ? ? ?the process record.
> ? ? ? ?* i386-linux-tdep.c (i386_linux_record_reset): New function.
> ? ? ? ?Call record_linux_reset.
> ? ? ? ?(i386_linux_init_abi): Set "i386_linux_record_reset" to
> ? ? ? ?"i386_record_reset".
>
> ? ? ? ?Check Linux sys_brk release memory in process record
> ? ? ? ?and replay.
>
> ? ? ? ?* linux-record.c (record_top_of_heap): New variable.
> ? ? ? ?The current top of heap of inferior.
> ? ? ? ?(record_linux_reset): New function. ?The reset function of
> ? ? ? ?Linux process record and replay. ?It will reset the value
> ? ? ? ?of record_top_of_heap.
> ? ? ? ?(record_linux_system_call): Add the sys_brk check code.
> ? ? ? ?If this sys_brk will release the memory, query to user.
> ? ? ? ?* linux-record.h (record_linux_reset): New function extern.
>
>
> Thanks,
> Hui
>

Attachment: check-brk.txt
Description: Text document


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