From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1758 invoked by alias); 5 May 2009 13:07:24 -0000 Received: (qmail 1586 invoked by uid 22791); 5 May 2009 13:07:22 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43,J_CHICKENPOX_44,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.186) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 May 2009 13:07:16 +0000 Received: by ti-out-0910.google.com with SMTP id a1so446564tib.12 for ; Tue, 05 May 2009 06:07:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.110.16.15 with SMTP id 15mr1151tip.53.1241528833357; Tue, 05 May 2009 06:07:13 -0700 (PDT) Date: Tue, 05 May 2009 13:07:00 -0000 Message-ID: Subject: [Precord RFA/RFC] Check Linux sys_brk release memory in process record and replay. From: Hui Zhu To: gdb-patches ml Cc: Michael Snyder Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00078.txt.bz2 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 #include #include #include #include #include #include #include #include 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 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: ... (gdb) start Temporary breakpoint 1 at 0x8048385: file m.c, line 14. Starting program: /home/teawater/gdb/m Temporary breakpoint 1, main (argc=, argv=, envp=) 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 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