From 7dcd53a07458941ccf02e280b42f9d68dfb976b0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 16 Feb 2012 21:07:20 +0000 Subject: [PATCH] * 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) : New field. --- gdb/ChangeLog | 12 ++++++++++++ gdb/inferior.h | 5 +++++ gdb/infrun.c | 8 ++++++-- gdb/linux-nat.c | 3 +++ gdb/solib.c | 2 ++ gdb/symfile.c | 7 +++++-- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 261b54eefe7..77d2d7e95f8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2012-02-16 Tom Tromey + + * 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) : New field. + 2012-02-16 Mike Frysinger PR gdb/9734: diff --git a/gdb/inferior.h b/gdb/inferior.h index 7857cbf7249..65abf264b3c 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -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; diff --git a/gdb/infrun.c b/gdb/infrun.c index d3dab9a6eaf..1b2da67fff3 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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)); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 6aab08715d4..3731096d585 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -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); diff --git a/gdb/solib.c b/gdb/solib.c index 84b90190c13..656e8dfa551 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -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; diff --git a/gdb/symfile.c b/gdb/symfile.c index 7529196bbe7..11ddfe82a49 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -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 -- 2.30.2