* symfile.c: #include "gdb_assert.h".
(syms_from_objfile): Add the ability to pass in a section offset table directly, as an alternative to the section_addr_info table. Document arguments better. (symbol_file_add): Pass extra arguments to syms_from_objfile. * symfile.h (syms_from_objfile): Update declaration. * rs6000-nat.c (objfile_symbol_add): Pass new arguments to syms_from_objfile. * Makefile.in (symfile.o): List dependency on $(gdb_assert_h).
This commit is contained in:
parent
2307bd6a50
commit
7e8580c13a
5 changed files with 94 additions and 38 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2003-01-22 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
* symfile.c: #include "gdb_assert.h".
|
||||||
|
(syms_from_objfile): Add the ability to pass in a section offset
|
||||||
|
table directly, as an alternative to the section_addr_info table.
|
||||||
|
Document arguments better.
|
||||||
|
(symbol_file_add): Pass extra arguments to syms_from_objfile.
|
||||||
|
* symfile.h (syms_from_objfile): Update declaration.
|
||||||
|
* rs6000-nat.c (objfile_symbol_add): Pass new arguments to
|
||||||
|
syms_from_objfile.
|
||||||
|
* Makefile.in (symfile.o): List dependency on $(gdb_assert_h).
|
||||||
|
|
||||||
2003-01-22 Daniel Jacobowitz <drow@mvista.com>
|
2003-01-22 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
Original patch by Tom Tromey <tromey@cygnus.com> and
|
Original patch by Tom Tromey <tromey@cygnus.com> and
|
||||||
|
|
|
@ -2220,7 +2220,7 @@ symfile.o: symfile.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
|
||||||
$(gdbcmd_h) $(breakpoint_h) $(language_h) $(complaints_h) \
|
$(gdbcmd_h) $(breakpoint_h) $(language_h) $(complaints_h) \
|
||||||
$(demangle_h) $(inferior_h) $(gdb_stabs_h) $(gdb_obstack_h) \
|
$(demangle_h) $(inferior_h) $(gdb_stabs_h) $(gdb_obstack_h) \
|
||||||
$(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h) \
|
$(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h) \
|
||||||
$(readline_h)
|
$(gdb_assert_h) $(readline_h)
|
||||||
symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
||||||
$(target_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) $(gdbcore_h)
|
$(target_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) $(gdbcore_h)
|
||||||
symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
||||||
|
|
|
@ -684,7 +684,7 @@ objfile_symbol_add (void *arg)
|
||||||
{
|
{
|
||||||
struct objfile *obj = (struct objfile *) arg;
|
struct objfile *obj = (struct objfile *) arg;
|
||||||
|
|
||||||
syms_from_objfile (obj, NULL, 0, 0);
|
syms_from_objfile (obj, NULL, 0, 0, 0, 0);
|
||||||
new_symfile_objfile (obj, 0, 0);
|
new_symfile_objfile (obj, 0, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "completer.h"
|
#include "completer.h"
|
||||||
#include "bcache.h"
|
#include "bcache.h"
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
|
#include "gdb_assert.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -572,8 +573,26 @@ default_symfile_offsets (struct objfile *objfile,
|
||||||
|
|
||||||
OBJFILE is where the symbols are to be read from.
|
OBJFILE is where the symbols are to be read from.
|
||||||
|
|
||||||
ADDR is the address where the text segment was loaded, unless the
|
ADDRS is the list of section load addresses. If the user has given
|
||||||
objfile is the main symbol file, in which case it is zero.
|
an 'add-symbol-file' command, then this is the list of offsets and
|
||||||
|
addresses he or she provided as arguments to the command; or, if
|
||||||
|
we're handling a shared library, these are the actual addresses the
|
||||||
|
sections are loaded at, according to the inferior's dynamic linker
|
||||||
|
(as gleaned by GDB's shared library code). We convert each address
|
||||||
|
into an offset from the section VMA's as it appears in the object
|
||||||
|
file, and then call the file's sym_offsets function to convert this
|
||||||
|
into a format-specific offset table --- a `struct section_offsets'.
|
||||||
|
If ADDRS is non-zero, OFFSETS must be zero.
|
||||||
|
|
||||||
|
OFFSETS is a table of section offsets already in the right
|
||||||
|
format-specific representation. NUM_OFFSETS is the number of
|
||||||
|
elements present in OFFSETS->offsets. If OFFSETS is non-zero, we
|
||||||
|
assume this is the proper table the call to sym_offsets described
|
||||||
|
above would produce. Instead of calling sym_offsets, we just dump
|
||||||
|
it right into objfile->section_offsets. (When we're re-reading
|
||||||
|
symbols from an objfile, we don't have the original load address
|
||||||
|
list any more; all we have is the section offset table.) If
|
||||||
|
OFFSETS is non-zero, ADDRS must be zero.
|
||||||
|
|
||||||
MAINLINE is nonzero if this is the main symbol file, or zero if
|
MAINLINE is nonzero if this is the main symbol file, or zero if
|
||||||
it's an extra symbol file such as dynamically loaded code.
|
it's an extra symbol file such as dynamically loaded code.
|
||||||
|
@ -582,8 +601,12 @@ default_symfile_offsets (struct objfile *objfile,
|
||||||
the symbol reading (and complaints can be more terse about it). */
|
the symbol reading (and complaints can be more terse about it). */
|
||||||
|
|
||||||
void
|
void
|
||||||
syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
|
syms_from_objfile (struct objfile *objfile,
|
||||||
int mainline, int verbo)
|
struct section_addr_info *addrs,
|
||||||
|
struct section_offsets *offsets,
|
||||||
|
int num_offsets,
|
||||||
|
int mainline,
|
||||||
|
int verbo)
|
||||||
{
|
{
|
||||||
asection *lower_sect;
|
asection *lower_sect;
|
||||||
asection *sect;
|
asection *sect;
|
||||||
|
@ -592,16 +615,19 @@ syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* If ADDRS is NULL, initialize the local section_addr_info struct and
|
gdb_assert (! (addrs && offsets));
|
||||||
point ADDRS to it. We now establish the convention that an addr of
|
|
||||||
zero means no load address was specified. */
|
|
||||||
|
|
||||||
if (addrs == NULL)
|
/* If ADDRS and OFFSETS are both NULL, put together a dummy address
|
||||||
|
list. We now establish the convention that an addr of zero means
|
||||||
|
no load address was specified. */
|
||||||
|
if (! addrs && ! offsets)
|
||||||
{
|
{
|
||||||
memset (&local_addr, 0, sizeof (local_addr));
|
memset (&local_addr, 0, sizeof (local_addr));
|
||||||
addrs = &local_addr;
|
addrs = &local_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now either addrs or offsets is non-zero. */
|
||||||
|
|
||||||
init_entry_point_info (objfile);
|
init_entry_point_info (objfile);
|
||||||
find_sym_fns (objfile);
|
find_sym_fns (objfile);
|
||||||
|
|
||||||
|
@ -674,6 +700,7 @@ syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
|
||||||
this_offset = lower_offset = lower_addr - lower_orig_addr */
|
this_offset = lower_offset = lower_addr - lower_orig_addr */
|
||||||
|
|
||||||
/* Calculate offsets for sections. */
|
/* Calculate offsets for sections. */
|
||||||
|
if (addrs)
|
||||||
for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++)
|
for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++)
|
||||||
{
|
{
|
||||||
if (addrs->other[i].addr != 0)
|
if (addrs->other[i].addr != 0)
|
||||||
|
@ -690,7 +717,8 @@ syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
warning ("section %s not found in %s", addrs->other[i].name,
|
warning ("section %s not found in %s",
|
||||||
|
addrs->other[i].name,
|
||||||
objfile->name);
|
objfile->name);
|
||||||
addrs->other[i].addr = 0;
|
addrs->other[i].addr = 0;
|
||||||
}
|
}
|
||||||
|
@ -707,7 +735,21 @@ syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
|
||||||
(*objfile->sf->sym_init) (objfile);
|
(*objfile->sf->sym_init) (objfile);
|
||||||
clear_complaints (&symfile_complaints, 1, verbo);
|
clear_complaints (&symfile_complaints, 1, verbo);
|
||||||
|
|
||||||
|
if (addrs)
|
||||||
(*objfile->sf->sym_offsets) (objfile, addrs);
|
(*objfile->sf->sym_offsets) (objfile, addrs);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t size = SIZEOF_N_SECTION_OFFSETS (num_offsets);
|
||||||
|
|
||||||
|
/* Just copy in the offset table directly as given to us. */
|
||||||
|
objfile->num_sections = num_offsets;
|
||||||
|
objfile->section_offsets
|
||||||
|
= ((struct section_offsets *)
|
||||||
|
obstack_alloc (&objfile->psymbol_obstack, size));
|
||||||
|
memcpy (objfile->section_offsets, offsets, size);
|
||||||
|
|
||||||
|
init_objfile_sect_indices (objfile);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef IBM6000_TARGET
|
#ifndef IBM6000_TARGET
|
||||||
/* This is a SVR4/SunOS specific hack, I think. In any event, it
|
/* This is a SVR4/SunOS specific hack, I think. In any event, it
|
||||||
|
@ -888,7 +930,7 @@ symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs,
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
syms_from_objfile (objfile, addrs, mainline, from_tty);
|
syms_from_objfile (objfile, addrs, 0, 0, mainline, from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We now have at least a partial symbol table. Check to see if the
|
/* We now have at least a partial symbol table. Check to see if the
|
||||||
|
|
|
@ -174,7 +174,9 @@ extern void add_symtab_fns (struct sym_fns *);
|
||||||
|
|
||||||
extern void init_entry_point_info (struct objfile *);
|
extern void init_entry_point_info (struct objfile *);
|
||||||
|
|
||||||
extern void syms_from_objfile (struct objfile *, struct section_addr_info *,
|
extern void syms_from_objfile (struct objfile *,
|
||||||
|
struct section_addr_info *,
|
||||||
|
struct section_offsets *, int,
|
||||||
int, int);
|
int, int);
|
||||||
|
|
||||||
extern void new_symfile_objfile (struct objfile *, int, int);
|
extern void new_symfile_objfile (struct objfile *, int, int);
|
||||||
|
|
Loading…
Add table
Reference in a new issue