1999-04-16 01:35:26 +00:00
|
|
|
|
/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
|
|
|
|
|
Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 1997
|
1999-07-07 20:19:36 +00:00
|
|
|
|
Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
Derived from coffread.c, dbxread.c, and a lot of hacking.
|
|
|
|
|
Contributed by IBM Corporation.
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#ifndef NO_SYS_FILE
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include "gdb_stat.h"
|
|
|
|
|
|
|
|
|
|
#include "coff/internal.h"
|
|
|
|
|
#include "libcoff.h" /* FIXME, internal data from BFD */
|
|
|
|
|
#include "coff/rs6000.h"
|
|
|
|
|
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
#include "symfile.h"
|
|
|
|
|
#include "objfiles.h"
|
|
|
|
|
#include "buildsym.h"
|
|
|
|
|
#include "stabsread.h"
|
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "language.h" /* Needed inside partial-stab.h */
|
|
|
|
|
#include "complaints.h"
|
|
|
|
|
|
|
|
|
|
#include "gdb-stabs.h"
|
|
|
|
|
|
|
|
|
|
/* For interface with stabsread.c. */
|
|
|
|
|
#include "aout/stab_gnu.h"
|
|
|
|
|
|
|
|
|
|
/* For interface with partial-stab.h. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
#define N_UNDF 0 /* Undefined symbol */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#undef N_ABS
|
|
|
|
|
#define N_ABS 2
|
1999-07-07 20:19:36 +00:00
|
|
|
|
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */
|
|
|
|
|
#define N_DATA 6 /* Data sym -- defined at offset in data seg */
|
|
|
|
|
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */
|
|
|
|
|
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */
|
|
|
|
|
#define N_FN 0x1f /* File name of .o file */
|
|
|
|
|
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
|
|
|
|
|
N_DATA, or N_BSS. When the low-order bit of other types is set,
|
|
|
|
|
(e.g. N_WARNING versus N_FN), they are two different types. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#define N_INDR 0x0a
|
|
|
|
|
|
|
|
|
|
/* The following symbols refer to set elements.
|
|
|
|
|
All the N_SET[ATDB] symbols with the same name form one set.
|
|
|
|
|
Space is allocated for the set in the text section, and each set
|
|
|
|
|
elements value is stored into one word of the space.
|
|
|
|
|
The first word of the space is the length of the set (number of elements).
|
|
|
|
|
|
|
|
|
|
The address of the set is made into an N_SETV symbol
|
|
|
|
|
whose name is the same as the name of the set.
|
|
|
|
|
This symbol acts like a N_DATA global symbol
|
|
|
|
|
in that it can satisfy undefined external references. */
|
|
|
|
|
|
|
|
|
|
/* These appear as input to LD, in a .o file. */
|
|
|
|
|
#define N_SETA 0x14 /* Absolute set element symbol */
|
|
|
|
|
#define N_SETT 0x16 /* Text set element symbol */
|
|
|
|
|
#define N_SETD 0x18 /* Data set element symbol */
|
|
|
|
|
#define N_SETB 0x1A /* Bss set element symbol */
|
|
|
|
|
|
|
|
|
|
/* This is output from LD. */
|
|
|
|
|
#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
|
|
|
|
|
|
|
|
|
/* We put a pointer to this structure in the read_symtab_private field
|
|
|
|
|
of the psymtab. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct symloc
|
|
|
|
|
{
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* First symbol number for this file. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int first_symnum;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Number of symbols in the section of the symbol table devoted to
|
|
|
|
|
this file's symbols (actually, the section bracketed may contain
|
|
|
|
|
more than just this file's symbols). If numsyms is 0, the only
|
|
|
|
|
reason for this thing's existence is the dependency list. Nothing
|
|
|
|
|
else will happen when it is read in. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int numsyms;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Position of the start of the line number information for this psymtab. */
|
|
|
|
|
unsigned int lineno_off;
|
|
|
|
|
};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Remember what we deduced to be the source language of this psymtab. */
|
|
|
|
|
|
|
|
|
|
static enum language psymtab_language = language_unknown;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Simplified internal version of coff symbol table information */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct coff_symbol
|
|
|
|
|
{
|
|
|
|
|
char *c_name;
|
|
|
|
|
int c_symnum; /* symbol number of this entry */
|
|
|
|
|
int c_naux; /* 0 if syment only, 1 if syment + auxent */
|
|
|
|
|
long c_value;
|
|
|
|
|
unsigned char c_sclass;
|
|
|
|
|
int c_secnum;
|
|
|
|
|
unsigned int c_type;
|
|
|
|
|
};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* last function's saved coff symbol `cs' */
|
|
|
|
|
|
|
|
|
|
static struct coff_symbol fcn_cs_saved;
|
|
|
|
|
|
|
|
|
|
static bfd *symfile_bfd;
|
|
|
|
|
|
|
|
|
|
/* Core address of start and end of text of current source file.
|
|
|
|
|
This is calculated from the first function seen after a C_FILE
|
|
|
|
|
symbol. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static CORE_ADDR cur_src_end_addr;
|
|
|
|
|
|
|
|
|
|
/* Core address of the end of the first object file. */
|
|
|
|
|
|
|
|
|
|
static CORE_ADDR first_object_file_end;
|
|
|
|
|
|
|
|
|
|
/* initial symbol-table-debug-string vector length */
|
|
|
|
|
|
|
|
|
|
#define INITIAL_STABVECTOR_LENGTH 40
|
|
|
|
|
|
|
|
|
|
/* Nonzero if within a function (so symbols should be local,
|
|
|
|
|
if nothing says specifically). */
|
|
|
|
|
|
|
|
|
|
int within_function;
|
|
|
|
|
|
|
|
|
|
/* Size of a COFF symbol. I think it is always 18, so I'm not sure
|
|
|
|
|
there is any reason not to just use a #define, but might as well
|
|
|
|
|
ask BFD for the size and store it here, I guess. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static unsigned local_symesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct coff_symfile_info
|
|
|
|
|
{
|
|
|
|
|
file_ptr min_lineno_offset; /* Where in file lowest line#s are */
|
|
|
|
|
file_ptr max_lineno_offset; /* 1+last byte of line#s in file */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Pointer to the string table. */
|
|
|
|
|
char *strtbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Pointer to debug section. */
|
|
|
|
|
char *debugsec;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Pointer to the a.out symbol table. */
|
|
|
|
|
char *symtbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Number of symbols in symtbl. */
|
|
|
|
|
int symtbl_num_syms;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* Offset in data section to TOC anchor. */
|
|
|
|
|
CORE_ADDR toc_offset;
|
|
|
|
|
};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static struct complaint storclass_complaint =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Unexpected storage class: %d", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static struct complaint bf_notfound_complaint =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"line numbers off, `.bf' symbol not found", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static struct complaint ef_complaint =
|
|
|
|
|
{"Mismatched .ef symbol ignored starting at symnum %d", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static struct complaint eb_complaint =
|
|
|
|
|
{"Mismatched .eb symbol ignored starting at symnum %d", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_initial_scan (struct objfile *, int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void scan_xcoff_symtab (struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static char *xcoff_next_symbol_text (struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void record_include_begin (struct coff_symbol *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2000-05-28 01:12:42 +00:00
|
|
|
|
enter_line_range (struct subfile *, unsigned, unsigned,
|
|
|
|
|
CORE_ADDR, CORE_ADDR, unsigned *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void init_stringtab (bfd *, file_ptr, struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_symfile_init (struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_new_init (struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_symfile_finish (struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
|
static void
|
2000-05-28 01:12:42 +00:00
|
|
|
|
xcoff_symfile_offsets (struct objfile *, struct section_addr_info *addrs);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void find_linenos (bfd *, sec_ptr, PTR);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static char *coff_getfilename (union internal_auxent *, struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void read_symbol (struct internal_syment *, int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int read_symbol_lineno (int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-07-07 22:00:09 +00:00
|
|
|
|
static CORE_ADDR read_symbol_nvalue (int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static struct symbol *process_xcoff_symbol (struct coff_symbol *,
|
|
|
|
|
struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void read_xcoff_symtab (struct partial_symtab *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#if 0
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void add_stab_to_list (char *, struct pending_stabs **);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int compare_lte (const void *, const void *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static struct linetable *arrange_linetable (struct linetable *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void record_include_end (struct coff_symbol *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void process_linenos (CORE_ADDR, CORE_ADDR);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Translate from a COFF section number (target_index) to a SECT_OFF_*
|
|
|
|
|
code. */
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int secnum_to_section (int, struct objfile *);
|
|
|
|
|
static asection *secnum_to_bfd_section (int, struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct find_targ_sec_arg
|
|
|
|
|
{
|
|
|
|
|
int targ_index;
|
|
|
|
|
int *resultp;
|
|
|
|
|
asection **bfd_sect;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
struct objfile *objfile;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void find_targ_sec (bfd *, asection *, void *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
find_targ_sec (bfd *abfd, asection *sect, PTR obj)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
struct objfile *objfile = args->objfile;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (sect->target_index == args->targ_index)
|
|
|
|
|
{
|
|
|
|
|
/* This is the section. Figure out what SECT_OFF_* code it is. */
|
|
|
|
|
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
*args->resultp = SECT_OFF_TEXT (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
*args->resultp = SECT_OFF_DATA (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
else
|
2000-08-07 15:16:15 +00:00
|
|
|
|
*args->resultp = sect->index;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
*args->bfd_sect = sect;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the section number (SECT_OFF_*) that CS points to. */
|
|
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
secnum_to_section (int secnum, struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
int off = SECT_OFF_TEXT (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
asection *sect = NULL;
|
|
|
|
|
struct find_targ_sec_arg args;
|
|
|
|
|
args.targ_index = secnum;
|
|
|
|
|
args.resultp = &off;
|
|
|
|
|
args.bfd_sect = §
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
args.objfile = objfile;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
|
|
|
|
|
return off;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the BFD section that CS points to. */
|
|
|
|
|
static asection *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
secnum_to_bfd_section (int secnum, struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
int off = SECT_OFF_TEXT (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
asection *sect = NULL;
|
|
|
|
|
struct find_targ_sec_arg args;
|
|
|
|
|
args.targ_index = secnum;
|
|
|
|
|
args.resultp = &off;
|
|
|
|
|
args.bfd_sect = §
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
args.objfile = objfile;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
|
|
|
|
|
return sect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add a given stab string into given stab vector. */
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (*stabvector == NULL)
|
|
|
|
|
{
|
|
|
|
|
*stabvector = (struct pending_stabs *)
|
|
|
|
|
xmalloc (sizeof (struct pending_stabs) +
|
|
|
|
|
INITIAL_STABVECTOR_LENGTH * sizeof (char *));
|
|
|
|
|
(*stabvector)->count = 0;
|
|
|
|
|
(*stabvector)->length = INITIAL_STABVECTOR_LENGTH;
|
|
|
|
|
}
|
|
|
|
|
else if ((*stabvector)->count >= (*stabvector)->length)
|
|
|
|
|
{
|
|
|
|
|
(*stabvector)->length += INITIAL_STABVECTOR_LENGTH;
|
|
|
|
|
*stabvector = (struct pending_stabs *)
|
|
|
|
|
xrealloc ((char *) *stabvector, sizeof (struct pending_stabs) +
|
|
|
|
|
(*stabvector)->length * sizeof (char *));
|
|
|
|
|
}
|
|
|
|
|
(*stabvector)->stab[(*stabvector)->count++] = stabname;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* *INDENT-OFF* */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Linenos are processed on a file-by-file basis.
|
|
|
|
|
|
|
|
|
|
Two reasons:
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
1) xlc (IBM's native c compiler) postpones static function code
|
|
|
|
|
emission to the end of a compilation unit. This way it can
|
|
|
|
|
determine if those functions (statics) are needed or not, and
|
|
|
|
|
can do some garbage collection (I think). This makes line
|
|
|
|
|
numbers and corresponding addresses unordered, and we end up
|
|
|
|
|
with a line table like:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lineno addr
|
|
|
|
|
foo() 10 0x100
|
|
|
|
|
20 0x200
|
|
|
|
|
30 0x300
|
|
|
|
|
|
|
|
|
|
foo3() 70 0x400
|
|
|
|
|
80 0x500
|
|
|
|
|
90 0x600
|
|
|
|
|
|
|
|
|
|
static foo2()
|
|
|
|
|
40 0x700
|
|
|
|
|
50 0x800
|
|
|
|
|
60 0x900
|
|
|
|
|
|
|
|
|
|
and that breaks gdb's binary search on line numbers, if the
|
|
|
|
|
above table is not sorted on line numbers. And that sort
|
|
|
|
|
should be on function based, since gcc can emit line numbers
|
|
|
|
|
like:
|
|
|
|
|
|
|
|
|
|
10 0x100 - for the init/test part of a for stmt.
|
|
|
|
|
20 0x200
|
|
|
|
|
30 0x300
|
|
|
|
|
10 0x400 - for the increment part of a for stmt.
|
|
|
|
|
|
|
|
|
|
arrange_linetable() will do this sorting.
|
|
|
|
|
|
|
|
|
|
2) aix symbol table might look like:
|
|
|
|
|
|
|
|
|
|
c_file // beginning of a new file
|
|
|
|
|
.bi // beginning of include file
|
|
|
|
|
.ei // end of include file
|
|
|
|
|
.bi
|
|
|
|
|
.ei
|
|
|
|
|
|
|
|
|
|
basically, .bi/.ei pairs do not necessarily encapsulate
|
|
|
|
|
their scope. They need to be recorded, and processed later
|
|
|
|
|
on when we come the end of the compilation unit.
|
|
|
|
|
Include table (inclTable) and process_linenos() handle
|
|
|
|
|
that. */
|
1999-07-07 17:31:57 +00:00
|
|
|
|
/* *INDENT-ON* */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* compare line table entry addresses. */
|
|
|
|
|
|
|
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
compare_lte (const void *lte1p, const void *lte2p)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct linetable_entry *lte1 = (struct linetable_entry *) lte1p;
|
|
|
|
|
struct linetable_entry *lte2 = (struct linetable_entry *) lte2p;
|
|
|
|
|
return lte1->pc - lte2->pc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a line table with function entries are marked, arrange its functions
|
|
|
|
|
in ascending order and strip off function entry markers and return it in
|
|
|
|
|
a newly created table. If the old one is good enough, return the old one. */
|
|
|
|
|
/* FIXME: I think all this stuff can be replaced by just passing
|
|
|
|
|
sort_linevec = 1 to end_symtab. */
|
|
|
|
|
|
|
|
|
|
static struct linetable *
|
2000-11-15 19:58:14 +00:00
|
|
|
|
arrange_linetable (struct linetable *oldLineTb)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int ii, jj, newline, /* new line count */
|
|
|
|
|
function_count; /* # of functions */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct linetable_entry *fentry; /* function entry vector */
|
|
|
|
|
int fentry_size; /* # of function entries */
|
|
|
|
|
struct linetable *newLineTb; /* new line table */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#define NUM_OF_FUNCTIONS 20
|
|
|
|
|
|
|
|
|
|
fentry_size = NUM_OF_FUNCTIONS;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
fentry = (struct linetable_entry *)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
xmalloc (fentry_size * sizeof (struct linetable_entry));
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
for (function_count = 0, ii = 0; ii < oldLineTb->nitems; ++ii)
|
|
|
|
|
{
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (oldLineTb->item[ii].line == 0)
|
|
|
|
|
{ /* function entry found. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (function_count >= fentry_size)
|
|
|
|
|
{ /* make sure you have room. */
|
|
|
|
|
fentry_size *= 2;
|
|
|
|
|
fentry = (struct linetable_entry *)
|
|
|
|
|
xrealloc (fentry, fentry_size * sizeof (struct linetable_entry));
|
|
|
|
|
}
|
|
|
|
|
fentry[function_count].line = ii;
|
|
|
|
|
fentry[function_count].pc = oldLineTb->item[ii].pc;
|
|
|
|
|
++function_count;
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (function_count == 0)
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (fentry);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return oldLineTb;
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
else if (function_count > 1)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
qsort (fentry, function_count, sizeof (struct linetable_entry), compare_lte);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* allocate a new line table. */
|
|
|
|
|
newLineTb = (struct linetable *)
|
|
|
|
|
xmalloc
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(sizeof (struct linetable) +
|
|
|
|
|
(oldLineTb->nitems - function_count) * sizeof (struct linetable_entry));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* if line table does not start with a function beginning, copy up until
|
|
|
|
|
a function begin. */
|
|
|
|
|
|
|
|
|
|
newline = 0;
|
|
|
|
|
if (oldLineTb->item[0].line != 0)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
for (newline = 0;
|
|
|
|
|
newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++newline)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
newLineTb->item[newline] = oldLineTb->item[newline];
|
|
|
|
|
|
|
|
|
|
/* Now copy function lines one by one. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
for (ii = 0; ii < function_count; ++ii)
|
|
|
|
|
{
|
|
|
|
|
for (jj = fentry[ii].line + 1;
|
|
|
|
|
jj < oldLineTb->nitems && oldLineTb->item[jj].line != 0;
|
|
|
|
|
++jj, ++newline)
|
|
|
|
|
newLineTb->item[newline] = oldLineTb->item[jj];
|
|
|
|
|
}
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (fentry);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
newLineTb->nitems = oldLineTb->nitems - function_count;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return newLineTb;
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* include file support: C_BINCL/C_EINCL pairs will be kept in the
|
|
|
|
|
following `IncludeChain'. At the end of each symtab (end_symtab),
|
|
|
|
|
we will determine if we should create additional symtab's to
|
|
|
|
|
represent if (the include files. */
|
|
|
|
|
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
typedef struct _inclTable
|
|
|
|
|
{
|
|
|
|
|
char *name; /* include filename */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Offsets to the line table. end points to the last entry which is
|
|
|
|
|
part of this include file. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int begin, end;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
struct subfile *subfile;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
unsigned funStartLine; /* start line # of its function */
|
|
|
|
|
}
|
|
|
|
|
InclTable;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#define INITIAL_INCLUDE_TABLE_LENGTH 20
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static InclTable *inclTable; /* global include table */
|
|
|
|
|
static int inclIndx; /* last entry to table */
|
|
|
|
|
static int inclLength; /* table length */
|
|
|
|
|
static int inclDepth; /* nested include depth */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void allocate_include_entry (void);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
record_include_begin (struct coff_symbol *cs)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (inclDepth)
|
|
|
|
|
{
|
|
|
|
|
/* In xcoff, we assume include files cannot be nested (not in .c files
|
1999-07-07 20:19:36 +00:00
|
|
|
|
of course, but in corresponding .s files.). */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* This can happen with old versions of GCC.
|
1999-07-07 20:19:36 +00:00
|
|
|
|
GCC 2.3.3-930426 does not exhibit this on a test case which
|
|
|
|
|
a user said produced the message for him. */
|
|
|
|
|
static struct complaint msg =
|
|
|
|
|
{"Nested C_BINCL symbols", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg);
|
|
|
|
|
}
|
|
|
|
|
++inclDepth;
|
|
|
|
|
|
|
|
|
|
allocate_include_entry ();
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
inclTable[inclIndx].name = cs->c_name;
|
|
|
|
|
inclTable[inclIndx].begin = cs->c_value;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
record_include_end (struct coff_symbol *cs)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
InclTable *pTbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (inclDepth == 0)
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static struct complaint msg =
|
|
|
|
|
{"Mismatched C_BINCL/C_EINCL pair", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allocate_include_entry ();
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
pTbl = &inclTable[inclIndx];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
pTbl->end = cs->c_value;
|
|
|
|
|
|
|
|
|
|
--inclDepth;
|
|
|
|
|
++inclIndx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
allocate_include_entry (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (inclTable == NULL)
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
inclTable = (InclTable *)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
xmalloc (sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH);
|
|
|
|
|
memset (inclTable,
|
|
|
|
|
'\0', sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH);
|
|
|
|
|
inclLength = INITIAL_INCLUDE_TABLE_LENGTH;
|
|
|
|
|
inclIndx = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (inclIndx >= inclLength)
|
|
|
|
|
{
|
|
|
|
|
inclLength += INITIAL_INCLUDE_TABLE_LENGTH;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
inclTable = (InclTable *)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
xrealloc (inclTable, sizeof (InclTable) * inclLength);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
memset (inclTable + inclLength - INITIAL_INCLUDE_TABLE_LENGTH,
|
|
|
|
|
'\0', sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Global variable to pass the psymtab down to all the routines involved
|
|
|
|
|
in psymtab to symtab processing. */
|
|
|
|
|
static struct partial_symtab *this_symtab_psymtab;
|
|
|
|
|
|
|
|
|
|
/* given the start and end addresses of a compilation unit (or a csect,
|
|
|
|
|
at times) process its lines and create appropriate line vectors. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
process_linenos (CORE_ADDR start, CORE_ADDR end)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int offset, ii;
|
|
|
|
|
file_ptr max_offset =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
|
|
|
|
|
->max_lineno_offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* subfile structure for the main compilation unit. */
|
|
|
|
|
struct subfile main_subfile;
|
|
|
|
|
|
|
|
|
|
/* In the main source file, any time we see a function entry, we
|
|
|
|
|
reset this variable to function's absolute starting line number.
|
|
|
|
|
All the following line numbers in the function are relative to
|
|
|
|
|
this, and we record absolute line numbers in record_line(). */
|
|
|
|
|
|
|
|
|
|
unsigned int main_source_baseline = 0;
|
|
|
|
|
|
|
|
|
|
unsigned *firstLine;
|
|
|
|
|
|
|
|
|
|
offset =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct symloc *) this_symtab_psymtab->read_symtab_private)->lineno_off;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (offset == 0)
|
|
|
|
|
goto return_after_cleanup;
|
|
|
|
|
|
|
|
|
|
memset (&main_subfile, '\0', sizeof (main_subfile));
|
|
|
|
|
|
|
|
|
|
if (inclIndx == 0)
|
|
|
|
|
/* All source lines were in the main source file. None in include files. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
enter_line_range (&main_subfile, offset, 0, start, end,
|
|
|
|
|
&main_source_baseline);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* There was source with line numbers in include files. */
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
|
|
|
|
|
int linesz =
|
|
|
|
|
coff_data (this_symtab_psymtab->objfile->obfd)->local_linesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
main_source_baseline = 0;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
for (ii = 0; ii < inclIndx; ++ii)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct subfile *tmpSubfile;
|
|
|
|
|
|
|
|
|
|
/* If there is main file source before include file, enter it. */
|
|
|
|
|
if (offset < inclTable[ii].begin)
|
|
|
|
|
{
|
|
|
|
|
enter_line_range
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
(&main_subfile, offset, inclTable[ii].begin - linesz,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
start, 0, &main_source_baseline);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Have a new subfile for the include file. */
|
|
|
|
|
|
|
|
|
|
tmpSubfile = inclTable[ii].subfile =
|
|
|
|
|
(struct subfile *) xmalloc (sizeof (struct subfile));
|
|
|
|
|
|
|
|
|
|
memset (tmpSubfile, '\0', sizeof (struct subfile));
|
|
|
|
|
firstLine = &(inclTable[ii].funStartLine);
|
|
|
|
|
|
|
|
|
|
/* Enter include file's lines now. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
enter_line_range (tmpSubfile, inclTable[ii].begin,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
inclTable[ii].end, start, 0, firstLine);
|
|
|
|
|
|
|
|
|
|
if (offset <= inclTable[ii].end)
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
offset = inclTable[ii].end + linesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* All the include files' line have been processed at this point. Now,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
enter remaining lines of the main file, if any left. */
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
if (offset < max_offset + 1 - linesz)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
enter_line_range (&main_subfile, offset, 0, start, end,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
&main_source_baseline);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process main file's line numbers. */
|
|
|
|
|
if (main_subfile.line_vector)
|
|
|
|
|
{
|
|
|
|
|
struct linetable *lineTb, *lv;
|
|
|
|
|
|
|
|
|
|
lv = main_subfile.line_vector;
|
|
|
|
|
|
|
|
|
|
/* Line numbers are not necessarily ordered. xlc compilation will
|
1999-07-07 20:19:36 +00:00
|
|
|
|
put static function to the end. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
lineTb = arrange_linetable (lv);
|
|
|
|
|
if (lv == lineTb)
|
|
|
|
|
{
|
|
|
|
|
current_subfile->line_vector = (struct linetable *)
|
|
|
|
|
xrealloc (lv, (sizeof (struct linetable)
|
|
|
|
|
+ lv->nitems * sizeof (struct linetable_entry)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (lv);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
current_subfile->line_vector = lineTb;
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
current_subfile->line_vector_length =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
current_subfile->line_vector->nitems;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now, process included files' line numbers. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
for (ii = 0; ii < inclIndx; ++ii)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if ((inclTable[ii].subfile)->line_vector) /* Useless if!!! FIXMEmgo */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct linetable *lineTb, *lv;
|
|
|
|
|
|
|
|
|
|
lv = (inclTable[ii].subfile)->line_vector;
|
|
|
|
|
|
|
|
|
|
/* Line numbers are not necessarily ordered. xlc compilation will
|
|
|
|
|
put static function to the end. */
|
|
|
|
|
|
|
|
|
|
lineTb = arrange_linetable (lv);
|
|
|
|
|
|
|
|
|
|
push_subfile ();
|
|
|
|
|
|
|
|
|
|
/* For the same include file, we might want to have more than one
|
|
|
|
|
subfile. This happens if we have something like:
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
......
|
|
|
|
|
#include "foo.h"
|
|
|
|
|
......
|
|
|
|
|
#include "foo.h"
|
|
|
|
|
......
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
while foo.h including code in it. (stupid but possible)
|
|
|
|
|
Since start_subfile() looks at the name and uses an
|
|
|
|
|
existing one if finds, we need to provide a fake name and
|
|
|
|
|
fool it. */
|
|
|
|
|
|
|
|
|
|
#if 0
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_subfile (inclTable[ii].name, (char *) 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#else
|
|
|
|
|
{
|
|
|
|
|
/* Pick a fake name that will produce the same results as this
|
|
|
|
|
one when passed to deduce_language_from_filename. Kludge on
|
|
|
|
|
top of kludge. */
|
|
|
|
|
char *fakename = strrchr (inclTable[ii].name, '.');
|
|
|
|
|
if (fakename == NULL)
|
|
|
|
|
fakename = " ?";
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_subfile (fakename, (char *) 0);
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (current_subfile->name);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
1999-12-07 03:56:43 +00:00
|
|
|
|
current_subfile->name = xstrdup (inclTable[ii].name);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (lv == lineTb)
|
|
|
|
|
{
|
|
|
|
|
current_subfile->line_vector =
|
|
|
|
|
(struct linetable *) xrealloc
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(lv, (sizeof (struct linetable)
|
|
|
|
|
+ lv->nitems * sizeof (struct linetable_entry)));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (lv);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
current_subfile->line_vector = lineTb;
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
current_subfile->line_vector_length =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
current_subfile->line_vector->nitems;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_subfile (pop_subfile (), (char *) 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return_after_cleanup:
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* We don't want to keep alloc/free'ing the global include file table. */
|
|
|
|
|
inclIndx = 0;
|
|
|
|
|
|
|
|
|
|
/* Start with a fresh subfile structure for the next file. */
|
|
|
|
|
memset (&main_subfile, '\0', sizeof (struct subfile));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
aix_process_linenos (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* process line numbers and enter them into line vector */
|
|
|
|
|
process_linenos (last_source_start_addr, cur_src_end_addr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Enter a given range of lines into the line vector.
|
|
|
|
|
can be called in the following two ways:
|
1999-07-07 20:19:36 +00:00
|
|
|
|
enter_line_range (subfile, beginoffset, endoffset, startaddr, 0, firstLine) or
|
|
|
|
|
enter_line_range (subfile, beginoffset, 0, startaddr, endaddr, firstLine)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
endoffset points to the last line table entry that we should pay
|
|
|
|
|
attention to. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoffset, /* offsets to line table */
|
|
|
|
|
CORE_ADDR startaddr, /* offsets to line table */
|
|
|
|
|
CORE_ADDR endaddr, unsigned *firstLine)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned int curoffset;
|
|
|
|
|
CORE_ADDR addr;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
void *ext_lnno;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
struct internal_lineno int_lnno;
|
|
|
|
|
unsigned int limit_offset;
|
|
|
|
|
bfd *abfd;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
int linesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (endoffset == 0 && startaddr == 0 && endaddr == 0)
|
|
|
|
|
return;
|
|
|
|
|
curoffset = beginoffset;
|
|
|
|
|
limit_offset =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
|
|
|
|
|
->max_lineno_offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (endoffset != 0)
|
|
|
|
|
{
|
|
|
|
|
if (endoffset >= limit_offset)
|
|
|
|
|
{
|
|
|
|
|
static struct complaint msg =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Bad line table offset in C_EINCL directive", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
limit_offset = endoffset;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
limit_offset -= 1;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
abfd = this_symtab_psymtab->objfile->obfd;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
linesz = coff_data (abfd)->local_linesz;
|
|
|
|
|
ext_lnno = alloca (linesz);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
while (curoffset <= limit_offset)
|
|
|
|
|
{
|
|
|
|
|
bfd_seek (abfd, curoffset, SEEK_SET);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
bfd_read (ext_lnno, linesz, 1, abfd);
|
|
|
|
|
bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Find the address this line represents. */
|
|
|
|
|
addr = (int_lnno.l_lnno
|
|
|
|
|
? int_lnno.l_addr.l_paddr
|
|
|
|
|
: read_symbol_nvalue (int_lnno.l_addr.l_symndx));
|
|
|
|
|
addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (this_symtab_psymtab->objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (addr < startaddr || (endaddr && addr >= endaddr))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (int_lnno.l_lnno == 0)
|
|
|
|
|
{
|
|
|
|
|
*firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx);
|
|
|
|
|
record_line (subfile, 0, addr);
|
|
|
|
|
--(*firstLine);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
record_line (subfile, *firstLine + int_lnno.l_lnno, addr);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
curoffset += linesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save the vital information for use when closing off the current file.
|
|
|
|
|
NAME is the file name the symbols came from, START_ADDR is the first
|
|
|
|
|
text address for the file, and SIZE is the number of bytes of text. */
|
|
|
|
|
|
|
|
|
|
#define complete_symtab(name, start_addr) { \
|
|
|
|
|
last_source_file = savestring (name, strlen (name)); \
|
|
|
|
|
last_source_start_addr = start_addr; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Refill the symbol table input buffer
|
|
|
|
|
and set the variables that control fetching entries from it.
|
|
|
|
|
Reports an error if no data available.
|
|
|
|
|
This function can read past the end of the symbol table
|
|
|
|
|
(into the string table) but this does no harm. */
|
|
|
|
|
|
|
|
|
|
/* Reading symbol table has to be fast! Keep the followings as macros, rather
|
|
|
|
|
than functions. */
|
|
|
|
|
|
|
|
|
|
#define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, SECTION, OBJFILE) \
|
|
|
|
|
{ \
|
|
|
|
|
char *namestr; \
|
|
|
|
|
namestr = (NAME); \
|
|
|
|
|
if (namestr[0] == '.') ++namestr; \
|
|
|
|
|
prim_record_minimal_symbol_and_info (namestr, (ADDR), (TYPE), \
|
|
|
|
|
(char *)NULL, (SECTION), (asection *)NULL, (OBJFILE)); \
|
|
|
|
|
misc_func_recorded = 1; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
|
|
|
|
|
nested. At any given time, a symbol can only be in one static block.
|
|
|
|
|
This is the base address of current static block, zero if non exists. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
static int static_block_base = 0;
|
|
|
|
|
|
|
|
|
|
/* Section number for the current static block. */
|
|
|
|
|
|
|
|
|
|
static int static_block_section = -1;
|
|
|
|
|
|
|
|
|
|
/* true if space for symbol name has been allocated. */
|
|
|
|
|
|
|
|
|
|
static int symname_alloced = 0;
|
|
|
|
|
|
|
|
|
|
/* Next symbol to read. Pointer into raw seething symbol table. */
|
|
|
|
|
|
|
|
|
|
static char *raw_symbol;
|
|
|
|
|
|
|
|
|
|
/* This is the function which stabsread.c calls to get symbol
|
|
|
|
|
continuations. */
|
|
|
|
|
|
|
|
|
|
static char *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_next_symbol_text (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct internal_syment symbol;
|
|
|
|
|
static struct complaint msg =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Unexpected symbol continuation", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *retval;
|
|
|
|
|
/* FIXME: is this the same as the passed arg? */
|
|
|
|
|
objfile = this_symtab_psymtab->objfile;
|
|
|
|
|
|
|
|
|
|
bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol);
|
|
|
|
|
if (symbol.n_zeroes)
|
|
|
|
|
{
|
|
|
|
|
complain (&msg);
|
|
|
|
|
|
|
|
|
|
/* Return something which points to '\0' and hope the symbol reading
|
1999-07-07 20:19:36 +00:00
|
|
|
|
code does something reasonable. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
retval = "";
|
|
|
|
|
}
|
|
|
|
|
else if (symbol.n_sclass & 0x80)
|
|
|
|
|
{
|
|
|
|
|
retval =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->debugsec
|
|
|
|
|
+ symbol.n_offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
raw_symbol +=
|
|
|
|
|
coff_data (objfile->obfd)->local_symesz;
|
|
|
|
|
++symnum;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
complain (&msg);
|
|
|
|
|
|
|
|
|
|
/* Return something which points to '\0' and hope the symbol reading
|
1999-07-07 20:19:36 +00:00
|
|
|
|
code does something reasonable. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
retval = "";
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read symbols for a given partial symbol table. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
read_xcoff_symtab (struct partial_symtab *pst)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct objfile *objfile = pst->objfile;
|
|
|
|
|
bfd *abfd = objfile->obfd;
|
|
|
|
|
char *raw_auxptr; /* Pointer to first raw aux entry for sym */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
char *strtbl = ((struct coff_symfile_info *) objfile->sym_private)->strtbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *debugsec =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->debugsec;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
char *debugfmt = xcoff_data (abfd)->xcoff64 ? "XCOFF64" : "XCOFF";
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
struct internal_syment symbol[1];
|
|
|
|
|
union internal_auxent main_aux;
|
|
|
|
|
struct coff_symbol cs[1];
|
|
|
|
|
CORE_ADDR file_start_addr = 0;
|
|
|
|
|
CORE_ADDR file_end_addr = 0;
|
|
|
|
|
|
|
|
|
|
int next_file_symnum = -1;
|
|
|
|
|
unsigned int max_symnum;
|
|
|
|
|
int just_started = 1;
|
|
|
|
|
int depth = 0;
|
|
|
|
|
int fcn_start_addr = 0;
|
|
|
|
|
|
|
|
|
|
struct coff_symbol fcn_stab_saved;
|
|
|
|
|
|
|
|
|
|
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
|
|
|
|
|
union internal_auxent fcn_aux_saved;
|
|
|
|
|
struct context_stack *new;
|
|
|
|
|
|
|
|
|
|
char *filestring = " _start_ "; /* Name of the current file. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
char *last_csect_name; /* last seen csect's name and value */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
CORE_ADDR last_csect_val;
|
|
|
|
|
int last_csect_sec;
|
|
|
|
|
|
|
|
|
|
this_symtab_psymtab = pst;
|
|
|
|
|
|
|
|
|
|
/* Get the appropriate COFF "constants" related to the file we're
|
|
|
|
|
handling. */
|
|
|
|
|
local_symesz = coff_data (abfd)->local_symesz;
|
|
|
|
|
|
|
|
|
|
last_source_file = NULL;
|
|
|
|
|
last_csect_name = 0;
|
|
|
|
|
last_csect_val = 0;
|
|
|
|
|
|
|
|
|
|
start_stabs ();
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_symtab (filestring, (char *) NULL, file_start_addr);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
record_debugformat (debugfmt);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
max_symnum =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
symnum + ((struct symloc *) pst->read_symtab_private)->numsyms;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
first_object_file_end = 0;
|
|
|
|
|
|
|
|
|
|
raw_symbol =
|
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->symtbl
|
1999-07-07 20:19:36 +00:00
|
|
|
|
+ symnum * local_symesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
while (symnum < max_symnum)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
QUIT; /* make this command interruptable. */
|
|
|
|
|
|
|
|
|
|
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
|
|
|
|
|
/* read one symbol into `cs' structure. After processing the
|
1999-07-07 20:19:36 +00:00
|
|
|
|
whole symbol table, only string table will be kept in memory,
|
|
|
|
|
symbol table and debug section of xcoff will be freed. Thus
|
|
|
|
|
we can mark symbols with names in string table as
|
|
|
|
|
`alloced'. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int ii;
|
|
|
|
|
|
|
|
|
|
/* Swap and align the symbol into a reasonable C structure. */
|
|
|
|
|
bfd_coff_swap_sym_in (abfd, raw_symbol, symbol);
|
|
|
|
|
|
|
|
|
|
cs->c_symnum = symnum;
|
|
|
|
|
cs->c_naux = symbol->n_numaux;
|
|
|
|
|
if (symbol->n_zeroes)
|
|
|
|
|
{
|
|
|
|
|
symname_alloced = 0;
|
|
|
|
|
/* We must use the original, unswapped, name here so the name field
|
|
|
|
|
pointed to by cs->c_name will persist throughout xcoffread. If
|
|
|
|
|
we use the new field, it gets overwritten for each symbol. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
cs->c_name = ((struct external_syment *) raw_symbol)->e.e_name;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* If it's exactly E_SYMNMLEN characters long it isn't
|
|
|
|
|
'\0'-terminated. */
|
|
|
|
|
if (cs->c_name[E_SYMNMLEN - 1] != '\0')
|
|
|
|
|
{
|
|
|
|
|
char *p;
|
|
|
|
|
p = obstack_alloc (&objfile->symbol_obstack, E_SYMNMLEN + 1);
|
|
|
|
|
strncpy (p, cs->c_name, E_SYMNMLEN);
|
|
|
|
|
p[E_SYMNMLEN] = '\0';
|
|
|
|
|
cs->c_name = p;
|
|
|
|
|
symname_alloced = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (symbol->n_sclass & 0x80)
|
|
|
|
|
{
|
|
|
|
|
cs->c_name = debugsec + symbol->n_offset;
|
|
|
|
|
symname_alloced = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* in string table */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
cs->c_name = strtbl + (int) symbol->n_offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symname_alloced = 1;
|
|
|
|
|
}
|
|
|
|
|
cs->c_value = symbol->n_value;
|
|
|
|
|
cs->c_sclass = symbol->n_sclass;
|
|
|
|
|
cs->c_secnum = symbol->n_scnum;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
cs->c_type = (unsigned) symbol->n_type;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
raw_symbol += local_symesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
++symnum;
|
|
|
|
|
|
|
|
|
|
/* Save addr of first aux entry. */
|
|
|
|
|
raw_auxptr = raw_symbol;
|
|
|
|
|
|
|
|
|
|
/* Skip all the auxents associated with this symbol. */
|
|
|
|
|
for (ii = symbol->n_numaux; ii; --ii)
|
|
|
|
|
{
|
|
|
|
|
raw_symbol += coff_data (abfd)->local_auxesz;
|
|
|
|
|
++symnum;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if symbol name starts with ".$" or "$", ignore it. */
|
|
|
|
|
if (cs->c_name[0] == '$'
|
|
|
|
|
|| (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE)
|
|
|
|
|
{
|
|
|
|
|
if (last_source_file)
|
|
|
|
|
{
|
|
|
|
|
pst->symtab =
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
end_stabs ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start_stabs ();
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
record_debugformat (debugfmt);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
cur_src_end_addr = first_object_file_end;
|
|
|
|
|
/* done with all files, everything from here on is globals */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if explicitly specified as a function, treat is as one. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
|
|
|
|
0, cs->c_naux, &main_aux);
|
|
|
|
|
goto function_entry_point;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT)
|
|
|
|
|
&& cs->c_naux == 1)
|
|
|
|
|
{
|
|
|
|
|
/* Dealing with a symbol with a csect entry. */
|
|
|
|
|
|
|
|
|
|
#define CSECT(PP) ((PP)->x_csect)
|
|
|
|
|
#define CSECT_LEN(PP) (CSECT(PP).x_scnlen.l)
|
|
|
|
|
#define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp))
|
|
|
|
|
#define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp))
|
|
|
|
|
#define CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
|
|
|
|
|
|
|
|
|
|
/* Convert the auxent to something we can access. */
|
|
|
|
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
|
|
|
|
0, cs->c_naux, &main_aux);
|
|
|
|
|
|
|
|
|
|
switch (CSECT_SMTYP (&main_aux))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
case XTY_ER:
|
|
|
|
|
/* Ignore all external references. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case XTY_SD:
|
|
|
|
|
/* A section description. */
|
|
|
|
|
{
|
|
|
|
|
switch (CSECT_SCLAS (&main_aux))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
case XMC_PR:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* A program csect is seen. We have to allocate one
|
1999-07-07 20:19:36 +00:00
|
|
|
|
symbol table for each program csect. Normally gdb
|
|
|
|
|
prefers one symtab for each source file. In case
|
|
|
|
|
of AIX, one source file might include more than one
|
|
|
|
|
[PR] csect, and they don't have to be adjacent in
|
|
|
|
|
terms of the space they occupy in memory. Thus, one
|
|
|
|
|
single source file might get fragmented in the
|
|
|
|
|
memory and gdb's file start and end address
|
|
|
|
|
approach does not work! GCC (and I think xlc) seem
|
|
|
|
|
to put all the code in the unnamed program csect. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (last_csect_name)
|
|
|
|
|
{
|
|
|
|
|
complete_symtab (filestring, file_start_addr);
|
|
|
|
|
cur_src_end_addr = file_end_addr;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
end_stabs ();
|
|
|
|
|
start_stabs ();
|
|
|
|
|
/* Give all csects for this source file the same
|
|
|
|
|
name. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_symtab (filestring, NULL, (CORE_ADDR) 0);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
record_debugformat (debugfmt);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is the very first csect seen,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
basically `__start'. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (just_started)
|
|
|
|
|
{
|
|
|
|
|
first_object_file_end
|
|
|
|
|
= cs->c_value + CSECT_LEN (&main_aux);
|
|
|
|
|
just_started = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file_start_addr =
|
|
|
|
|
cs->c_value + ANOFFSET (objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
|
|
|
|
|
|
|
|
|
|
if (cs->c_name && cs->c_name[0] == '.')
|
|
|
|
|
{
|
|
|
|
|
last_csect_name = cs->c_name;
|
|
|
|
|
last_csect_val = cs->c_value;
|
|
|
|
|
last_csect_sec = secnum_to_section (cs->c_secnum, objfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* All other symbols are put into the minimal symbol
|
|
|
|
|
table only. */
|
|
|
|
|
|
|
|
|
|
case XMC_RW:
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case XMC_TC0:
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case XMC_TC:
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* Ignore the symbol. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XTY_LD:
|
|
|
|
|
|
|
|
|
|
switch (CSECT_SCLAS (&main_aux))
|
|
|
|
|
{
|
|
|
|
|
case XMC_PR:
|
|
|
|
|
/* a function entry point. */
|
|
|
|
|
function_entry_point:
|
|
|
|
|
|
|
|
|
|
fcn_start_addr = cs->c_value;
|
|
|
|
|
|
|
|
|
|
/* save the function header info, which will be used
|
|
|
|
|
when `.bf' is seen. */
|
|
|
|
|
fcn_cs_saved = *cs;
|
|
|
|
|
fcn_aux_saved = main_aux;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case XMC_GL:
|
|
|
|
|
/* shared library function trampoline code entry point. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case XMC_DS:
|
|
|
|
|
/* The symbols often have the same names as debug symbols for
|
|
|
|
|
functions, and confuse lookup_symbol. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* xlc puts each variable in a separate csect, so we get
|
|
|
|
|
an XTY_SD for each variable. But gcc puts several
|
|
|
|
|
variables in a csect, so that each variable only gets
|
|
|
|
|
an XTY_LD. This will typically be XMC_RW; I suspect
|
|
|
|
|
XMC_RO and XMC_BS might be possible too.
|
|
|
|
|
These variables are put in the minimal symbol table
|
|
|
|
|
only. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XTY_CM:
|
|
|
|
|
/* Common symbols are put into the minimal symbol table only. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (cs->c_sclass)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
case C_FILE:
|
|
|
|
|
|
|
|
|
|
/* c_value field contains symnum of next .file entry in table
|
|
|
|
|
or symnum of first global after last .file. */
|
|
|
|
|
|
|
|
|
|
next_file_symnum = cs->c_value;
|
|
|
|
|
|
|
|
|
|
/* Complete symbol table for last object file containing
|
|
|
|
|
debugging information. */
|
|
|
|
|
|
|
|
|
|
/* Whether or not there was a csect in the previous file, we
|
|
|
|
|
have to call `end_stabs' and `start_stabs' to reset
|
|
|
|
|
type_vector, line_vector, etc. structures. */
|
|
|
|
|
|
|
|
|
|
complete_symtab (filestring, file_start_addr);
|
|
|
|
|
cur_src_end_addr = file_end_addr;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
end_stabs ();
|
|
|
|
|
|
|
|
|
|
/* XCOFF, according to the AIX 3.2 documentation, puts the filename
|
|
|
|
|
in cs->c_name. But xlc 1.3.0.2 has decided to do things the
|
|
|
|
|
standard COFF way and put it in the auxent. We use the auxent if
|
|
|
|
|
the symbol is ".file" and an auxent exists, otherwise use the symbol
|
|
|
|
|
itself. Simple enough. */
|
|
|
|
|
if (!strcmp (cs->c_name, ".file") && cs->c_naux > 0)
|
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
|
|
|
|
0, cs->c_naux, &main_aux);
|
|
|
|
|
filestring = coff_getfilename (&main_aux, objfile);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
filestring = cs->c_name;
|
|
|
|
|
|
|
|
|
|
start_stabs ();
|
1999-07-07 20:19:36 +00:00
|
|
|
|
start_symtab (filestring, (char *) NULL, (CORE_ADDR) 0);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
record_debugformat (debugfmt);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
last_csect_name = 0;
|
|
|
|
|
|
|
|
|
|
/* reset file start and end addresses. A compilation unit with no text
|
|
|
|
|
(only data) should have zero file boundaries. */
|
|
|
|
|
file_start_addr = file_end_addr = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_FUN:
|
|
|
|
|
fcn_stab_saved = *cs;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_FCN:
|
|
|
|
|
if (STREQ (cs->c_name, ".bf"))
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR off = ANOFFSET (objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
|
|
|
|
0, cs->c_naux, &main_aux);
|
|
|
|
|
|
|
|
|
|
within_function = 1;
|
|
|
|
|
|
|
|
|
|
new = push_context (0, fcn_start_addr + off);
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
new->name = define_symbol
|
1999-04-16 01:35:26 +00:00
|
|
|
|
(fcn_cs_saved.c_value + off,
|
|
|
|
|
fcn_stab_saved.c_name, 0, 0, objfile);
|
|
|
|
|
if (new->name != NULL)
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else if (STREQ (cs->c_name, ".ef"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
|
|
|
|
0, cs->c_naux, &main_aux);
|
|
|
|
|
|
|
|
|
|
/* The value of .ef is the address of epilogue code;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
not useful for gdb. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
|
1999-07-07 20:19:36 +00:00
|
|
|
|
contains number of lines to '}' */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (context_stack_depth <= 0)
|
|
|
|
|
{ /* We attempted to pop an empty context stack */
|
|
|
|
|
complain (&ef_complaint, cs->c_symnum);
|
|
|
|
|
within_function = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
new = pop_context ();
|
|
|
|
|
/* Stack must be empty now. */
|
|
|
|
|
if (context_stack_depth > 0 || new == NULL)
|
|
|
|
|
{
|
|
|
|
|
complain (&ef_complaint, cs->c_symnum);
|
|
|
|
|
within_function = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
finish_block (new->name, &local_symbols, new->old_blocks,
|
|
|
|
|
new->start_addr,
|
|
|
|
|
(fcn_cs_saved.c_value
|
|
|
|
|
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
|
|
|
|
+ ANOFFSET (objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (objfile))),
|
1999-04-16 01:35:26 +00:00
|
|
|
|
objfile);
|
|
|
|
|
within_function = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_BSTAT:
|
|
|
|
|
/* Begin static block. */
|
|
|
|
|
{
|
|
|
|
|
struct internal_syment symbol;
|
|
|
|
|
|
|
|
|
|
read_symbol (&symbol, cs->c_value);
|
|
|
|
|
static_block_base = symbol.n_value;
|
|
|
|
|
static_block_section =
|
|
|
|
|
secnum_to_section (symbol.n_scnum, objfile);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_ESTAT:
|
|
|
|
|
/* End of static block. */
|
|
|
|
|
static_block_base = 0;
|
|
|
|
|
static_block_section = -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_ARG:
|
|
|
|
|
case C_REGPARM:
|
|
|
|
|
case C_REG:
|
|
|
|
|
case C_TPDEF:
|
|
|
|
|
case C_STRTAG:
|
|
|
|
|
case C_UNTAG:
|
|
|
|
|
case C_ENTAG:
|
|
|
|
|
{
|
|
|
|
|
static struct complaint msg =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Unrecognized storage class %d.", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg, cs->c_sclass);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_LABEL:
|
|
|
|
|
case C_NULL:
|
|
|
|
|
/* Ignore these. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_HIDEXT:
|
|
|
|
|
case C_STAT:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_BINCL:
|
|
|
|
|
/* beginning of include file */
|
|
|
|
|
/* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted
|
|
|
|
|
order. Thus, when wee see them, we might not know enough info
|
|
|
|
|
to process them. Thus, we'll be saving them into a table
|
|
|
|
|
(inclTable) and postpone their processing. */
|
|
|
|
|
|
|
|
|
|
record_include_begin (cs);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_EINCL:
|
|
|
|
|
/* End of include file. */
|
|
|
|
|
/* See the comment after case C_BINCL. */
|
|
|
|
|
record_include_end (cs);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_BLOCK:
|
|
|
|
|
if (STREQ (cs->c_name, ".bb"))
|
|
|
|
|
{
|
|
|
|
|
depth++;
|
|
|
|
|
new = push_context (depth,
|
|
|
|
|
(cs->c_value
|
|
|
|
|
+ ANOFFSET (objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (objfile))));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else if (STREQ (cs->c_name, ".eb"))
|
|
|
|
|
{
|
|
|
|
|
if (context_stack_depth <= 0)
|
|
|
|
|
{ /* We attempted to pop an empty context stack */
|
|
|
|
|
complain (&eb_complaint, cs->c_symnum);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
new = pop_context ();
|
|
|
|
|
if (depth-- != new->depth)
|
|
|
|
|
{
|
|
|
|
|
complain (&eb_complaint, cs->c_symnum);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (local_symbols && context_stack_depth > 0)
|
|
|
|
|
{
|
|
|
|
|
/* Make a block for the local symbols within. */
|
|
|
|
|
finish_block (new->name, &local_symbols, new->old_blocks,
|
|
|
|
|
new->start_addr,
|
|
|
|
|
(cs->c_value
|
|
|
|
|
+ ANOFFSET (objfile->section_offsets,
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
SECT_OFF_TEXT (objfile))),
|
1999-04-16 01:35:26 +00:00
|
|
|
|
objfile);
|
|
|
|
|
}
|
|
|
|
|
local_symbols = new->locals;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
process_xcoff_symbol (cs, objfile);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (last_source_file)
|
|
|
|
|
{
|
|
|
|
|
struct symtab *s;
|
|
|
|
|
|
|
|
|
|
complete_symtab (filestring, file_start_addr);
|
|
|
|
|
cur_src_end_addr = file_end_addr;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* When reading symbols for the last C_FILE of the objfile, try
|
|
|
|
|
to make sure that we set pst->symtab to the symtab for the
|
|
|
|
|
file, not to the _globals_ symtab. I'm not sure whether this
|
|
|
|
|
actually works right or when/if it comes up. */
|
|
|
|
|
if (pst->symtab == NULL)
|
|
|
|
|
pst->symtab = s;
|
|
|
|
|
end_stabs ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define SYMBOL_DUP(SYMBOL1, SYMBOL2) \
|
|
|
|
|
(SYMBOL2) = (struct symbol *) \
|
|
|
|
|
obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \
|
|
|
|
|
*(SYMBOL2) = *(SYMBOL1);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#define SYMNAME_ALLOC(NAME, ALLOCED) \
|
|
|
|
|
(ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->symbol_obstack);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct type *func_symbol_type;
|
|
|
|
|
static struct type *var_symbol_type;
|
|
|
|
|
|
|
|
|
|
/* process one xcoff symbol. */
|
|
|
|
|
|
|
|
|
|
static struct symbol *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct symbol onesymbol;
|
|
|
|
|
register struct symbol *sym = &onesymbol;
|
|
|
|
|
struct symbol *sym2 = NULL;
|
|
|
|
|
char *name, *pp;
|
|
|
|
|
|
|
|
|
|
int sec;
|
|
|
|
|
CORE_ADDR off;
|
|
|
|
|
|
|
|
|
|
if (cs->c_secnum < 0)
|
|
|
|
|
{
|
|
|
|
|
/* The value is a register number, offset within a frame, etc.,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
and does not get relocated. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
off = 0;
|
|
|
|
|
sec = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sec = secnum_to_section (cs->c_secnum, objfile);
|
|
|
|
|
off = ANOFFSET (objfile->section_offsets, sec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = cs->c_name;
|
|
|
|
|
if (name[0] == '.')
|
|
|
|
|
++name;
|
|
|
|
|
|
|
|
|
|
memset (sym, '\0', sizeof (struct symbol));
|
|
|
|
|
|
|
|
|
|
/* default assumptions */
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
|
|
|
|
SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile);
|
|
|
|
|
|
|
|
|
|
if (ISFCN (cs->c_type))
|
|
|
|
|
{
|
|
|
|
|
/* At this point, we don't know the type of the function. This
|
1999-07-07 20:19:36 +00:00
|
|
|
|
will be patched with the type from its stab entry later on in
|
|
|
|
|
patch_block_stabs (), unless the file was compiled without -g. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
|
|
|
|
|
SYMBOL_TYPE (sym) = func_symbol_type;
|
|
|
|
|
|
|
|
|
|
SYMBOL_CLASS (sym) = LOC_BLOCK;
|
|
|
|
|
SYMBOL_DUP (sym, sym2);
|
|
|
|
|
|
|
|
|
|
if (cs->c_sclass == C_EXT)
|
|
|
|
|
add_symbol_to_list (sym2, &global_symbols);
|
|
|
|
|
else if (cs->c_sclass == C_HIDEXT || cs->c_sclass == C_STAT)
|
|
|
|
|
add_symbol_to_list (sym2, &file_symbols);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* In case we can't figure out the type, provide default. */
|
|
|
|
|
SYMBOL_TYPE (sym) = var_symbol_type;
|
|
|
|
|
|
|
|
|
|
switch (cs->c_sclass)
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
1999-07-07 20:19:36 +00:00
|
|
|
|
/* The values of functions and global symbols are now resolved
|
|
|
|
|
via the global_sym_chain in stabsread.c. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
case C_FUN:
|
|
|
|
|
if (fcn_cs_saved.c_sclass == C_EXT)
|
|
|
|
|
add_stab_to_list (name, &global_stabs);
|
|
|
|
|
else
|
|
|
|
|
add_stab_to_list (name, &file_stabs);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_GSYM:
|
|
|
|
|
add_stab_to_list (name, &global_stabs);
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
case C_BCOMM:
|
|
|
|
|
common_block_start (cs->c_name, objfile);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_ECOMM:
|
|
|
|
|
common_block_end (objfile);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
complain (&storclass_complaint, cs->c_sclass);
|
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
|
|
case C_DECL:
|
|
|
|
|
case C_PSYM:
|
|
|
|
|
case C_RPSYM:
|
|
|
|
|
case C_ECOML:
|
|
|
|
|
case C_LSYM:
|
|
|
|
|
case C_RSYM:
|
|
|
|
|
case C_GSYM:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
sym = define_symbol (cs->c_value + off, cs->c_name, 0, 0, objfile);
|
|
|
|
|
if (sym != NULL)
|
|
|
|
|
{
|
|
|
|
|
SYMBOL_SECTION (sym) = sec;
|
|
|
|
|
}
|
|
|
|
|
return sym;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case C_STSYM:
|
|
|
|
|
|
|
|
|
|
/* For xlc (not GCC), the 'V' symbol descriptor is used for
|
|
|
|
|
all statics and we need to distinguish file-scope versus
|
|
|
|
|
function-scope using within_function. We do this by
|
|
|
|
|
changing the string we pass to define_symbol to use 'S'
|
|
|
|
|
where we need to, which is not necessarily super-clean,
|
|
|
|
|
but seems workable enough. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (*name == ':' || (pp = (char *) strchr (name, ':')) == NULL)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
++pp;
|
|
|
|
|
if (*pp == 'V' && !within_function)
|
|
|
|
|
*pp = 'S';
|
|
|
|
|
sym = define_symbol ((cs->c_value
|
|
|
|
|
+ ANOFFSET (objfile->section_offsets,
|
|
|
|
|
static_block_section)),
|
|
|
|
|
cs->c_name, 0, 0, objfile);
|
|
|
|
|
if (sym != NULL)
|
|
|
|
|
{
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
SYMBOL_VALUE_ADDRESS (sym) += static_block_base;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
SYMBOL_SECTION (sym) = static_block_section;
|
|
|
|
|
}
|
|
|
|
|
return sym;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sym2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Extract the file name from the aux entry of a C_FILE symbol.
|
|
|
|
|
Result is in static storage and is only good for temporary use. */
|
|
|
|
|
|
|
|
|
|
static char *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
coff_getfilename (union internal_auxent *aux_entry, struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
static char buffer[BUFSIZ];
|
|
|
|
|
|
|
|
|
|
if (aux_entry->x_file.x_n.x_zeroes == 0)
|
|
|
|
|
strcpy (buffer,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->strtbl
|
1999-04-16 01:35:26 +00:00
|
|
|
|
+ aux_entry->x_file.x_n.x_offset);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
|
|
|
|
|
buffer[FILNMLEN] = '\0';
|
|
|
|
|
}
|
|
|
|
|
return (buffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set *SYMBOL to symbol number symno in symtbl. */
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
read_symbol (struct internal_syment *symbol, int symno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int nsyms =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
|
|
|
|
|
->symtbl_num_syms;
|
|
|
|
|
char *stbl =
|
|
|
|
|
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
|
|
|
|
|
->symtbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (symno < 0 || symno >= nsyms)
|
|
|
|
|
{
|
|
|
|
|
static struct complaint msg =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Invalid symbol offset", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg);
|
|
|
|
|
symbol->n_value = 0;
|
|
|
|
|
symbol->n_scnum = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bfd_coff_swap_sym_in (this_symtab_psymtab->objfile->obfd,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
stbl + (symno * local_symesz),
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symbol);
|
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Get value corresponding to symbol number symno in symtbl. */
|
|
|
|
|
|
2000-07-07 22:00:09 +00:00
|
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
|
read_symbol_nvalue (int symno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct internal_syment symbol[1];
|
|
|
|
|
|
|
|
|
|
read_symbol (symbol, symno);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return symbol->n_value;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the address of the function corresponding to symno, where
|
|
|
|
|
symno is the symbol pointed to by the linetable. */
|
|
|
|
|
|
|
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
read_symbol_lineno (int symno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
struct objfile *objfile = this_symtab_psymtab->objfile;
|
|
|
|
|
boolean xcoff64 = xcoff_data (objfile->obfd)->xcoff64;
|
|
|
|
|
|
|
|
|
|
struct coff_symfile_info *info =
|
|
|
|
|
(struct coff_symfile_info *)objfile->sym_private;
|
|
|
|
|
int nsyms = info->symtbl_num_syms;
|
|
|
|
|
char *stbl = info->symtbl;
|
|
|
|
|
char *strtbl = info->strtbl;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
struct internal_syment symbol[1];
|
|
|
|
|
union internal_auxent main_aux[1];
|
|
|
|
|
|
|
|
|
|
if (symno < 0)
|
|
|
|
|
{
|
|
|
|
|
complain (&bf_notfound_complaint);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Note that just searching for a short distance (e.g. 50 symbols)
|
|
|
|
|
is not enough, at least in the following case.
|
|
|
|
|
|
|
|
|
|
.extern foo
|
|
|
|
|
[many .stabx entries]
|
|
|
|
|
[a few functions, referring to foo]
|
|
|
|
|
.globl foo
|
|
|
|
|
.bf
|
|
|
|
|
|
|
|
|
|
What happens here is that the assembler moves the .stabx entries
|
|
|
|
|
to right before the ".bf" for foo, but the symbol for "foo" is before
|
|
|
|
|
all the stabx entries. See PR gdb/2222. */
|
|
|
|
|
|
|
|
|
|
/* Maintaining a table of .bf entries might be preferable to this search.
|
|
|
|
|
If I understand things correctly it would need to be done only for
|
|
|
|
|
the duration of a single psymtab to symtab conversion. */
|
|
|
|
|
while (symno < nsyms)
|
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_sym_in (symfile_bfd,
|
|
|
|
|
stbl + (symno * local_symesz), symbol);
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
if (symbol->n_sclass == C_FCN)
|
|
|
|
|
{
|
|
|
|
|
char *name = xcoff64 ? strtbl + symbol->n_offset : symbol->n_name;
|
|
|
|
|
if (STREQ (name, ".bf"))
|
|
|
|
|
goto gotit;
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symno += symbol->n_numaux + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
complain (&bf_notfound_complaint);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
gotit:
|
|
|
|
|
/* take aux entry and return its lineno */
|
|
|
|
|
symno++;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
bfd_coff_swap_aux_in (objfile->obfd, stbl + symno * local_symesz,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symbol->n_type, symbol->n_sclass,
|
|
|
|
|
0, symbol->n_numaux, main_aux);
|
|
|
|
|
|
|
|
|
|
return main_aux->x_sym.x_misc.x_lnsz.x_lnno;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Support for line number handling */
|
|
|
|
|
|
|
|
|
|
/* This function is called for every section; it finds the outer limits
|
|
|
|
|
* of the line table (minimum and maximum file offset) so that the
|
|
|
|
|
* mainline code can read the whole thing for efficiency.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct coff_symfile_info *info;
|
|
|
|
|
int size, count;
|
|
|
|
|
file_ptr offset, maxoff;
|
|
|
|
|
|
|
|
|
|
count = asect->lineno_count;
|
|
|
|
|
|
|
|
|
|
if (!STREQ (asect->name, ".text") || count == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
size = count * coff_data (abfd)->local_linesz;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
info = (struct coff_symfile_info *) vpinfo;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
offset = asect->line_filepos;
|
|
|
|
|
maxoff = offset + size;
|
|
|
|
|
|
|
|
|
|
if (offset < info->min_lineno_offset || info->min_lineno_offset == 0)
|
|
|
|
|
info->min_lineno_offset = offset;
|
|
|
|
|
|
|
|
|
|
if (maxoff > info->max_lineno_offset)
|
|
|
|
|
info->max_lineno_offset = maxoff;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_psymtab_to_symtab_1 (struct partial_symtab *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct cleanup *old_chain;
|
|
|
|
|
int i;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (!pst)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pst->readin)
|
|
|
|
|
{
|
|
|
|
|
fprintf_unfiltered
|
|
|
|
|
(gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
|
|
|
|
|
pst->filename);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read in all partial symtabs on which this one is dependent */
|
|
|
|
|
for (i = 0; i < pst->number_of_dependencies; i++)
|
|
|
|
|
if (!pst->dependencies[i]->readin)
|
|
|
|
|
{
|
|
|
|
|
/* Inform about additional files that need to be read in. */
|
|
|
|
|
if (info_verbose)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered (" ", gdb_stdout);
|
|
|
|
|
wrap_here ("");
|
|
|
|
|
fputs_filtered ("and ", gdb_stdout);
|
|
|
|
|
wrap_here ("");
|
|
|
|
|
printf_filtered ("%s...", pst->dependencies[i]->filename);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
wrap_here (""); /* Flush output */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
gdb_flush (gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
xcoff_psymtab_to_symtab_1 (pst->dependencies[i]);
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* Init stuff necessary for reading in symbols. */
|
|
|
|
|
stabsread_init ();
|
|
|
|
|
buildsym_init ();
|
1999-08-02 23:48:37 +00:00
|
|
|
|
old_chain = make_cleanup (really_free_pendings, 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
read_xcoff_symtab (pst);
|
|
|
|
|
sort_symtab_syms (pst->symtab);
|
|
|
|
|
|
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pst->readin = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void xcoff_psymtab_to_symtab (struct partial_symtab *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Read in all of the symbols for a given psymtab for real.
|
|
|
|
|
Be verbose about it if the user wants that. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_psymtab_to_symtab (struct partial_symtab *pst)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
bfd *sym_bfd;
|
|
|
|
|
|
|
|
|
|
if (!pst)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pst->readin)
|
|
|
|
|
{
|
|
|
|
|
fprintf_unfiltered
|
|
|
|
|
(gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
|
|
|
|
|
pst->filename);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (((struct symloc *) pst->read_symtab_private)->numsyms != 0
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|| pst->number_of_dependencies)
|
|
|
|
|
{
|
|
|
|
|
/* Print the message now, before reading the string table,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
to avoid disconcerting pauses. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (info_verbose)
|
|
|
|
|
{
|
|
|
|
|
printf_filtered ("Reading in symbols for %s...", pst->filename);
|
|
|
|
|
gdb_flush (gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sym_bfd = pst->objfile->obfd;
|
|
|
|
|
|
|
|
|
|
next_symbol_text_func = xcoff_next_symbol_text;
|
|
|
|
|
|
|
|
|
|
xcoff_psymtab_to_symtab_1 (pst);
|
|
|
|
|
|
|
|
|
|
/* Match with global symbols. This only needs to be done once,
|
|
|
|
|
after all of the symtabs and dependencies have been read in. */
|
|
|
|
|
scan_file_globals (pst->objfile);
|
|
|
|
|
|
|
|
|
|
/* Finish up the debug error message. */
|
|
|
|
|
if (info_verbose)
|
|
|
|
|
printf_filtered ("done.\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_new_init (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
stabsread_new_init ();
|
|
|
|
|
buildsym_new_init ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Do initialization in preparation for reading symbols from OBJFILE.
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
We will only be called if this is an XCOFF or XCOFF-like file.
|
|
|
|
|
BFD handles figuring out the format of the file, and code in symfile.c
|
|
|
|
|
uses BFD's determination to vector to us. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_symfile_init (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* Allocate struct to keep track of the symfile */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
objfile->sym_private = xmmalloc (objfile->md,
|
|
|
|
|
sizeof (struct coff_symfile_info));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* XCOFF objects may be reordered, so set OBJF_REORDERED. If we
|
|
|
|
|
find this causes a significant slowdown in gdb then we could
|
|
|
|
|
set it in the debug symbol readers only when necessary. */
|
|
|
|
|
objfile->flags |= OBJF_REORDERED;
|
|
|
|
|
|
|
|
|
|
init_entry_point_info (objfile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Perform any local cleanups required when we are done with a particular
|
|
|
|
|
objfile. I.E, we are in the process of discarding all symbol information
|
|
|
|
|
for an objfile, freeing up all memory held for it, and unlinking the
|
|
|
|
|
objfile struct from the global list of known objfiles. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_symfile_finish (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (objfile->sym_private != NULL)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
mfree (objfile->md, objfile->sym_private);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Start with a fresh include table for the next objfile. */
|
|
|
|
|
if (inclTable)
|
|
|
|
|
{
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (inclTable);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
inclTable = NULL;
|
|
|
|
|
}
|
|
|
|
|
inclIndx = inclLength = inclDepth = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
long length;
|
|
|
|
|
int val;
|
|
|
|
|
unsigned char lengthbuf[4];
|
|
|
|
|
char *strtbl;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->strtbl = NULL;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
|
|
|
|
|
error ("cannot seek to string table in %s: %s",
|
|
|
|
|
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
val = bfd_read ((char *) lengthbuf, 1, sizeof lengthbuf, abfd);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
length = bfd_h_get_32 (abfd, lengthbuf);
|
|
|
|
|
|
|
|
|
|
/* If no string table is needed, then the file may end immediately
|
|
|
|
|
after the symbols. Just return with `strtbl' set to NULL. */
|
|
|
|
|
|
|
|
|
|
if (val != sizeof lengthbuf || length < sizeof lengthbuf)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Allocate string table from symbol_obstack. We will need this table
|
|
|
|
|
as long as we have its symbol table around. */
|
|
|
|
|
|
|
|
|
|
strtbl = (char *) obstack_alloc (&objfile->symbol_obstack, length);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->strtbl = strtbl;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Copy length buffer, the first byte is usually zero and is
|
|
|
|
|
used for stabs with a name length of zero. */
|
|
|
|
|
memcpy (strtbl, lengthbuf, sizeof lengthbuf);
|
|
|
|
|
if (length == sizeof lengthbuf)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
val = bfd_read (strtbl + sizeof lengthbuf, 1, length - sizeof lengthbuf,
|
|
|
|
|
abfd);
|
|
|
|
|
|
|
|
|
|
if (val != length - sizeof lengthbuf)
|
|
|
|
|
error ("cannot read string table from %s: %s",
|
|
|
|
|
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
if (strtbl[length - 1] != '\0')
|
|
|
|
|
error ("bad symbol file: string table does not end with null character");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we have not yet seen a function for this psymtab, this is 0. If we
|
|
|
|
|
have seen one, it is the offset in the line numbers of the line numbers
|
|
|
|
|
for the psymtab. */
|
|
|
|
|
static unsigned int first_fun_line_offset;
|
|
|
|
|
|
|
|
|
|
static struct partial_symtab *xcoff_start_psymtab
|
2000-05-28 01:12:42 +00:00
|
|
|
|
(struct objfile *, char *, int,
|
|
|
|
|
struct partial_symbol **, struct partial_symbol **);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Allocate and partially fill a partial symtab. It will be
|
|
|
|
|
completely filled at the end of the symbol list.
|
|
|
|
|
|
|
|
|
|
SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
|
|
|
|
|
is the address relative to which its symbols are (incremental) or 0
|
|
|
|
|
(normal). */
|
|
|
|
|
|
|
|
|
|
static struct partial_symtab *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
|
|
|
|
|
struct partial_symbol **global_syms,
|
|
|
|
|
struct partial_symbol **static_syms)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
struct partial_symtab *result =
|
1999-09-09 00:02:17 +00:00
|
|
|
|
start_psymtab_common (objfile, objfile->section_offsets,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
filename,
|
1999-09-09 00:02:17 +00:00
|
|
|
|
/* We fill in textlow later. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
0,
|
|
|
|
|
global_syms, static_syms);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
result->read_symtab_private = (char *)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
|
|
|
|
|
((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
result->read_symtab = xcoff_psymtab_to_symtab;
|
|
|
|
|
|
|
|
|
|
/* Deduce the source language from the filename for this psymtab. */
|
|
|
|
|
psymtab_language = deduce_language_from_filename (filename);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct partial_symtab *xcoff_end_psymtab
|
2000-05-28 01:12:42 +00:00
|
|
|
|
(struct partial_symtab *, char **, int, int,
|
|
|
|
|
struct partial_symtab **, int, int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Close off the current usage of PST.
|
|
|
|
|
Returns PST, or NULL if the partial symtab was empty and thrown away.
|
|
|
|
|
|
|
|
|
|
CAPPING_SYMBOL_NUMBER is the end of pst (exclusive).
|
|
|
|
|
|
|
|
|
|
INCLUDE_LIST, NUM_INCLUDES, DEPENDENCY_LIST, and NUMBER_DEPENDENCIES
|
|
|
|
|
are the information for includes and dependencies. */
|
|
|
|
|
|
|
|
|
|
static struct partial_symtab *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
|
|
|
|
|
int num_includes, int capping_symbol_number,
|
|
|
|
|
struct partial_symtab **dependency_list,
|
|
|
|
|
int number_dependencies, int textlow_not_set)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
struct objfile *objfile = pst->objfile;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (capping_symbol_number != -1)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct symloc *) pst->read_symtab_private)->numsyms =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
capping_symbol_number
|
1999-07-07 20:19:36 +00:00
|
|
|
|
- ((struct symloc *) pst->read_symtab_private)->first_symnum;
|
|
|
|
|
((struct symloc *) pst->read_symtab_private)->lineno_off =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
first_fun_line_offset;
|
|
|
|
|
first_fun_line_offset = 0;
|
|
|
|
|
pst->n_global_syms =
|
|
|
|
|
objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
|
|
|
|
|
pst->n_static_syms =
|
|
|
|
|
objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset);
|
|
|
|
|
|
|
|
|
|
pst->number_of_dependencies = number_dependencies;
|
|
|
|
|
if (number_dependencies)
|
|
|
|
|
{
|
|
|
|
|
pst->dependencies = (struct partial_symtab **)
|
|
|
|
|
obstack_alloc (&objfile->psymbol_obstack,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
number_dependencies * sizeof (struct partial_symtab *));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
memcpy (pst->dependencies, dependency_list,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
number_dependencies * sizeof (struct partial_symtab *));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
pst->dependencies = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_includes; i++)
|
|
|
|
|
{
|
|
|
|
|
struct partial_symtab *subpst =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
allocate_psymtab (include_list[i], objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
subpst->section_offsets = pst->section_offsets;
|
|
|
|
|
subpst->read_symtab_private =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
(char *) obstack_alloc (&objfile->psymbol_obstack,
|
|
|
|
|
sizeof (struct symloc));
|
|
|
|
|
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
|
|
|
|
|
((struct symloc *) subpst->read_symtab_private)->numsyms = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
subpst->textlow = 0;
|
|
|
|
|
subpst->texthigh = 0;
|
|
|
|
|
|
|
|
|
|
/* We could save slight bits of space by only making one of these,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
shared by the entire set of include files. FIXME-someday. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
subpst->dependencies = (struct partial_symtab **)
|
|
|
|
|
obstack_alloc (&objfile->psymbol_obstack,
|
|
|
|
|
sizeof (struct partial_symtab *));
|
|
|
|
|
subpst->dependencies[0] = pst;
|
|
|
|
|
subpst->number_of_dependencies = 1;
|
|
|
|
|
|
|
|
|
|
subpst->globals_offset =
|
|
|
|
|
subpst->n_global_syms =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
subpst->statics_offset =
|
|
|
|
|
subpst->n_static_syms = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
subpst->readin = 0;
|
|
|
|
|
subpst->symtab = 0;
|
|
|
|
|
subpst->read_symtab = pst->read_symtab;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sort_pst_symbols (pst);
|
|
|
|
|
|
|
|
|
|
/* If there is already a psymtab or symtab for a file of this name,
|
|
|
|
|
remove it. (If there is a symtab, more drastic things also
|
|
|
|
|
happen.) This happens in VxWorks. */
|
|
|
|
|
free_named_symtabs (pst->filename);
|
|
|
|
|
|
|
|
|
|
if (num_includes == 0
|
|
|
|
|
&& number_dependencies == 0
|
|
|
|
|
&& pst->n_global_syms == 0
|
|
|
|
|
&& pst->n_static_syms == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Throw away this psymtab, it's empty. We can't deallocate it, since
|
1999-07-07 20:19:36 +00:00
|
|
|
|
it is on the obstack, but we can forget to chain it on the list. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Empty psymtabs happen as a result of header files which don't have
|
1999-07-07 20:19:36 +00:00
|
|
|
|
any symbols in them. There can be a lot of them. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
discard_psymtab (pst);
|
|
|
|
|
|
|
|
|
|
/* Indicate that psymtab was thrown away. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
pst = (struct partial_symtab *) NULL;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
return pst;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void swap_sym (struct internal_syment *,
|
|
|
|
|
union internal_auxent *, char **, char **,
|
|
|
|
|
unsigned int *, struct objfile *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Swap raw symbol at *RAW and put the name in *NAME, the symbol in
|
|
|
|
|
*SYMBOL, the first auxent in *AUX. Advance *RAW and *SYMNUMP over
|
|
|
|
|
the symbol and its auxents. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
|
|
|
|
|
char **name, char **raw, unsigned int *symnump,
|
|
|
|
|
struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_sym_in (objfile->obfd, *raw, symbol);
|
|
|
|
|
if (symbol->n_zeroes)
|
|
|
|
|
{
|
|
|
|
|
/* If it's exactly E_SYMNMLEN characters long it isn't
|
1999-07-07 20:19:36 +00:00
|
|
|
|
'\0'-terminated. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (symbol->n_name[E_SYMNMLEN - 1] != '\0')
|
|
|
|
|
{
|
|
|
|
|
/* FIXME: wastes memory for symbols which we don't end up putting
|
|
|
|
|
into the minimal symbols. */
|
|
|
|
|
char *p;
|
|
|
|
|
p = obstack_alloc (&objfile->psymbol_obstack, E_SYMNMLEN + 1);
|
|
|
|
|
strncpy (p, symbol->n_name, E_SYMNMLEN);
|
|
|
|
|
p[E_SYMNMLEN] = '\0';
|
|
|
|
|
*name = p;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* Point to the unswapped name as that persists as long as the
|
|
|
|
|
objfile does. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
*name = ((struct external_syment *) *raw)->e.e_name;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else if (symbol->n_sclass & 0x80)
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
*name = ((struct coff_symfile_info *) objfile->sym_private)->debugsec
|
1999-04-16 01:35:26 +00:00
|
|
|
|
+ symbol->n_offset;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
*name = ((struct coff_symfile_info *) objfile->sym_private)->strtbl
|
1999-04-16 01:35:26 +00:00
|
|
|
|
+ symbol->n_offset;
|
|
|
|
|
}
|
|
|
|
|
++*symnump;
|
|
|
|
|
*raw += coff_data (objfile->obfd)->local_symesz;
|
|
|
|
|
if (symbol->n_numaux > 0)
|
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_aux_in (objfile->obfd, *raw, symbol->n_type,
|
|
|
|
|
symbol->n_sclass, 0, symbol->n_numaux, aux);
|
|
|
|
|
|
|
|
|
|
*symnump += symbol->n_numaux;
|
|
|
|
|
*raw += coff_data (objfile->obfd)->local_symesz * symbol->n_numaux;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
scan_xcoff_symtab (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
char *filestring = NULL;
|
|
|
|
|
|
|
|
|
|
char *namestring;
|
|
|
|
|
int past_first_source_file = 0;
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *bfd_sect;
|
|
|
|
|
unsigned int nsyms;
|
|
|
|
|
|
|
|
|
|
/* Current partial symtab */
|
|
|
|
|
struct partial_symtab *pst;
|
|
|
|
|
|
|
|
|
|
/* List of current psymtab's include files */
|
|
|
|
|
char **psymtab_include_list;
|
|
|
|
|
int includes_allocated;
|
|
|
|
|
int includes_used;
|
|
|
|
|
|
|
|
|
|
/* Index within current psymtab dependency list */
|
|
|
|
|
struct partial_symtab **dependency_list;
|
|
|
|
|
int dependencies_used, dependencies_allocated;
|
|
|
|
|
|
|
|
|
|
char *sraw_symbol;
|
|
|
|
|
struct internal_syment symbol;
|
1999-08-09 21:36:23 +00:00
|
|
|
|
union internal_auxent main_aux[5];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
unsigned int ssymnum;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
char *last_csect_name = NULL; /* last seen csect's name and value */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
CORE_ADDR last_csect_val = 0;
|
|
|
|
|
int last_csect_sec = 0;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int misc_func_recorded = 0; /* true if any misc. function */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
int textlow_not_set = 1;
|
|
|
|
|
|
|
|
|
|
pst = (struct partial_symtab *) 0;
|
|
|
|
|
|
|
|
|
|
includes_allocated = 30;
|
|
|
|
|
includes_used = 0;
|
|
|
|
|
psymtab_include_list = (char **) alloca (includes_allocated *
|
|
|
|
|
sizeof (char *));
|
|
|
|
|
|
|
|
|
|
dependencies_allocated = 30;
|
|
|
|
|
dependencies_used = 0;
|
|
|
|
|
dependency_list =
|
|
|
|
|
(struct partial_symtab **) alloca (dependencies_allocated *
|
|
|
|
|
sizeof (struct partial_symtab *));
|
|
|
|
|
|
|
|
|
|
last_source_file = NULL;
|
|
|
|
|
|
|
|
|
|
abfd = objfile->obfd;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
sraw_symbol = ((struct coff_symfile_info *) objfile->sym_private)->symtbl;
|
|
|
|
|
nsyms = ((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
ssymnum = 0;
|
|
|
|
|
while (ssymnum < nsyms)
|
|
|
|
|
{
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
int sclass;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* This is the type we pass to partial-stab.h. A less kludgy solution
|
1999-07-07 20:19:36 +00:00
|
|
|
|
would be to break out partial-stab.h into its various parts--shuffle
|
|
|
|
|
off the DBXREAD_ONLY stuff to dbxread.c, and make separate
|
|
|
|
|
pstab-norm.h (for most types), pstab-sol.h (for N_SOL), etc. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
int stype;
|
|
|
|
|
|
|
|
|
|
QUIT;
|
|
|
|
|
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
bfd_coff_swap_sym_in (abfd, sraw_symbol, &symbol);
|
|
|
|
|
sclass = symbol.n_sclass;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
switch (sclass)
|
|
|
|
|
{
|
|
|
|
|
case C_EXT:
|
|
|
|
|
case C_HIDEXT:
|
|
|
|
|
{
|
|
|
|
|
/* The CSECT auxent--always the last auxent. */
|
|
|
|
|
union internal_auxent csect_aux;
|
|
|
|
|
unsigned int symnum_before = ssymnum;
|
|
|
|
|
|
1999-08-09 21:36:23 +00:00
|
|
|
|
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
&ssymnum, objfile);
|
|
|
|
|
if (symbol.n_numaux > 1)
|
|
|
|
|
{
|
|
|
|
|
bfd_coff_swap_aux_in
|
|
|
|
|
(objfile->obfd,
|
1999-07-07 20:19:36 +00:00
|
|
|
|
sraw_symbol - coff_data (abfd)->local_symesz,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symbol.n_type,
|
|
|
|
|
symbol.n_sclass,
|
|
|
|
|
symbol.n_numaux - 1,
|
|
|
|
|
symbol.n_numaux,
|
|
|
|
|
&csect_aux);
|
|
|
|
|
}
|
|
|
|
|
else
|
1999-08-09 21:36:23 +00:00
|
|
|
|
csect_aux = main_aux[0];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* If symbol name starts with ".$" or "$", ignore it. */
|
|
|
|
|
if (namestring[0] == '$'
|
|
|
|
|
|| (namestring[0] == '.' && namestring[1] == '$'))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
switch (csect_aux.x_csect.x_smtyp & 0x7)
|
|
|
|
|
{
|
|
|
|
|
case XTY_SD:
|
|
|
|
|
switch (csect_aux.x_csect.x_smclas)
|
|
|
|
|
{
|
|
|
|
|
case XMC_PR:
|
|
|
|
|
if (last_csect_name)
|
|
|
|
|
{
|
|
|
|
|
/* If no misc. function recorded in the last
|
|
|
|
|
seen csect, enter it as a function. This
|
|
|
|
|
will take care of functions like strcmp()
|
|
|
|
|
compiled by xlc. */
|
|
|
|
|
|
|
|
|
|
if (!misc_func_recorded)
|
|
|
|
|
{
|
|
|
|
|
RECORD_MINIMAL_SYMBOL
|
|
|
|
|
(last_csect_name, last_csect_val,
|
|
|
|
|
mst_text, last_csect_sec,
|
|
|
|
|
objfile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pst != NULL)
|
|
|
|
|
{
|
|
|
|
|
/* We have to allocate one psymtab for
|
|
|
|
|
each program csect, because their text
|
|
|
|
|
sections need not be adjacent. */
|
|
|
|
|
xcoff_end_psymtab
|
|
|
|
|
(pst, psymtab_include_list, includes_used,
|
|
|
|
|
symnum_before, dependency_list,
|
|
|
|
|
dependencies_used, textlow_not_set);
|
|
|
|
|
includes_used = 0;
|
|
|
|
|
dependencies_used = 0;
|
|
|
|
|
/* Give all psymtabs for this source file the same
|
|
|
|
|
name. */
|
|
|
|
|
pst = xcoff_start_psymtab
|
1999-09-09 00:02:17 +00:00
|
|
|
|
(objfile,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
filestring,
|
|
|
|
|
symnum_before,
|
|
|
|
|
objfile->global_psymbols.next,
|
|
|
|
|
objfile->static_psymbols.next);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (namestring && namestring[0] == '.')
|
|
|
|
|
{
|
|
|
|
|
last_csect_name = namestring;
|
|
|
|
|
last_csect_val = symbol.n_value;
|
|
|
|
|
last_csect_sec =
|
|
|
|
|
secnum_to_section (symbol.n_scnum, objfile);
|
|
|
|
|
}
|
|
|
|
|
if (pst != NULL)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR highval =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
symbol.n_value + csect_aux.x_csect.x_scnlen.l;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (highval > pst->texthigh)
|
|
|
|
|
pst->texthigh = highval;
|
|
|
|
|
if (pst->textlow == 0 || symbol.n_value < pst->textlow)
|
|
|
|
|
pst->textlow = symbol.n_value;
|
|
|
|
|
}
|
|
|
|
|
misc_func_recorded = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XMC_RW:
|
|
|
|
|
/* Data variables are recorded in the minimal symbol
|
|
|
|
|
table, except for section symbols. */
|
|
|
|
|
if (*namestring != '.')
|
|
|
|
|
prim_record_minimal_symbol_and_info
|
|
|
|
|
(namestring, symbol.n_value,
|
|
|
|
|
sclass == C_HIDEXT ? mst_file_data : mst_data,
|
|
|
|
|
NULL, secnum_to_section (symbol.n_scnum, objfile),
|
|
|
|
|
NULL, objfile);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XMC_TC0:
|
|
|
|
|
if (toc_offset)
|
|
|
|
|
warning ("More than one XMC_TC0 symbol found.");
|
|
|
|
|
toc_offset = symbol.n_value;
|
|
|
|
|
|
|
|
|
|
/* Make TOC offset relative to start address of section. */
|
|
|
|
|
bfd_sect = secnum_to_bfd_section (symbol.n_scnum, objfile);
|
|
|
|
|
if (bfd_sect)
|
|
|
|
|
toc_offset -= bfd_section_vma (objfile->obfd, bfd_sect);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XMC_TC:
|
|
|
|
|
/* These symbols tell us where the TOC entry for a
|
|
|
|
|
variable is, not the variable itself. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XTY_LD:
|
|
|
|
|
switch (csect_aux.x_csect.x_smclas)
|
|
|
|
|
{
|
|
|
|
|
case XMC_PR:
|
|
|
|
|
/* A function entry point. */
|
|
|
|
|
|
|
|
|
|
if (first_fun_line_offset == 0 && symbol.n_numaux > 1)
|
|
|
|
|
first_fun_line_offset =
|
1999-08-09 21:36:23 +00:00
|
|
|
|
main_aux[0].x_sym.x_fcnary.x_fcn.x_lnnoptr;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
RECORD_MINIMAL_SYMBOL
|
|
|
|
|
(namestring, symbol.n_value,
|
|
|
|
|
sclass == C_HIDEXT ? mst_file_text : mst_text,
|
|
|
|
|
secnum_to_section (symbol.n_scnum, objfile),
|
|
|
|
|
objfile);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XMC_GL:
|
|
|
|
|
/* shared library function trampoline code entry
|
|
|
|
|
point. */
|
|
|
|
|
|
|
|
|
|
/* record trampoline code entries as
|
|
|
|
|
mst_solib_trampoline symbol. When we lookup mst
|
|
|
|
|
symbols, we will choose mst_text over
|
|
|
|
|
mst_solib_trampoline. */
|
|
|
|
|
RECORD_MINIMAL_SYMBOL
|
|
|
|
|
(namestring, symbol.n_value,
|
|
|
|
|
mst_solib_trampoline,
|
|
|
|
|
secnum_to_section (symbol.n_scnum, objfile),
|
|
|
|
|
objfile);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XMC_DS:
|
|
|
|
|
/* The symbols often have the same names as
|
|
|
|
|
debug symbols for functions, and confuse
|
|
|
|
|
lookup_symbol. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
/* xlc puts each variable in a separate csect,
|
|
|
|
|
so we get an XTY_SD for each variable. But
|
|
|
|
|
gcc puts several variables in a csect, so
|
|
|
|
|
that each variable only gets an XTY_LD. We
|
|
|
|
|
still need to record them. This will
|
|
|
|
|
typically be XMC_RW; I suspect XMC_RO and
|
|
|
|
|
XMC_BS might be possible too. */
|
|
|
|
|
if (*namestring != '.')
|
|
|
|
|
prim_record_minimal_symbol_and_info
|
|
|
|
|
(namestring, symbol.n_value,
|
|
|
|
|
sclass == C_HIDEXT ? mst_file_data : mst_data,
|
|
|
|
|
NULL, secnum_to_section (symbol.n_scnum, objfile),
|
|
|
|
|
NULL, objfile);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XTY_CM:
|
|
|
|
|
switch (csect_aux.x_csect.x_smclas)
|
|
|
|
|
{
|
|
|
|
|
case XMC_RW:
|
|
|
|
|
case XMC_BS:
|
|
|
|
|
/* Common variables are recorded in the minimal symbol
|
|
|
|
|
table, except for section symbols. */
|
|
|
|
|
if (*namestring != '.')
|
|
|
|
|
prim_record_minimal_symbol_and_info
|
|
|
|
|
(namestring, symbol.n_value,
|
|
|
|
|
sclass == C_HIDEXT ? mst_file_bss : mst_bss,
|
|
|
|
|
NULL, secnum_to_section (symbol.n_scnum, objfile),
|
|
|
|
|
NULL, objfile);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case C_FILE:
|
|
|
|
|
{
|
|
|
|
|
unsigned int symnum_before;
|
|
|
|
|
|
|
|
|
|
symnum_before = ssymnum;
|
1999-08-09 21:36:23 +00:00
|
|
|
|
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
&ssymnum, objfile);
|
|
|
|
|
|
|
|
|
|
/* See if the last csect needs to be recorded. */
|
|
|
|
|
|
|
|
|
|
if (last_csect_name && !misc_func_recorded)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* If no misc. function recorded in the last seen csect, enter
|
|
|
|
|
it as a function. This will take care of functions like
|
|
|
|
|
strcmp() compiled by xlc. */
|
|
|
|
|
|
|
|
|
|
RECORD_MINIMAL_SYMBOL
|
|
|
|
|
(last_csect_name, last_csect_val,
|
|
|
|
|
mst_text, last_csect_sec, objfile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pst)
|
|
|
|
|
{
|
|
|
|
|
xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
|
|
|
|
|
symnum_before, dependency_list,
|
|
|
|
|
dependencies_used, textlow_not_set);
|
|
|
|
|
includes_used = 0;
|
|
|
|
|
dependencies_used = 0;
|
|
|
|
|
}
|
|
|
|
|
first_fun_line_offset = 0;
|
|
|
|
|
|
|
|
|
|
/* XCOFF, according to the AIX 3.2 documentation, puts the
|
|
|
|
|
filename in cs->c_name. But xlc 1.3.0.2 has decided to
|
|
|
|
|
do things the standard COFF way and put it in the auxent.
|
|
|
|
|
We use the auxent if the symbol is ".file" and an auxent
|
|
|
|
|
exists, otherwise use the symbol itself. */
|
|
|
|
|
if (!strcmp (namestring, ".file") && symbol.n_numaux > 0)
|
|
|
|
|
{
|
1999-08-09 21:36:23 +00:00
|
|
|
|
filestring = coff_getfilename (&main_aux[0], objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
filestring = namestring;
|
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
|
pst = xcoff_start_psymtab (objfile,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
filestring,
|
|
|
|
|
symnum_before,
|
|
|
|
|
objfile->global_psymbols.next,
|
|
|
|
|
objfile->static_psymbols.next);
|
|
|
|
|
last_csect_name = NULL;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
static struct complaint msg =
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{"Storage class %d not recognized during scan", 0, 0};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
complain (&msg, sclass);
|
|
|
|
|
}
|
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
|
|
/* C_FCN is .bf and .ef symbols. I think it is sufficient
|
|
|
|
|
to handle only the C_FUN and C_EXT. */
|
|
|
|
|
case C_FCN:
|
|
|
|
|
|
|
|
|
|
case C_BSTAT:
|
|
|
|
|
case C_ESTAT:
|
|
|
|
|
case C_ARG:
|
|
|
|
|
case C_REGPARM:
|
|
|
|
|
case C_REG:
|
|
|
|
|
case C_TPDEF:
|
|
|
|
|
case C_STRTAG:
|
|
|
|
|
case C_UNTAG:
|
|
|
|
|
case C_ENTAG:
|
|
|
|
|
case C_LABEL:
|
|
|
|
|
case C_NULL:
|
|
|
|
|
|
|
|
|
|
/* C_EINCL means we are switching back to the main file. But there
|
|
|
|
|
is no reason to care; the only thing we want to know about
|
|
|
|
|
includes is the names of all the included (.h) files. */
|
|
|
|
|
case C_EINCL:
|
|
|
|
|
|
|
|
|
|
case C_BLOCK:
|
|
|
|
|
|
|
|
|
|
/* I don't think C_STAT is used in xcoff; C_HIDEXT appears to be
|
|
|
|
|
used instead. */
|
|
|
|
|
case C_STAT:
|
|
|
|
|
|
|
|
|
|
/* I don't think the name of the common block (as opposed to the
|
|
|
|
|
variables within it) is something which is user visible
|
|
|
|
|
currently. */
|
|
|
|
|
case C_BCOMM:
|
|
|
|
|
case C_ECOMM:
|
|
|
|
|
|
|
|
|
|
case C_PSYM:
|
|
|
|
|
case C_RPSYM:
|
|
|
|
|
|
|
|
|
|
/* I think we can ignore C_LSYM; types on xcoff seem to use C_DECL
|
|
|
|
|
so C_LSYM would appear to be only for locals. */
|
|
|
|
|
case C_LSYM:
|
|
|
|
|
|
|
|
|
|
case C_AUTO:
|
|
|
|
|
case C_RSYM:
|
|
|
|
|
{
|
|
|
|
|
/* We probably could save a few instructions by assuming that
|
|
|
|
|
C_LSYM, C_PSYM, etc., never have auxents. */
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
int naux1 = symbol.n_numaux + 1;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
ssymnum += naux1;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
sraw_symbol += bfd_coff_symesz (abfd) * naux1;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case C_BINCL:
|
|
|
|
|
stype = N_SOL;
|
|
|
|
|
goto pstab;
|
|
|
|
|
|
|
|
|
|
case C_FUN:
|
|
|
|
|
/* The value of the C_FUN is not the address of the function (it
|
|
|
|
|
appears to be the address before linking), but as long as it
|
|
|
|
|
is smaller than the actual address, then find_pc_partial_function
|
|
|
|
|
will use the minimal symbols instead. I hope. */
|
|
|
|
|
|
|
|
|
|
case C_GSYM:
|
|
|
|
|
case C_ECOML:
|
|
|
|
|
case C_DECL:
|
|
|
|
|
case C_STSYM:
|
|
|
|
|
stype = N_LSYM;
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
pstab:
|
1999-08-09 21:36:23 +00:00
|
|
|
|
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
&ssymnum, objfile);
|
|
|
|
|
#define CUR_SYMBOL_TYPE stype
|
|
|
|
|
#define CUR_SYMBOL_VALUE symbol.n_value
|
|
|
|
|
|
|
|
|
|
/* START_PSYMTAB and END_PSYMTAB are never used, because they are only
|
|
|
|
|
called from DBXREAD_ONLY or N_SO code. Likewise for the symnum
|
|
|
|
|
variable. */
|
1999-09-09 00:02:17 +00:00
|
|
|
|
#define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms) 0
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)\
|
|
|
|
|
do {} while (0)
|
|
|
|
|
/* We have already set the namestring. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
#define SET_NAMESTRING() /* */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#include "partial-stab.h"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pst)
|
|
|
|
|
{
|
|
|
|
|
xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
|
|
|
|
|
ssymnum, dependency_list,
|
|
|
|
|
dependencies_used, textlow_not_set);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record the toc offset value of this symbol table into objfile structure.
|
|
|
|
|
If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain
|
|
|
|
|
this information would be file auxiliary header. */
|
|
|
|
|
|
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->toc_offset = toc_offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the toc offset value for a given objfile. */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
|
get_toc_offset (struct objfile *objfile)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (objfile)
|
|
|
|
|
return ((struct coff_symfile_info *) objfile->sym_private)->toc_offset;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan and build partial symbols for a symbol file.
|
|
|
|
|
We have been initialized by a call to dbx_symfile_init, which
|
|
|
|
|
put all the relevant info into a "struct dbx_symfile_info",
|
|
|
|
|
hung off the objfile structure.
|
|
|
|
|
|
|
|
|
|
SECTION_OFFSETS contains offsets relative to which the symbols in the
|
|
|
|
|
various sections are (depending where the sections were actually loaded).
|
|
|
|
|
MAINLINE is true if we are reading the main symbol
|
|
|
|
|
table (as opposed to a shared lib or dynamically loaded file). */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-11-15 19:58:14 +00:00
|
|
|
|
xcoff_initial_scan (struct objfile *objfile, int mainline)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
int val;
|
|
|
|
|
struct cleanup *back_to;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
int num_symbols; /* # of symbols */
|
|
|
|
|
file_ptr symtab_offset; /* symbol table and */
|
|
|
|
|
file_ptr stringtab_offset; /* string table file offsets */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
struct coff_symfile_info *info;
|
|
|
|
|
char *name;
|
|
|
|
|
unsigned int size;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
info = (struct coff_symfile_info *) objfile->sym_private;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
symfile_bfd = abfd = objfile->obfd;
|
|
|
|
|
name = objfile->name;
|
|
|
|
|
|
|
|
|
|
num_symbols = bfd_get_symcount (abfd); /* # of symbols */
|
|
|
|
|
symtab_offset = obj_sym_filepos (abfd); /* symbol table file offset */
|
|
|
|
|
stringtab_offset = symtab_offset +
|
1999-07-07 20:19:36 +00:00
|
|
|
|
num_symbols * coff_data (abfd)->local_symesz;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
info->min_lineno_offset = 0;
|
|
|
|
|
info->max_lineno_offset = 0;
|
|
|
|
|
bfd_map_over_sections (abfd, find_linenos, info);
|
|
|
|
|
|
|
|
|
|
if (num_symbols > 0)
|
|
|
|
|
{
|
|
|
|
|
/* Read the string table. */
|
|
|
|
|
init_stringtab (abfd, stringtab_offset, objfile);
|
|
|
|
|
|
|
|
|
|
/* Read the .debug section, if present. */
|
|
|
|
|
{
|
|
|
|
|
sec_ptr secp;
|
|
|
|
|
bfd_size_type length;
|
|
|
|
|
char *debugsec = NULL;
|
|
|
|
|
|
|
|
|
|
secp = bfd_get_section_by_name (abfd, ".debug");
|
|
|
|
|
if (secp)
|
|
|
|
|
{
|
|
|
|
|
length = bfd_section_size (abfd, secp);
|
|
|
|
|
if (length)
|
|
|
|
|
{
|
|
|
|
|
debugsec =
|
|
|
|
|
(char *) obstack_alloc (&objfile->symbol_obstack, length);
|
|
|
|
|
|
|
|
|
|
if (!bfd_get_section_contents (abfd, secp, debugsec,
|
|
|
|
|
(file_ptr) 0, length))
|
|
|
|
|
{
|
|
|
|
|
error ("Error reading .debug section of `%s': %s",
|
|
|
|
|
name, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->debugsec =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
debugsec;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the symbols. We keep them in core because we will want to
|
|
|
|
|
access them randomly in read_symbol*. */
|
|
|
|
|
val = bfd_seek (abfd, symtab_offset, SEEK_SET);
|
|
|
|
|
if (val < 0)
|
|
|
|
|
error ("Error reading symbols from %s: %s",
|
|
|
|
|
name, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
size = coff_data (abfd)->local_symesz * num_symbols;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->symtbl =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
obstack_alloc (&objfile->symbol_obstack, size);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms =
|
1999-04-16 01:35:26 +00:00
|
|
|
|
num_symbols;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
val = bfd_read (((struct coff_symfile_info *) objfile->sym_private)->symtbl,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
size, 1, abfd);
|
|
|
|
|
if (val != size)
|
|
|
|
|
perror_with_name ("reading symbol table");
|
|
|
|
|
|
|
|
|
|
/* If we are reinitializing, or if we have never loaded syms yet, init */
|
|
|
|
|
if (mainline
|
|
|
|
|
|| objfile->global_psymbols.size == 0
|
|
|
|
|
|| objfile->static_psymbols.size == 0)
|
|
|
|
|
/* I'm not sure how how good num_symbols is; the rule of thumb in
|
|
|
|
|
init_psymbol_list was developed for a.out. On the one hand,
|
|
|
|
|
num_symbols includes auxents. On the other hand, it doesn't
|
|
|
|
|
include N_SLINE. */
|
|
|
|
|
init_psymbol_list (objfile, num_symbols);
|
|
|
|
|
|
|
|
|
|
free_pending_blocks ();
|
1999-08-02 23:48:37 +00:00
|
|
|
|
back_to = make_cleanup (really_free_pendings, 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
init_minimal_symbol_collection ();
|
2000-05-16 04:07:39 +00:00
|
|
|
|
make_cleanup_discard_minimal_symbols ();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Now that the symbol table data of the executable file are all in core,
|
|
|
|
|
process them and define symbols accordingly. */
|
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
|
scan_xcoff_symtab (objfile);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Install any minimal symbols that have been collected as the current
|
|
|
|
|
minimal symbols for this objfile. */
|
|
|
|
|
|
|
|
|
|
install_minimal_symbols (objfile);
|
|
|
|
|
|
|
|
|
|
do_cleanups (back_to);
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
asection *sect = NULL;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
objfile->num_sections = SECT_OFF_MAX;
|
1999-09-09 00:02:17 +00:00
|
|
|
|
objfile->section_offsets = (struct section_offsets *)
|
1999-08-09 21:36:23 +00:00
|
|
|
|
obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
/* Initialize the section indexes for future use. */
|
|
|
|
|
sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
|
|
|
|
if (sect)
|
|
|
|
|
objfile->sect_index_text = sect->index;
|
|
|
|
|
|
|
|
|
|
sect = bfd_get_section_by_name (objfile->obfd, ".data");
|
|
|
|
|
if (sect)
|
|
|
|
|
objfile->sect_index_data = sect->index;
|
|
|
|
|
|
|
|
|
|
sect = bfd_get_section_by_name (objfile->obfd, ".bss");
|
|
|
|
|
if (sect)
|
|
|
|
|
objfile->sect_index_bss = sect->index;
|
|
|
|
|
|
|
|
|
|
sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
|
|
|
|
|
if (sect)
|
|
|
|
|
objfile->sect_index_rodata = sect->index;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
for (i = 0; i < objfile->num_sections; ++i)
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
{
|
|
|
|
|
/* syms_from_objfile kindly subtracts from addr the
|
|
|
|
|
bfd_section_vma of the .text section. This strikes me as
|
|
|
|
|
wrong--whether the offset to be applied to symbol reading is
|
|
|
|
|
relative to the start address of the section depends on the
|
|
|
|
|
symbol format. In any event, this whole "addr" concept is
|
|
|
|
|
pretty broken (it doesn't handle any section but .text
|
|
|
|
|
sensibly), so just ignore the addr parameter and use 0.
|
|
|
|
|
rs6000-nat.c will set the correct section offsets via
|
|
|
|
|
objfile_relocate. */
|
2000-08-27 22:30:29 +00:00
|
|
|
|
(objfile->section_offsets)->offsets[i] = 0;
|
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
2000-05-04 16:52:34 +00:00
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Register our ability to parse symbols for xcoff BFD files. */
|
|
|
|
|
|
|
|
|
|
static struct sym_fns xcoff_sym_fns =
|
|
|
|
|
{
|
|
|
|
|
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
/* It is possible that coff and xcoff should be merged as
|
1999-04-16 01:35:26 +00:00
|
|
|
|
they do have fundamental similarities (for example, the extra storage
|
|
|
|
|
classes used for stabs could presumably be recognized in any COFF file).
|
|
|
|
|
However, in addition to obvious things like all the csect hair, there are
|
|
|
|
|
some subtler differences between xcoffread.c and coffread.c, notably
|
|
|
|
|
the fact that coffread.c has no need to read in all the symbols, but
|
|
|
|
|
xcoffread.c reads all the symbols and does in fact randomly access them
|
|
|
|
|
(in C_BSTAT and line number processing). */
|
|
|
|
|
|
* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
support. Incorporate most of tm-rs6000.h.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
(read_memory_addr): Define.
(pop_frame): Rename to rs6000_pop_frame.
(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
dummy frame handling.
(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
rs6000_frame_saved_pc, frame_get_saved_regs,
frame_initial_stack_address, rs6000_frame_chain,
rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
of read_memory_integer.
(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
frame_get_saved_regs, frame_initial_stack_address,
rs6000_frame_chain): Replace 4 with TDEP->wordsize.
(skip_prologue): Recognize some 64-bit stack adjustments.
(push_dummy_frame, pop_dummy_frame, set_processor,
show_processor): Delete.
(frame_get_saved_regs): Manipulate saved register addresses using
CORE_ADDR instead of int.
(rs6000_create_inferior): New function.
(register_names_*[]): Change to struct reg registers_*[].
(variants[]): Assimilate into multi-arch approach.
(register_names_*[], variants[]): Refer to pre-PowerPC
architectures as POWER instead of RS6000.
* rs6000-nat.c: Ubiquitous changes for 64-bit support.
(vmap_secs, xcoff_relocate_symtab): Cast addresses
to unsigned long to avoid sign-extension errors.
(set_host_arch): New function.
(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
* symfile.c (find_sym_fns): Remove special xcoff kludge.
* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
(process_linenos): Query line struct size from coff
backend instead of using compile-time constant.
(enter_line_range): Likewise.
(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
record_debugformat() if appropriate.
(process_xcoff_symbol): Access symbol addresses using
SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
(scan_xcoff_symtab): Likewise. Query syment struct size from
coff backend instead of using compile-time constant.
(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
that this Makefile variable get set to. (From Kevin Buettner.)
* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
the TOC doesn't overflow. (From Kevin Buettner.)
* config/powerpc/tm-ppc-aix.h: Move config decisions to
multi-arched rs6000-tdep.c.
* config/rs6000/tm-rs6000.h: Likewise.
(GDB_MULTI_ARCH): Define.
(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
(is_magic_function_pointer): Replace with
rs6000_convert_from_func_ptr_addr.
(TARGET_CREATE_INFERIOR_HOOK): Define.
(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
(rs6000_set_host_arch_hook): Declare.
* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
2000-06-16 21:02:22 +00:00
|
|
|
|
bfd_target_xcoff_flavour,
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
|
|
|
|
|
xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
|
|
|
|
|
xcoff_initial_scan, /* sym_read: read a symbol file into symtab */
|
|
|
|
|
xcoff_symfile_finish, /* sym_finish: finished with file, cleanup */
|
|
|
|
|
xcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */
|
|
|
|
|
NULL /* next: pointer to next struct sym_fns */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
_initialize_xcoffread (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
add_symtab_fns (&xcoff_sym_fns);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
func_symbol_type = init_type (TYPE_CODE_FUNC, 1, 0,
|
|
|
|
|
"<function, no debug info>", NULL);
|
|
|
|
|
TYPE_TARGET_TYPE (func_symbol_type) = builtin_type_int;
|
|
|
|
|
var_symbol_type =
|
|
|
|
|
init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0,
|
|
|
|
|
"<variable, no debug info>", NULL);
|
|
|
|
|
}
|