This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfa] Shared object matching for solib-som.c
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Randolph Chung <randolph at tausq dot org>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 19 Apr 2006 11:15:20 +0300
- Subject: Re: [rfa] Shared object matching for solib-som.c
- References: <44458D3D.4030506@tausq.org>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Wed, 19 Apr 2006 09:07:09 +0800
> From: Randolph Chung <randolph@tausq.org>
>
> @@ -787,7 +794,21 @@ som_solib_section_offsets (struct objfil
> {
> /* Oh what a pain! We need the offsets before so_list->objfile
> is valid. The BFDs will never match. Make a best guess. */
> - if (strstr (objfile->name, so_list->so_name))
> + char *p1, *p2;
> +
> + p1 = strrchr(objfile->name, '/');
> + p2 = strrchr(so_list->so_name, '/');
> +
> + if (p1)
> + p1++;
> + else
> + p1 = objfile->name;
> + if (p2)
> + p2++;
> + else
> + p2 = so_list->so_name;
> +
> + if (strcmp (p1, p2) == 0)
> {
> asection *private_section;
Please don't use literal slash characters in GDB sources: they are
non-portable. AFAICS, you simply need to use lbasename here, on both
file names.