Re: [PATCH] make gcore dump read-only sections not from files

Michael Snyder
2003-10-09T22:17:19Z

Roland McGrath wrote:

> This works well enough. However, I think that making the determination
> based on the kernel-supplied indication of anonymous vs file-backed may
> make more sense. (Linux 2.6's behavior may be changing in this regard,
> and using that as a determining factor rather than just permission
> bits.) That would require changing the to_find_memory_regions interface
> as I described earlier. Can you comment on that?

I guess you mean this?

> Note that this patch makes gcore dump more regions than the Linux kernel
> does even with my change to its behavior. In particular, read-only
mmap'd
> portions of files are dumped by gcore but not by the kernel. This is a
> real common issue in practice, as your average GNU/Linux process nowadays
> has the large locale-archive file mapped in, and some processes may be
> mapping huge files in read-only. An alternative change would be to
change
> the to_find_memory_regions callback interface to add a flag argument
saying
> whether the memory region came from a file. Then gcore_create_callback
> could simply test !write && !anonymous and be wholly consistent with the
> kernel core dumping (assuming my change to it), and the infrun.c
change is
> not required

Sounds reasonable -- is it portable? A portable testcase for the
testsuite would make the change fairly easy to evaluate / approve.