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: --build-id use of elf_obj_tdata


On Mon, Feb 18, 2013 at 04:18:58PM +0100, Jan Kratochvil wrote:
> >    if (!bfd_check_format (abfd, bfd_object)
> >        || bfd_get_flavour (abfd) != bfd_target_elf_flavour
> > -      || elf_tdata (abfd)->build_id == NULL)
> > +      || elf_tdata (abfd)->build_id == NULL
> > +      || elf_tdata (abfd)->build_id->u.i.size == 0)
> 
> Just here I do not see why the new condition 'u.i.size == 0' is needed, even
> if (improbably) the build-id section is empty GDB can handle such 0-length
> struct elf_build_id fine.

See elf-bfd struct elf_build_id_info.  Zero u.i.size says you have the
union u.o field valid.  (I use u.i.size aka u.o.zero instead of
another field to specify the type of union.)  It's true that for gdb
you are always operating on input bfds, so the test is redundant.
Leaving the test as is, removing it, or replacing with an assert are
all valid options.

-- 
Alan Modra
Australia Development Lab, IBM


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