This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] [nto] Improve ABI sniffing.
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: Pedro Alves <palves at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 21 Oct 2015 10:42:45 -0400
- Subject: Re: [PATCH 2/2] [nto] Improve ABI sniffing.
- Authentication-results: sourceware.org; auth=none
- Newsgroups: gmane.comp.gdb.patches
- References: <5621218D dot 6070801 at redhat dot com> <1445364649-12175-1-git-send-email-aristovski at qnx dot com> <1445364649-12175-3-git-send-email-aristovski at qnx dot com> <56275FB2 dot 3050509 at redhat dot com> <5627944D dot 3050900 at qnx dot com> <56279777 dot 5060807 at redhat dot com> <56279EF9 dot 2020200 at qnx dot com> <56279FD8 dot 8010204 at redhat dot com>
On 15-10-21 10:23 AM, Pedro Alves wrote:
> On 10/21/2015 03:14 PM, Aleksandar Ristovski wrote:
>> + name = note + sizeof_Elf_Nhdr;
>> + if (sectsize < namelen + sizeof_Elf_Nhdr
>> + || namelen > sizeof (QNX_NOTE_NAME))
>> + {
>> + /* Can not be QNX note. */
>> + XDELETEVEC (note);
>> + return;
>> + }
>> +
>> + if (namelen == sizeof (QNX_NOTE_NAME)
>> + && 0 == strcmp (name, QNX_NOTE_NAME))
>> + *(enum gdb_osabi *) obj = GDB_OSABI_QNXNTO;
>> +
>> + XDELETEVEC (note);
>
> Looks like these two ifs are now the same as the simpler:
>
> name = note + sizeof_Elf_Nhdr;
> if (sectsize >= namelen + sizeof_Elf_Nhdr
> && namelen == sizeof (QNX_NOTE_NAME)
> && 0 == strcmp (name, QNX_NOTE_NAME))
> *(enum gdb_osabi *) obj = GDB_OSABI_QNXNTO;
>
> XDELETEVEC (note);
>
> OK with that change.
>
> Thanks,
> Pedro Alves
>
Pushed d7161de46af80e460d432d8dbb1c42f8cbacf6dc
With the following fixup:
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -361,15 +361,8 @@ nto_sniff_abi_note_section (bfd *abfd, asection
*sect, void *obj)
bfd_get_section_contents (abfd, sect, note, 0, sectsize);
namelen = (unsigned int) bfd_h_get_32 (abfd, note);
name = note + sizeof_Elf_Nhdr;
- if (sectsize < namelen + sizeof_Elf_Nhdr
- || namelen > sizeof (QNX_NOTE_NAME))
- {
- /* Can not be QNX note. */
- XDELETEVEC (note);
- return;
- }
-
- if (namelen == sizeof (QNX_NOTE_NAME)
+ if (sectsize >= namelen + sizeof_Elf_Nhdr
+ && namelen == sizeof (QNX_NOTE_NAME)
&& 0 == strcmp (name, QNX_NOTE_NAME))
*(enum gdb_osabi *) obj = GDB_OSABI_QNXNTO;
Thank you,
Aleksandar Ristovski