Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/gnu/dist/toolchain/gdb Comment out token after #endif.



details:   https://anonhg.NetBSD.org/src/rev/d9d20759138d
branches:  nathanw_sa
changeset: 505544:d9d20759138d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Jan 18 04:15:03 2002 +0000

description:
Comment out token after #endif.

diffstat:

 gnu/dist/toolchain/gdb/solib.c |  2158 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 2158 insertions(+), 0 deletions(-)

diffs (truncated from 2162 to 300 lines):

diff -r 79098af40536 -r d9d20759138d gnu/dist/toolchain/gdb/solib.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/gnu/dist/toolchain/gdb/solib.c    Fri Jan 18 04:15:03 2002 +0000
@@ -0,0 +1,2158 @@
+/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+
+#include "defs.h"
+
+/* This file is only compilable if link.h is available. */
+
+#ifdef HAVE_LINK_H
+
+#include <sys/types.h>
+#include <signal.h>
+#include "gdb_string.h"
+#include <sys/param.h>
+#include <fcntl.h>
+
+#ifndef SVR4_SHARED_LIBS
+ /* SunOS shared libs need the nlist structure.  */
+#include <a.out.h>
+#else
+#include "elf/external.h"
+#include "elf/common.h"
+#endif
+
+#include <link.h>
+
+#include "symtab.h"
+#include "bfd.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "gdbcore.h"
+#include "command.h"
+#include "target.h"
+#include "frame.h"
+#include "gdb_regex.h"
+#include "inferior.h"
+#include "environ.h"
+#include "language.h"
+#include "gdbcmd.h"
+
+#define MAX_PATH_SIZE 512      /* FIXME: Should be dynamic */
+
+/* On SVR4 systems, a list of symbols in the dynamic linker where
+   GDB can try to place a breakpoint to monitor shared library
+   events.
+
+   If none of these symbols are found, or other errors occur, then
+   SVR4 systems will fall back to using a symbol as the "startup
+   mapping complete" breakpoint address.  */
+
+#ifdef SVR4_SHARED_LIBS
+static char *solib_break_names[] =
+{
+  "r_debug_state",
+  "_r_debug_state",
+  "_dl_debug_state",
+  "rtld_db_dlactivity",
+  "_rtld_debug_state",
+  NULL
+};
+#endif
+
+#define BKPT_AT_SYMBOL 1
+
+#if defined (BKPT_AT_SYMBOL) && defined (SVR4_SHARED_LIBS)
+static char *bkpt_names[] =
+{
+#ifdef SOLIB_BKPT_NAME
+  SOLIB_BKPT_NAME,             /* Prefer configured name if it exists. */
+#endif
+  "_start",
+  "main",
+  NULL
+};
+#endif
+
+/* Symbols which are used to locate the base of the link map structures. */
+
+#ifndef SVR4_SHARED_LIBS
+static char *debug_base_symbols[] =
+{
+  "_DYNAMIC",
+  "_DYNAMIC__MGC",
+  NULL
+};
+#endif
+
+static char *main_name_list[] =
+{
+  "main_$main",
+  NULL
+};
+
+/* local data declarations */
+
+/* Macro to extract an address from a solib structure.
+   When GDB is configured for some 32-bit targets (e.g. Solaris 2.7
+   sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is
+   64 bits.  We have to extract only the significant bits of addresses
+   to get the right address when accessing the core file BFD.  */
+
+#define SOLIB_EXTRACT_ADDRESS(member) \
+  extract_address (&member, sizeof (member))
+
+#ifndef SVR4_SHARED_LIBS
+
+#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_addr))
+#define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_next))
+#define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_name))
+/* Test for first link map entry; first entry is a shared library. */
+#define IGNORE_FIRST_LINK_MAP_ENTRY(so) (0)
+static struct link_dynamic dynamic_copy;
+static struct link_dynamic_2 ld_2_copy;
+static struct ld_debug debug_copy;
+static CORE_ADDR debug_addr;
+static CORE_ADDR flag_addr;
+
+#else /* SVR4_SHARED_LIBS */
+
+#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_addr))
+#define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_next))
+#define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_name))
+#ifdef __mips__
+#define LM_OFFS(so) (u_int32_t)((so) -> lm.l_offs)
+#endif
+/* Test for first link map entry; first entry is the exec-file. */
+#define IGNORE_FIRST_LINK_MAP_ENTRY(so) \
+  (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_prev) == 0)
+static struct r_debug debug_copy;
+char shadow_contents[BREAKPOINT_MAX];  /* Stash old bkpt addr contents */
+
+#endif /* !SVR4_SHARED_LIBS */
+
+struct so_list
+  {
+    /* The following fields of the structure come directly from the
+       dynamic linker's tables in the inferior, and are initialized by
+       current_sos.  */
+
+    struct so_list *next;      /* next structure in linked list */
+    struct link_map lm;                /* copy of link map from inferior */
+    CORE_ADDR lmaddr;          /* addr in inferior lm was read from */
+
+    /* Shared object file name, exactly as it appears in the
+       inferior's link map.  This may be a relative path, or something
+       which needs to be looked up in LD_LIBRARY_PATH, etc.  We use it
+       to tell which entries in the inferior's dynamic linker's link
+       map we've already loaded.  */
+    char so_original_name[MAX_PATH_SIZE];
+
+    /* shared object file name, expanded to something GDB can open */
+    char so_name[MAX_PATH_SIZE];
+
+    /* The following fields of the structure are built from
+       information gathered from the shared object file itself, and
+       are initialized when we actually add it to our symbol tables.  */
+
+    bfd *abfd;
+    CORE_ADDR lmend;           /* upper addr bound of mapped object */
+    char symbols_loaded;       /* flag: symbols read in yet? */
+    char from_tty;             /* flag: print msgs? */
+    struct objfile *objfile;   /* objfile for loaded lib */
+    struct section_table *sections;
+    struct section_table *sections_end;
+    struct section_table *textsection;
+  };
+
+static struct so_list *so_list_head;   /* List of known shared objects */
+static CORE_ADDR debug_base;   /* Base of dynamic linker structures */
+static CORE_ADDR breakpoint_addr;      /* Address where end bkpt is set */
+
+static int solib_cleanup_queued = 0;   /* make_run_cleanup called */
+
+extern int
+fdmatch PARAMS ((int, int));   /* In libiberty */
+
+/* Local function prototypes */
+
+static void
+do_clear_solib PARAMS ((PTR));
+
+static int
+match_main PARAMS ((char *));
+
+static void
+special_symbol_handling PARAMS ((void));
+
+static void
+sharedlibrary_command PARAMS ((char *, int));
+
+static int
+enable_break PARAMS ((void));
+
+static void
+info_sharedlibrary_command PARAMS ((char *, int));
+
+static int symbol_add_stub PARAMS ((PTR));
+
+static CORE_ADDR
+  first_link_map_member PARAMS ((void));
+
+static CORE_ADDR
+  locate_base PARAMS ((void));
+
+static int solib_map_sections PARAMS ((PTR));
+
+#ifdef SVR4_SHARED_LIBS
+
+static CORE_ADDR
+  elf_locate_base PARAMS ((void));
+
+#else
+
+static struct so_list *current_sos (void);
+static void free_so (struct so_list *node);
+
+static int
+disable_break PARAMS ((void));
+
+static void
+allocate_rt_common_objfile PARAMS ((void));
+
+static void
+solib_add_common_symbols (CORE_ADDR);
+
+#endif
+
+void _initialize_solib PARAMS ((void));
+
+/* If non-zero, this is a prefix that will be added to the front of the name
+   shared libraries with an absolute filename for loading.  */
+static char *solib_absolute_prefix = NULL;
+
+/* If non-empty, this is a search path for loading non-absolute shared library
+   symbol files.  This takes precedence over the environment variables PATH
+   and LD_LIBRARY_PATH.  */
+static char *solib_search_path = NULL;
+
+/*
+
+   LOCAL FUNCTION
+
+   solib_map_sections -- open bfd and build sections for shared lib
+
+   SYNOPSIS
+
+   static int solib_map_sections (struct so_list *so)
+
+   DESCRIPTION
+
+   Given a pointer to one of the shared objects in our list
+   of mapped objects, use the recorded name to open a bfd
+   descriptor for the object, build a section table, and then
+   relocate all the section addresses by the base address at
+   which the shared object was mapped.
+
+   FIXMES
+
+   In most (all?) cases the shared object file name recorded in the
+   dynamic linkage tables will be a fully qualified pathname.  For
+   cases where it isn't, do we really mimic the systems search
+   mechanism correctly in the below code (particularly the tilde
+   expansion stuff?).
+ */
+
+static int
+solib_map_sections (arg)
+     PTR arg;
+{
+  struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
+  char *filename;
+  char *scratch_pathname;
+  int scratch_chan;
+  struct section_table *p;
+  struct cleanup *old_chain;
+  bfd *abfd;
+
+  filename = tilde_expand (so->so_name);



Home | Main Index | Thread Index | Old Index