Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Gustavo <luis_gustavo@mentor.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch+7.5.1] Work around PR libc/13097 "linux-vdso.so.1" #3
Date: Fri, 23 Nov 2012 11:30:00 -0000	[thread overview]
Message-ID: <50AF5E5C.5030205@mentor.com> (raw)
In-Reply-To: <20121122201737.GA32172@host2.jankratochvil.net>

On 11/22/2012 06:17 PM, Jan Kratochvil wrote:
> Hi,
>
> this is an updated version of
> 	[RFC] Work around PR libc/13097 "linux-vdso.so.1" #2
> 	http://sourceware.org/ml/gdb-patches/2011-08/msg00331.html
> according to the Tom's comment
> 	http://sourceware.org/bugzilla/show_bug.cgi?id=14466#c3
>
> I remembered it when Joel plans 7.5.1 release, the patch is safe enough and it
> is a FAQ at least on IRC.
>
> Fedora does not have this issue with its Fedora glibc but I have it
> reproducible with FSF glibc build:
> 	./gdb -ex r --args $HOME/glibc-root/lib/ld-linux-x86-64.so.2 --library-path $HOME/glibc-root/lib /bin/true
> 	Starting program: /home/.../glibc-root/lib/ld-linux-x86-64.so.2 --library-path /home/.../glibc-root/lib /bin/true
> 	warning: Could not load shared library symbols for linux-vdso.so.1.
> 	Do you need "set solib-search-path" or "set sysroot"?
> 	[Inferior 1 (process 31807) exited normally]
>
> So there is no testcase as I do not know a real OS where it fails (it probably
> fails on Ubuntu AFAIK).
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.
>
>
> Thanks,
> Jan
>
>
> gdb/
> 2012-11-22  Jan Kratochvil<jan.kratochvil@redhat.com>
>
> 	* gdbarch.c: Regenerate.
> 	* gdbarch.h: Regenerate.
> 	* gdbarch.sh (solib_file_not_found_is_ok): New.
> 	Include solib.h.
> 	* linux-tdep.c (linux_solib_file_not_found_is_ok): New function.
> 	(linux_init_abi): Install it.
> 	* solib.c (default_solib_file_not_found_is_ok): New function.
> 	(update_solib_list): New variable gdbarch.  Substitute it for variable
> 	ops.  Call gdbarch_solib_file_not_found_is_ok.
> 	* solib.h (default_solib_file_not_found_is_ok): New declaration.
>
> diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
> index 81a70b0..76f0ec9 100755
> --- a/gdb/gdbarch.sh
> +++ b/gdb/gdbarch.sh
> @@ -955,6 +955,10 @@ M:void:info_proc:char *args, enum info_proc_what what:args, what
>   # inspected when the symbol search was requested.
>   m:void:iterate_over_objfiles_in_search_order:iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0
>
> +# Return non-zero if it is OK we failed to locate shared library file.
> +# For example these libraries may exist only in memory (vDSO).
> +f:int:solib_file_not_found_is_ok:const char *so_name:so_name:0:default_solib_file_not_found_is_ok::0
> +
>   EOF
>   }
>
> @@ -1411,6 +1415,7 @@ cat<<EOF
>   #include "observer.h"
>   #include "regcache.h"
>   #include "objfiles.h"
> +#include "solib.h"
>
>   /* Static function declarations */
>
> diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
> index dbeed36..c4f7bdd 100644
> --- a/gdb/linux-tdep.c
> +++ b/gdb/linux-tdep.c
> @@ -941,6 +941,17 @@ linux_make_corefile_notes_1 (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
>   				      linux_collect_thread_registers);
>   }
>
> +/* Newer glibc no longer clears the Linux vDSO name to "" empty string.  */
> +
> +static int
> +linux_solib_file_not_found_is_ok (const char *so_name)
> +{
> +  return (strcmp (so_name, "linux-gate.so.1") == 0
> +	  || strcmp (so_name, "linux-vdso.so.1") == 0
> +	  || strcmp (so_name, "linux-vdso32.so.1") == 0
> +	  || strcmp (so_name, "linux-vdso64.so.1") == 0);
> +}
> +
>   /* To be called from the various GDB_OSABI_LINUX handlers for the
>      various GNU/Linux architectures and machine types.  */
>
> @@ -953,6 +964,8 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
>     set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes_1);
>     set_gdbarch_has_shared_address_space (gdbarch,
>   					linux_has_shared_address_space);
> +  set_gdbarch_solib_file_not_found_is_ok (gdbarch,
> +					  linux_solib_file_not_found_is_ok);
>   }
>
>   /* Provide a prototype to silence -Wmissing-prototypes.  */
> diff --git a/gdb/solib.c b/gdb/solib.c
> index db3842a..7976679 100644
> --- a/gdb/solib.c
> +++ b/gdb/solib.c
> @@ -642,6 +642,15 @@ solib_used (const struct so_list *const known)
>     return 0;
>   }
>
> +/* By default GDB complains on any missing shared library file via
> +   gdbarch_solib_file_not_found_is_ok.  */
> +
> +int
> +default_solib_file_not_found_is_ok (const char *so_name)
> +{
> +  return 0;
> +}
> +
>   /* Synchronize GDB's shared object list with inferior's.
>
>      Extract the list of currently loaded shared objects from the
> @@ -668,7 +677,8 @@ solib_used (const struct so_list *const known)
>   static void
>   update_solib_list (int from_tty, struct target_ops *target)
>   {
> -  struct target_so_ops *ops = solib_ops (target_gdbarch ());
> +  struct gdbarch *gdbarch = target_gdbarch ();
> +  struct target_so_ops *ops = solib_ops (gdbarch);
>     struct so_list *inferior = ops->current_sos();
>     struct so_list *gdb, **gdb_link;
>
> @@ -798,7 +808,9 @@ update_solib_list (int from_tty, struct target_ops *target)
>   	  TRY_CATCH (e, RETURN_MASK_ERROR)
>   	    {
>   	      /* Fill in the rest of the `struct so_list' node.  */
> -	      if (!solib_map_sections (i))
> +	      if (!solib_map_sections (i)
> +	&&  !gdbarch_solib_file_not_found_is_ok (gdbarch,
> +							  i->so_original_name))
>   		{
>   		  not_found++;
>   		  if (not_found_filename == NULL)
> diff --git a/gdb/solib.h b/gdb/solib.h
> index 7a2ff84..04510b8 100644
> --- a/gdb/solib.h
> +++ b/gdb/solib.h
> @@ -91,4 +91,6 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
>   								      void *),
>   						    void *data);
>
> +extern int default_solib_file_not_found_is_ok (const char *so_name);
> +
>   #endif /* SOLIB_H */
>

