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

Hui Zhu
2009-05-06T02:13:25Z

Hi Eli,

On Wed, May 6, 2009 at 02:41, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Tue, 5 May 2009 21:07:13 +0800
>> From: Hui Zhu <teawater@gmail.com>
>> Cc: Michael Snyder <msnyder@vmware.com>
>>
>> 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)
>
> Does every sbrk call with a negative argument cause an error in
> process record target?  What is the reason for that error?
>
> I'm asking because the message wording sounds very threatening.  It
> probably needs rephrasing, but I need to understand the reasons better
> to suggest how.
>

Yes, I think we need it.
If inferior release some memory, the replay will got big error because
prec will set memory old value to this memory.
But we are lucky, glibc memory manage (malloc and free) try to doesn't
call sbrk to release the memory most of time. I try to let use malloc
and free to let glibc to call sbrk to release the memory, but I
failed.

>>       * gdbarch.sh (process_record_reset): This interface point to
>>       the function that reset the architecture process record and
>>       replay.
>
> I think "reset" is not the best name for this.  How about
> "initialize"?

This interface will be call each time when prec open, so it will reset
the old value.
I think initialize looks like just call once. For example
"_initialize_infcall".

Thanks,
Hui