Teach sparc solaris to next over shared library functions.
* solib.[hc] (find_pc_section_from_so_list): new function and prototype. * sparc-tdep.c (in_solib_trampoline): new function. * symfile.[hc] (find_pc_section): new function and prototypes. * target.[hc] (find_pc_section_from_targets): new function and prototypes. * config/sparc/tm-sun4sol2.h (IN_SOLIB_TRAMPOLINE): redefine to in_solib_trampoline.
This commit is contained in:
parent
deae7611a3
commit
2093fe6840
@ -1,3 +1,15 @@
|
||||
Tue Mar 30 15:46:14 1993 K. Richard Pixley (rich@rtl.cygnus.com)
|
||||
|
||||
Teach sparc solaris to next over shared library functions.
|
||||
* solib.[hc] (find_pc_section_from_so_list): new function and
|
||||
prototype.
|
||||
* sparc-tdep.c (in_solib_trampoline): new function.
|
||||
* symfile.[hc] (find_pc_section): new function and prototypes.
|
||||
* target.[hc] (find_pc_section_from_targets): new function and
|
||||
prototypes.
|
||||
* config/sparc/tm-sun4sol2.h (IN_SOLIB_TRAMPOLINE): redefine to
|
||||
in_solib_trampoline.
|
||||
|
||||
Tue Mar 30 08:06:24 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* infrun.c (wait_for_inferior): Revise comment.
|
||||
|
@ -20,6 +20,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "sparc/tm-sparc.h"
|
||||
#include "tm-sysv4.h"
|
||||
|
||||
#undef IN_SOLIB_TRAMPOLINE
|
||||
#define IN_SOLIB_TRAMPOLINE(pc, name) in_solib_trampoline((pc), (name))
|
||||
|
||||
/* The values of N_SLINE, N_LBRAC, N_RBRAC symbols in .stab sections are
|
||||
relative to the current function, rather than being absolute or
|
||||
relative to the current N_SO. */
|
||||
|
@ -55,3 +55,5 @@ solib_create_inferior_hook PARAMS((void)); /* solib.c */
|
||||
extern int
|
||||
solib_address PARAMS ((CORE_ADDR)); /* solib.c */
|
||||
|
||||
struct section_table *
|
||||
find_pc_section_from_so_list PARAMS ((CORE_ADDR pc)); /* solib.c */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Target-dependent code for the SPARC for GDB, the GNU debugger.
|
||||
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -23,11 +23,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "obstack.h"
|
||||
#include "target.h"
|
||||
#include "ieee-float.h"
|
||||
#include "symfile.h" /* for find_pc_section */
|
||||
|
||||
#ifdef USE_PROC_FS
|
||||
#include <sys/procfs.h>
|
||||
#else
|
||||
#include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#include "gdbcore.h"
|
||||
@ -191,15 +190,21 @@ frame_saved_pc (frame)
|
||||
* difficulty.
|
||||
*/
|
||||
FRAME
|
||||
setup_arbitrary_frame (frame, stack)
|
||||
FRAME_ADDR frame, stack;
|
||||
setup_arbitrary_frame (argc, argv)
|
||||
int argc;
|
||||
FRAME_ADDR *argv;
|
||||
{
|
||||
FRAME fid = create_new_frame (frame, 0);
|
||||
FRAME fid;
|
||||
|
||||
if (argc != 2)
|
||||
error ("Sparc frame specifications require two arguments: fp and sp");
|
||||
|
||||
fid = create_new_frame (argv[0], 0);
|
||||
|
||||
if (!fid)
|
||||
fatal ("internal: create_new_frame returned invalid frame id");
|
||||
|
||||
fid->bottom = stack;
|
||||
fid->bottom = argv[1];
|
||||
fid->pc = FRAME_SAVED_PC (fid);
|
||||
return fid;
|
||||
}
|
||||
@ -228,7 +233,7 @@ setup_arbitrary_frame (frame, stack)
|
||||
* original contents of g1. A * indicates that the actual value of
|
||||
* the instruction is modified below.
|
||||
*/
|
||||
static int save_insn_opcodes[] = {
|
||||
static unsigned int save_insn_opcodes[] = {
|
||||
0x03000000, 0x82007ee0, 0x9de38001, 0x03000000,
|
||||
0x82007ee0, 0x91d02001, 0x01000000 };
|
||||
|
||||
@ -279,7 +284,8 @@ do_save_insn (size)
|
||||
t %g0,1
|
||||
sethi %hi(0),%g0 */
|
||||
|
||||
static int restore_insn_opcodes[] = { 0x81e80000, 0x91d02001, 0x01000000 };
|
||||
static unsigned int restore_insn_opcodes[] = {
|
||||
0x81e80000, 0x91d02001, 0x01000000 };
|
||||
|
||||
static void
|
||||
do_restore_insn ()
|
||||
@ -831,3 +837,27 @@ get_longjmp_target(pc)
|
||||
return 1;
|
||||
}
|
||||
#endif /* GET_LONGJMP_TARGET */
|
||||
|
||||
/* So far used only for sparc solaris. In sparc solaris, we recognize
|
||||
a trampoline by it's section name. That is, if the pc is in a
|
||||
section named ".plt" then we are in a trampline.
|
||||
|
||||
Section and offset tracking belongs in objfiles. FIXME. */
|
||||
|
||||
int
|
||||
in_solib_trampoline(pc, name)
|
||||
CORE_ADDR pc;
|
||||
char *name;
|
||||
{
|
||||
struct section_table *s;
|
||||
int retval = 0;
|
||||
|
||||
s = find_pc_section(pc);
|
||||
|
||||
retval = (s != NULL
|
||||
&& s->sec_ptr != NULL
|
||||
&& s->sec_ptr->name != NULL
|
||||
&& STREQ (s->sec_ptr->name, ".plt"));
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
114
gdb/symfile.c
114
gdb/symfile.c
@ -1,5 +1,5 @@
|
||||
/* Generic symbol file reading for the GNU debugger, GDB.
|
||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support, using pieces from other GDB modules.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -42,6 +42,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* Global variables owned by this file */
|
||||
|
||||
int readnow_symbol_files; /* Read full symbols immediately */
|
||||
@ -375,21 +379,6 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
||||
struct section_offsets *section_offsets;
|
||||
asection *lowest_sect;
|
||||
|
||||
/* There is a distinction between having no symbol table
|
||||
(we refuse to read the file, leaving the old set of symbols around)
|
||||
and having no debugging symbols in your symbol table (we read
|
||||
the file and end up with a mostly empty symbol table).
|
||||
|
||||
FIXME: This strategy works correctly when the debugging symbols are
|
||||
intermixed with "normal" symbols. However, when the debugging symbols
|
||||
are separate, such as with ELF/DWARF, it is perfectly plausible for
|
||||
the symbol table to be missing but still have all the DWARF info
|
||||
intact. Thus in general it is wrong to assume that having no symbol
|
||||
table implies no debugging information. */
|
||||
|
||||
if (!(bfd_get_file_flags (objfile -> obfd) & HAS_SYMS))
|
||||
return;
|
||||
|
||||
init_entry_point_info (objfile);
|
||||
find_sym_fns (objfile);
|
||||
|
||||
@ -440,48 +429,19 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
||||
addr -= bfd_section_vma (objfile->obfd, lowest_sect);
|
||||
}
|
||||
|
||||
{
|
||||
/* Debugging check inserted for testing elimination of NAMES_HAVE_UNDERSCORE.
|
||||
Complain if the dynamic setting of NAMES_HAVE_UNDERSCORE from BFD
|
||||
doesn't match the static setting from the GDB config files, but only
|
||||
if we are using the first BFD target (the default target selected by
|
||||
the same configuration that decided whether NAMES_HAVE_UNDERSCORE is
|
||||
defined or not). For other targets (such as when the user sets GNUTARGET
|
||||
or we are reading a "foreign" object file), it is likely that the value
|
||||
of bfd_get_symbol_leading_char has no relation to the value of
|
||||
NAMES_HAVE_UNDERSCORE for the target for which this gdb was built.
|
||||
Hack alert: the only way to currently do this with bfd is to ask it to
|
||||
produce a list of known target names and compare the first one in the
|
||||
list with the one for the bfd we are using.
|
||||
FIXME: Remove this check after a round of testing.
|
||||
-- gnu@cygnus.com, 16dec92 */
|
||||
CONST char **targets = bfd_target_list ();
|
||||
if (targets != NULL && *targets != NULL)
|
||||
{
|
||||
if (bfd_get_symbol_leading_char (objfile->obfd) !=
|
||||
#ifdef NAMES_HAVE_UNDERSCORE
|
||||
'_'
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
&& STREQ (bfd_get_target (objfile->obfd), *targets))
|
||||
{
|
||||
fprintf (stderr, "GDB internal error! NAMES_HAVE_UNDERSCORE set wrong for %s BFD:\n%s\n",
|
||||
bfd_get_target (objfile->obfd),
|
||||
bfd_get_filename (objfile->obfd));
|
||||
}
|
||||
free (targets);
|
||||
}
|
||||
/* End of debugging check. FIXME. */
|
||||
}
|
||||
|
||||
/* Initialize symbol reading routines for this objfile, allow complaints to
|
||||
appear for this new file, and record how verbose to be, then do the
|
||||
initial symbol reading for this file. */
|
||||
|
||||
(*objfile -> sf -> sym_init) (objfile);
|
||||
clear_complaints (1, verbo);
|
||||
|
||||
/* If objfile->sf->sym_offsets doesn't set this, we don't care
|
||||
(currently). */
|
||||
objfile->num_sections = 0; /* krp-FIXME: why zero? */
|
||||
section_offsets = (*objfile -> sf -> sym_offsets) (objfile, addr);
|
||||
objfile->section_offsets = section_offsets;
|
||||
|
||||
(*objfile -> sf -> sym_read) (objfile, section_offsets, mainline);
|
||||
|
||||
/* Don't allow char * to have a typename (else would get caddr_t.) */
|
||||
@ -550,26 +510,10 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
|
||||
struct partial_symtab *psymtab;
|
||||
bfd *abfd;
|
||||
|
||||
/* Open a bfd for the file and then check to see if the file has a
|
||||
symbol table. There is a distinction between having no symbol table
|
||||
(we refuse to read the file, leaving the old set of symbols around)
|
||||
and having no debugging symbols in the symbol table (we read the file
|
||||
and end up with a mostly empty symbol table, but with lots of stuff in
|
||||
the minimal symbol table). We need to make the decision about whether
|
||||
to continue with the file before allocating and building a objfile.
|
||||
|
||||
FIXME: This strategy works correctly when the debugging symbols are
|
||||
intermixed with "normal" symbols. However, when the debugging symbols
|
||||
are separate, such as with ELF/DWARF, it is perfectly plausible for
|
||||
the symbol table to be missing but still have all the DWARF info
|
||||
intact. Thus in general it is wrong to assume that having no symbol
|
||||
table implies no debugging information. */
|
||||
/* Open a bfd for the file, and give user a chance to burp if we'd be
|
||||
interactively wiping out any existing symbols. */
|
||||
|
||||
abfd = symfile_bfd_open (name);
|
||||
if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
|
||||
{
|
||||
error ("%s has no symbol-table", name);
|
||||
}
|
||||
|
||||
if ((have_full_symbols () || have_partial_symbols ())
|
||||
&& mainline
|
||||
@ -771,7 +715,7 @@ symfile_bfd_open (name)
|
||||
name = tilde_expand (name); /* Returns 1st new malloc'd copy */
|
||||
|
||||
/* Look down path for it, allocate 2nd new malloc'd copy. */
|
||||
desc = openp (getenv ("PATH"), 1, name, O_RDONLY, 0, &absolute_name);
|
||||
desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
|
||||
if (desc < 0)
|
||||
{
|
||||
make_cleanup (free, name);
|
||||
@ -986,18 +930,21 @@ enum language
|
||||
deduce_language_from_filename (filename)
|
||||
char *filename;
|
||||
{
|
||||
char *c = strrchr (filename, '.');
|
||||
char *c;
|
||||
|
||||
if (!c) ; /* Get default. */
|
||||
if (0 == filename)
|
||||
; /* Get default */
|
||||
else if (0 == (c = strrchr (filename, '.')))
|
||||
; /* Get default. */
|
||||
else if(STREQ(c,".mod"))
|
||||
return language_m2;
|
||||
return language_m2;
|
||||
else if(STREQ(c,".c"))
|
||||
return language_c;
|
||||
return language_c;
|
||||
else if(STREQ(c,".cc") || STREQ(c,".C"))
|
||||
return language_cplus;
|
||||
return language_cplus;
|
||||
/* start-sanitize-chill */
|
||||
else if(STREQ(c,".ch") || STREQ(c,".c186") || STREQ(c,".c286"))
|
||||
return language_chill;
|
||||
return language_chill;
|
||||
/* end-sanitize-chill */
|
||||
|
||||
return language_unknown; /* default */
|
||||
@ -1384,6 +1331,21 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, list, val,
|
||||
|
||||
#endif /* !INLINE_ADD_PSYMBOL */
|
||||
|
||||
/* Returns a section whose range includes PC or NULL if none found. */
|
||||
|
||||
struct section_table *
|
||||
find_pc_section(pc)
|
||||
CORE_ADDR pc;
|
||||
{
|
||||
struct section_table *s;
|
||||
|
||||
s = find_pc_section_from_targets(pc);
|
||||
if (s == NULL)
|
||||
s = find_pc_section_from_so_list(pc);
|
||||
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_initialize_symfile ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user