This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] exec.c: print_section_info() format string fixes


On Dec 20,  6:51pm, Andrew Cagney wrote:

> > On 64-bit targets, I found that the values printed by print_section_info()
> > were not being printed in their entirety.  I've just committed the patch
> > below to fix this problem.
> > 
> > As I look at it now, I see that the FIXME comment can go.  I'll zap it
> > in a moment.
> 
> I don't think the problem is fixed, just improved.  The 08l / 016l test 
> assumes that the address is <= 64 bits.  Hence, I think some sort of 
> FIXME should remain (look for other similar cases).  The bug database 
> contains a suggestion that a new function - 
> local_address_string_custom()(?) be added.

Okay, I'll put some sort of FIXME back.

> > 	* exec.c (print_section_info): Select a format string to use with
> > 	local_hex_string_custom() based upon the value of TARGET_ADDR_BIT.
> > 
> 
> >  	printf_filtered (" @ %s",
> > -			 local_hex_string_custom ((unsigned long) p->the_bfd_section->filepos, "08l"));
> > +			 local_hex_string_custom (p->the_bfd_section->filepos, "08l"));
> 
> BTW, Is the above correct?

Sort of.

The cast is definitely not needed.

I had originally thought that "016l" should also be used for this, but
it makes the output a lot wider than I find desirable.  Ideally, I
guess we'd test to see how large the file is, and then pick a format
string based upon that.  I.e, if the file is bigger than 4GB, we'd use
"016l" for the file position.  But, since I've never seen an
executable or shared library bigger than 4GB, I'm not particularly
worried about it.

However, I'll add a FIXME before that line noting the potential
problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]