From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Cc: Michael Snyder <msnyder@vmware.com>
Subject: [Precord RFA/RFC] Check Linux sys_brk release memory in process record and replay.
Date: Tue, 05 May 2009 13:07:00 -0000 [thread overview]
Message-ID: <daef60380905050607yc499e39n34ac56108225f6ec@mail.gmail.com> (raw)
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
next reply other threads:[~2009-05-05 13:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 13:07 Hui Zhu [this message]
2009-05-05 13:09 ` Hui Zhu
2009-05-05 18:41 ` Eli Zaretskii
2009-05-06 2:13 ` Hui Zhu
2009-05-06 3:14 ` Eli Zaretskii
2009-05-06 3:35 ` Hui Zhu
2009-05-06 18:28 ` Eli Zaretskii
2009-05-07 2:21 ` Hui Zhu
2009-05-07 3:20 ` Eli Zaretskii
2009-05-11 7:06 ` Hui Zhu
2009-06-09 2:17 ` Hui Zhu
2009-06-13 22:56 ` Michael Snyder
2009-06-14 9:26 ` Hui Zhu
2009-06-14 17:42 ` Michael Snyder
2009-06-15 8:04 ` Hui Zhu
2009-06-15 17:52 ` Michael Snyder
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=daef60380905050607yc499e39n34ac56108225f6ec@mail.gmail.com \
--to=teawater@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.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