Thansk for the patch.

I don't know about the others, but i find the name 
"solib_not_found_is_ok" a little odd. What about "is_ignored_dso", or 
"ignored_solib_p" or something in those veins?

What about linux-gate(32|64).so?

Regards,
Luis


  reply	other threads:[~2012-11-23 11:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 20:17 Jan Kratochvil
2012-11-23 11:30 ` Luis Gustavo [this message]
2012-11-23 11:41   ` Jan Kratochvil
2012-11-23 11:59     ` Luis Machado
2012-11-23 12:03 ` Pedro Alves
2012-11-23 12:40   ` Jan Kratochvil
2012-11-23 14:05     ` Luis Machado
2012-11-23 14:07       ` Jan Kratochvil
2012-11-23 16:01     ` Pedro Alves
2012-11-23 16:12       ` Mark Kettenis
2012-11-23 16:17         ` Jan Kratochvil
2012-11-23 16:23         ` Pedro Alves
2012-11-23 17:28       ` Joel Brobecker
2012-11-23 18:17         ` Jan Kratochvil
2012-11-23 18:22           ` Pedro Alves
2012-11-27 21:58       ` Mike Frysinger
2012-11-27 23:00         ` Matt Rice
2012-11-28  1:12         ` Pedro Alves
2012-11-28 20:39           ` Mike Frysinger
2012-11-28 22:44           ` Jan Kratochvil
2012-11-29  1:07             ` Mike Frysinger
2012-11-23 12:43   ` Mark Kettenis
2012-11-23 16:30 ` H.J. Lu
2012-11-23 18:19   ` Pedro Alves
2012-11-23 18:43     ` Jan Kratochvil
2012-11-25 18:15       ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50AF5E5C.5030205@mentor.com \
    --to=luis_gustavo@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox