Re: [PATCH] Implement new `info core mappings' command

Sergio Durigan Junior
2011-11-08T01:49:30Z

Hello,

Thanks for the review. I am still working on the patch, but I have a question.

Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> On Thu, 03 Nov 2011 21:00:39 +0100, Sergio Durigan Junior wrote:
>> + {
>> + filename = s->objfile->name;
>> + break;
>> + }
>
> I think the logic should be opposite. Not to find any part of the core
> segment from some file but ensure the whole segment is mapped from that file.
>
> For ELF core files you should rather check also the ELF segments in
> objfiles->obfd and verify it is fully covered. (I said off-list something
> different, not seeing the code, sorry.) That is verify every byte between
> 0x37aa200000 and 0x37aa222000 belongs to any of the segments from such file.
> Otherwise you may print a filename for some core file segment while only part
> of that segment is from that file (it probably will not happen for normal core
> files but GDB is for debugging problems so it should never give inexact
> results).

This one is giving me headaches... When I implemented the algorithm,
some objfiles were supressed. Anyway, I'm still working on it (and
that's not the question I wanted to ask).

>> +
>> + if (bitness == 32)
>> + printf_filtered ("\t%#10lx %#10lx %#10x %7s\n",
>> + start,
>> + end,
>> + (int) size,
>> + filename ? filename : "");
>
> Could you print all the info readelf -Wa prints? I would use rather readelf
> to see the protection bits, also I guess the file size vs. mem size may
> suggest if it is a data segment or code segment, up to you how to display it,
> even some indicator "from core file" (memsize==filesize) vs. "from local file"
> (filesize==0) vs. "partial" (others, e.g. filesize==0x1000) could be
> enough.

When you say "all the info", what do you mean? I am not sure I
understood your sentence above.

Thanks.