Re: [RFA, 3 of 3] save/restore process record, part 3 (save/restore)

Hui Zhu
2009-10-19T04:34:25Z

Hi Michael,

+ do_cleanups (old_cleanups);

This line will remove the record file that we just save.

I change some code:
static void
record_save_cleanups (void *data)
{
bfd *obfd = data;
//char *pathname = xstrdup (bfd_get_filename (obfd));
bfd_close (obfd);
//unlink (pathname);
//xfree (pathname);
}

I think you want unlink the gdb_record when save get some error. It
maybe need "discard_cleanups" the old_cleanups and bfd_close (obfd);

After change the code, everything is OK.

I try it in i386 ubuntu. Testsuite is OK too.

Thanks for you are working on it. :)

Thanks,
Hui

On Sun, Oct 18, 2009 at 12:04, Michael Snyder <msnyder@vmware.com> wrote:
> Eli Zaretskii wrote:
>>>
>>> Date: Sat, 17 Oct 2009 15:13:37 -0700
>>> From: Michael Snyder <msnyder@vmware.com>
>>> CC: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
>>>  "teawater@gmail.com" <teawater@gmail.com>
>>>
>>>>> This is the same approach that is used by the "gcore" command.
>>>>> How does "gcore" work with go32, if at all?
>>>>
>>>> It doesn't.  DJGPP cannot generate core files.
>>>
>>> Well, save/restore depends on core files, so I guess
>>> it won't work in go32.
>>
>> DJGPP does not support core files created from a memory image of a
>> running process, but I don't see any reason why bfdcore_write won't
>> work for it.
>
> We don't just do bfdcore_write -- we actually create a core file
> from the memory image, and then add an extra segment to it for
> bfdcore_write to write into.  The core file is an integral part
> of the execution log file.
>
> I forgot to post the accompanying changes to gcore.c with this
> patch.  I'm just about to put them up now that Hui reminded me.
>
>