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: [patch] Fix for PR gdb/10819


>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:

Paul> There is one more call to bsearch in solib-osf.c, but that file appears
Paul> to not be used anymore. Ok to deleted it?

It is referenced from config/alpha/alpha-osf3.mh, so I think it isn't
dead.

I would not worry about this call to bsearch.  It has been there since
revision 1.1 of that file, in 2001.  I think any problem it might
provoke probably would have been encountered by now.

Paul> +  if (cie_table->num_entries == 0)
Paul> +    {
Paul> +      gdb_assert (cie_table->entries == NULL);
Paul> +
Paul> +      /* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
Paul> +	 bsearch be a valid pointer even when the NMEMB argument is 0.
Paul> +
Paul> +	 Passing NULL for BASE and 0 for NMEMB is also known to cause
Paul> +	 Solaris-8 bsearch to call bsearch_cie_cmp with NULL ELEMENT
Paul> +	 (which doesn't expect that and crashes); see PR gdb/10819.
Paul> +
Paul> +	 Therefore, avoid calling bsearch under these conditions.  */

I'm ok with this paragraph but given that this is a C standard thing, it
could really just say something like "The C89 Standard requires BASE to
be non-NULL".

Paul> +  /* See comment in dwarf2-frame.c:find_cie on why this check
Paul> +     is necessary.  */

I'm not ok with this comment; references like this are fragile because
the referenced comment may change without anybody knowing to update this
one.

This patch is ok if you replace the second comment with something
self-contained.

thanks,
Tom


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