* symfile.c (symbol_file_add_main_1): Use inferior's
authorTom Tromey <tromey@redhat.com>
Thu, 16 Feb 2012 21:07:20 +0000 (21:07 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 16 Feb 2012 21:07:20 +0000 (21:07 +0000)
symfile_flags.
* solib.c (solib_read_symbols): Use inferior's symfile_flags.
* linux-nat.c (linux_child_follow_fork): Set symfile_flags on
inferior.
* infrun.c (handle_vfork_child_exec_or_exit): Set symfile_flags on
inferior.
(follow_exec): Use inferior's symfile_flags.
* inferior.h (struct inferior) <symfile_flags>: New field.

gdb/ChangeLog
gdb/inferior.h
gdb/infrun.c
gdb/linux-nat.c
gdb/solib.c
gdb/symfile.c

index 261b54e..77d2d7e 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-16  Tom Tromey  <tromey@redhat.com>
+
+       * symfile.c (symbol_file_add_main_1): Use inferior's
+       symfile_flags.
+       * solib.c (solib_read_symbols): Use inferior's symfile_flags.
+       * linux-nat.c (linux_child_follow_fork): Set symfile_flags on
+       inferior.
+       * infrun.c (handle_vfork_child_exec_or_exit): Set symfile_flags on
+       inferior.
+       (follow_exec): Use inferior's symfile_flags.
+       * inferior.h (struct inferior) <symfile_flags>: New field.
+
 2012-02-16  Mike Frysinger  <vapier@gentoo.org>
 
        PR gdb/9734:
index 7857cbf..65abf26 100644 (file)
@@ -516,6 +516,11 @@ struct inferior
      if any catching is necessary.  */
   int total_syscalls_count;
 
+  /* Default flags to pass to the symbol reading functions.  These are
+     used whenever a new objfile is created.  The valid values come
+     from enum symfile_add_flags.  */
+  int symfile_flags;
+
   /* Per inferior data-pointers required by other GDB modules.  */
   void **data;
   unsigned num_data;
index d3dab9a..1b2da67 100644 (file)
@@ -739,6 +739,7 @@ handle_vfork_child_exec_or_exit (int exec)
          pspace = add_program_space (maybe_new_address_space ());
          set_current_program_space (pspace);
          inf->removable = 1;
+         inf->symfile_flags = SYMFILE_NO_READ;
          clone_program_space (pspace, inf->vfork_parent->pspace);
          inf->pspace = pspace;
          inf->aspace = pspace->aspace;
@@ -900,10 +901,13 @@ follow_exec (ptid_t pid, char *execd_pathname)
      solib_create_inferior_hook below.  breakpoint_re_set would fail to insert
      the breakpoints with the zero displacement.  */
 
-  symbol_file_add (execd_pathname, SYMFILE_MAINLINE | SYMFILE_DEFER_BP_RESET,
+  symbol_file_add (execd_pathname,
+                  (inf->symfile_flags
+                   | SYMFILE_MAINLINE | SYMFILE_DEFER_BP_RESET),
                   NULL, 0);
 
-  set_initial_language ();
+  if ((inf->symfile_flags & SYMFILE_NO_READ) == 0)
+    set_initial_language ();
 
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
index 6aab087..3731096 100644 (file)
@@ -59,6 +59,7 @@
 #include "solib.h"
 #include "linux-osdata.h"
 #include "linux-tdep.h"
+#include "symfile.h"
 
 #ifndef SPUFS_MAGIC
 #define SPUFS_MAGIC 0x23c9b64e
@@ -723,6 +724,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
          child_lp = add_lwp (inferior_ptid);
          child_lp->stopped = 1;
          child_lp->last_resume_kind = resume_stop;
+         child_inf->symfile_flags = SYMFILE_NO_READ;
 
          /* If this is a vfork child, then the address-space is
             shared with the parent.  */
@@ -928,6 +930,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
          child_inf->aspace = new_address_space ();
          child_inf->pspace = add_program_space (child_inf->aspace);
          child_inf->removable = 1;
+         child_inf->symfile_flags = SYMFILE_NO_READ;
          set_current_program_space (child_inf->pspace);
          clone_program_space (child_inf->pspace, parent_pspace);
 
index 84b9019..656e8df 100644 (file)
@@ -592,6 +592,8 @@ solib_read_symbols (struct so_list *so, int flags)
     {
       volatile struct gdb_exception e;
 
+      flags |= current_inferior ()->symfile_flags;
+
       TRY_CATCH (e, RETURN_MASK_ERROR)
        {
          struct section_addr_info *sap;
index 7529196..11ddfe8 100644 (file)
@@ -1246,14 +1246,17 @@ symbol_file_add_main (char *args, int from_tty)
 static void
 symbol_file_add_main_1 (char *args, int from_tty, int flags)
 {
-  const int add_flags = SYMFILE_MAINLINE | (from_tty ? SYMFILE_VERBOSE : 0);
+  const int add_flags = (current_inferior ()->symfile_flags
+                        | SYMFILE_MAINLINE | (from_tty ? SYMFILE_VERBOSE : 0));
+
   symbol_file_add (args, add_flags, NULL, flags);
 
   /* Getting new symbols may change our opinion about
      what is frameless.  */
   reinit_frame_cache ();
 
-  set_initial_language ();
+  if ((flags & SYMFILE_NO_READ) == 0)
+    set_initial_language ();
 }
 
 void