This is the mail archive of the gdb-patches@sourceware.org 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: [RFA 3/3] Special case NULL when using printf's %s format


On 02/16/2018 12:08 PM, Pedro Alves wrote:
> On 02/15/2018 08:50 PM, Tom Tromey wrote:
>> This changes the printf command's %s and %ls formats to special-case
>> NULL, and print "(null)" for these.  This is PR cli/14977.  This
>> behavior seems a bit friendlier; I was undecided on whether other
>> invalid pointers should be handled specially somehow, so for the time
>> being I've left those out.
> 
> A question here is what to do on targets that actually map things at
> address zero.  IIRC, some ARM chips do that.  For such ports, I think you'd
> want to be able to read/print that memory.  I thought we had a gdbarch hook
> for that, but I'm not finding it right now.  Maybe I was thinking of
> has_section_at_zero in dwarf2read.c.

Then again, I don't think it's likely that programs map
strings at 0 (I think it's more like interrupt vectors), so for %s,
it's likely that nobody would miss printing 0 as a string.

So with that in mind, this is fine with me.

Thanks,
Pedro Alves


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