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

Jan Kratochvil
2011-11-08T21:47:48Z

On Tue, 08 Nov 2011 02:48:54 +0100, Sergio Durigan Junior wrote:
> >> + 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.

Currently you display:
Start Addr End Addr Size objfile
0x37aa200000 0x37aa222000 0x22000 /lib64/ld-2.14.90.so
FYI max width:
0xffffffffffffffff 0xffffffffffffffff

I see now the formatstring is a copy from `info proc mappings'.

The readelf -Wl output is:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0xa6c000 0x00007f9623a5b000 0x0000000000000000 0x001000 0x015000 R E 0x1000

Flg must be there. It suggests whether that part is about segment with .text
or with .data etc.

Somehow both FileSiz MemSiz should be there. I would find OK (this is RFC) to
put there just MemSiz together with single-character column:
C if FileSiz == MemSiz
I if FileSiz == pagesize (that is only the build-id header is present)
F if FileSiz == 0
? otherwise
But not sure if one gets used to this format.

It is questionable whether Offset should be there. I use that value but
probably when one starts editing/searching etc. corefile one can run separate
readelf anyway and it would be just redundant in the GDB output. So I do not
want Offset there.

32:
printf_filtered ("\t%#10lx %#10lx %#10x %7s\n",
I think \t should be removed, screen width is scarce.
%7s should be %s.

64:
printf_filtered (" %#18lx %#18lx %#10x %7s\n",
I think " " should be removed, screen width is scarce.
%7s should be %s.

Feel free to disagree, this is more about bikeshedding, just expressing my
opinions with reasons for discussion.

Thanks,
Jan