This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] Special case NULL when using printf's %s format
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Fri, 16 Feb 2018 12:08:27 +0000
- Subject: Re: [RFA 3/3] Special case NULL when using printf's %s format
- Authentication-results: sourceware.org; auth=none
- References: <20180215205001.337-1-tom@tromey.com> <20180215205001.337-4-tom@tromey.com>
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.
Thanks,
Pedro Alves