* configure.in: Check for working mmap, ansi headers, string.h,

strings.h, and memory.h.
* configure: Regenerated.

* gdb_stat.h: New file, "portable" <sys/stat.h>.
* gdb_string.h: New file, "portable" <string.h>.

* altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c,
convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c,
gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c,
i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c,
mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c,
rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c,
symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c,
ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h"
instead of <sys/stat.h>.

* alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c,
ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c,
core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c,
dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c,
exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c,
fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c,
inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c,
m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c,
monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c,
remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c,
remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c,
remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c,
remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c,
remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c,
solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c,
symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c,
valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include
"gdb_string.h" instead of <string.h>.
* gdbtk.c: Likewise.

* config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h,
sparc/xm-sun4os4.h (HAVE_MMAP): Removed.

* config/xm-lynx.h, config/i386/xm-ptx.h,
config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h,
config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/mips/xm-news-mips.h, config/mips/xm-riscos.h,
config/pa/hppah.h, config/rs6000/xm-rs6000.h,
config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h,
config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h,
config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed.
* config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
This commit is contained in:
J.T. Conklin 1995-08-01 20:14:27 +00:00
parent a1bdcf913a
commit 2b57629364
137 changed files with 2207 additions and 1157 deletions

View File

@ -157,6 +157,8 @@ findvar.c
fork-child.c
frame.h
gcc.patch
gdb_stat.h
gdb_string.h
gdb-stabs.h
gdb.1
gdb.gdb

View File

@ -1,3 +1,59 @@
Tue Aug 1 11:44:53 1995 J.T. Conklin <jtc@rtl.cygnus.com>
* configure.in: Check for working mmap, ansi headers, string.h,
strings.h, and memory.h.
* configure: Regenerated.
* gdb_stat.h: New file, "portable" <sys/stat.h>.
* gdb_string.h: New file, "portable" <string.h>.
* altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c,
convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c,
gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c,
i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c,
mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c,
rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c,
symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c,
ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h"
instead of <sys/stat.h>.
* alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c,
ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c,
core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c,
dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c,
exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c,
fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c,
inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c,
m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c,
monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c,
remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c,
remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c,
remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c,
remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c,
remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c,
solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c,
symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c,
valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include
"gdb_string.h" instead of <string.h>.
start-sanitize-gdbtk
* gdbtk.c: Likewise.
end-sanitize-gdbtk
* config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h,
sparc/xm-sun4os4.h (HAVE_MMAP): Removed.
* config/xm-lynx.h, config/i386/xm-ptx.h,
config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h,
config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/mips/xm-news-mips.h, config/mips/xm-riscos.h,
config/pa/hppah.h, config/rs6000/xm-rs6000.h,
config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h,
config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h,
config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed.
* config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
Tue Aug 1 02:08:30 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* mips-tdep.c (mips_extract_return_value): Fix returning of

View File

@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "dis-asm.h"
#include "symfile.h"
#include "objfiles.h"
#include <string.h>
#include "gdb_string.h"
/* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */

View File

@ -42,7 +42,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
/* Work with core dump and executable files, for GDB.

View File

@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <errno.h>
#endif
@ -462,7 +462,7 @@ arm_float_info()
void
_initialize_arm_tdep ()
{
tm_print_insn = print_insn_arm;
tm_print_insn = print_insn_little_arm;
}

View File

@ -36,7 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <errno.h>

View File

@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "thread.h"
#include "target.h"
#include "language.h"
#include <string.h>
#include "gdb_string.h"
#include "demangle.h"
#include "annotate.h"
@ -152,34 +152,6 @@ static int executing_breakpoint_commands;
b? (tmp=b->next, 1): 0; \
b = tmp)
/* Provide defaults for systems that don't support hardware watchpoints. */
#ifndef TARGET_CAN_USE_HARDWARE_WATCHPOINT
/* Returns non-zero if we can set a hardware watchpoint of type TYPE. TYPE is
one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) 0
/* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes. TYPE is 1
for read and 2 for read/write accesses. Returns 0 for success, non-zero for
failure. */
#define target_remove_watchpoint(ADDR,LEN,TYPE) -1
#define target_insert_watchpoint(ADDR,LEN,TYPE) -1
#endif
#ifndef target_insert_hw_breakpoint
#define target_remove_hw_breakpoint(ADDR,SHADOW) -1
#define target_insert_hw_breakpoint(ADDR,SHADOW) -1
#endif
#ifndef target_stopped_data_address
#define target_stopped_data_address() 0
#endif
/* True if breakpoint hit counts should be displayed in breakpoint info. */
int show_breakpoint_hit_counts = 1;
@ -1114,8 +1086,8 @@ watchpoint_check (p)
{
bpstat bs = (bpstat) p;
struct breakpoint *b;
struct frame_info *saved_frame, *fr;
int within_current_scope, saved_level;
struct frame_info *fr;
int within_current_scope;
b = bs->breakpoint_at;
@ -1258,14 +1230,6 @@ bpstat_stop_status (pc, not_a_breakpoint)
&& b->address != bp_addr)
continue;
/* If defined, then we need to decr pc by this much after a hardware break-
point. Presumably should override DECR_PC_AFTER_BREAK, though it doesn't
now... */
#ifndef DECR_PC_AFTER_HW_BREAK
#define DECR_PC_AFTER_HW_BREAK 0
#endif
if (b->type == bp_hardware_breakpoint
&& b->address != (bp_addr - DECR_PC_AFTER_HW_BREAK))
continue;
@ -2138,6 +2102,13 @@ set_momentary_breakpoint (sal, frame, type)
b->enable = enabled;
b->disposition = donttouch;
b->frame = (frame ? frame->frame : 0);
/* If we're debugging a multi-threaded program, then we
want momentary breakpoints to be active in only a
single thread of control. */
if (in_thread_list (inferior_pid))
b->thread = pid_to_thread_id (inferior_pid);
return b;
}

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "objfiles.h"
#include "gdbtypes.h"
#include "complaints.h"
#include <string.h>
#include "gdb_string.h"
/* Ask buildsym.h to define the vars it normally declares `extern'. */
#define EXTERN /**/

View File

@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "c-lang.h"
#include "typeprint.h"
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
#include <ctype.h>

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ch-lang.h"
#include "typeprint.h"
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
static void

View File

@ -27,7 +27,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include <obstack.h>
#include <string.h>
#include "gdb_string.h"
#include <ctype.h>
#include "coff/internal.h" /* Internal format of COFF symbols in BFD */
#include "libcoff.h" /* FIXME secret internal data from BFD */
@ -44,9 +45,10 @@ 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 */
asection *stabsect; /* Section pointer for .stab section */
CORE_ADDR textaddr; /* Addr of .text section. */
unsigned int textsize; /* Size of .text section. */
struct stab_section_list *stabsects; /* .stab sections. */
asection *stabstrsect; /* Section pointer for .stab section */
asection *stabindexsect; /* Section pointer for .stab.index section */
char *stabstrdata;
};
@ -132,13 +134,6 @@ static unsigned local_auxesz;
static struct symbol *opaque_type_chain[HASHSIZE];
#if 0
/* The type of the function we are currently reading in. This is
used by define_symbol to record the type of arguments to a function. */
struct type *in_function_type;
#endif
/* Complaints about various problems in the file being read */
struct complaint ef_complaint =
@ -212,6 +207,8 @@ static int init_lineno PARAMS ((bfd *, long, int));
static char *getsymname PARAMS ((struct internal_syment *));
static char *coff_getfilename PARAMS ((union internal_auxent *));
static void free_stringtab PARAMS ((void));
static int init_stringtab PARAMS ((bfd *, long));
@ -263,25 +260,55 @@ static void coff_locate_sections PARAMS ((bfd *, asection *, PTR));
-kingdon). */
static void
coff_locate_sections (ignore_abfd, sectp, csip)
bfd *ignore_abfd;
coff_locate_sections (abfd, sectp, csip)
bfd *abfd;
asection *sectp;
PTR csip;
{
register struct coff_symfile_info *csi;
const char *name;
csi = (struct coff_symfile_info *) csip;
if (STREQ (sectp->name, ".stab"))
name = bfd_get_section_name (abfd, sectp);
if (STREQ (name, ".text"))
{
csi->stabsect = sectp;
csi->textaddr = bfd_section_vma (abfd, sectp);
csi->textsize += bfd_section_size (abfd, sectp);
}
else if (STREQ (sectp->name, ".stabstr"))
else if (strncmp (name, ".text", sizeof ".text" - 1) == 0)
{
csi->textsize += bfd_section_size (abfd, sectp);
}
else if (STREQ (name, ".stabstr"))
{
csi->stabstrsect = sectp;
}
else if (STREQ (sectp->name, ".stab.index"))
else if (strncmp (name, ".stab", sizeof ".stab" - 1) == 0)
{
csi->stabindexsect = sectp;
const char *s;
/* We can have multiple .stab sections if linked with
--split-by-reloc. */
for (s = name + sizeof ".stab" - 1; *s != '\0'; s++)
if (! isdigit (*s))
break;
if (*s == '\0')
{
struct stab_section_list *n, **pn;
n = ((struct stab_section_list *)
xmalloc (sizeof (struct stab_section_list)));
n->section = sectp;
n->next = NULL;
for (pn = &csi->stabsects; *pn != NULL; pn = &(*pn)->next)
;
*pn = n;
/* This will be run after coffstab_build_psymtabs is called
in coff_symfile_read, at which point we no longer need
the information. */
make_cleanup (free, n);
}
}
}
@ -529,17 +556,15 @@ static void
coff_symfile_init (objfile)
struct objfile *objfile;
{
bfd *abfd = objfile->obfd;
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (PTR)
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
/* Allocate struct to keep track of the symfile */
objfile -> sym_private = xmmalloc (objfile -> md,
sizeof (struct coff_symfile_info));
objfile->sym_private = xmmalloc (objfile->md,
sizeof (struct coff_symfile_info));
memset (objfile->sym_private, 0, sizeof (struct coff_symfile_info));
@ -607,7 +632,7 @@ coff_symfile_read (objfile, section_offsets, mainline)
int symtab_offset;
int stringtab_offset;
struct cleanup *back_to;
int stabsize, stabstrsize;
int stabstrsize;
info = (struct coff_symfile_info *) objfile -> sym_private;
dbxinfo = (struct dbx_symfile_info *) objfile->sym_stab_info;
@ -681,19 +706,19 @@ coff_symfile_read (objfile, section_offsets, mainline)
bfd_map_over_sections (abfd, coff_locate_sections, (PTR) info);
if (info->stabsect)
if (info->stabsects)
{
/* FIXME: dubious. Why can't we use something normal like
bfd_get_section_contents? */
bfd_seek (abfd, abfd->where, 0);
stabsize = bfd_section_size (abfd, info->stabsect);
stabstrsize = bfd_section_size (abfd, info->stabstrsect);
coffstab_build_psymtabs (objfile,
section_offsets,
mainline,
info->stabsect->filepos, stabsize,
info->textaddr, info->textsize,
info->stabsects,
info->stabstrsect->filepos, stabstrsize);
}
@ -1211,7 +1236,7 @@ getsymname (symbol_entry)
only the last component of the name. Result is in static storage and
is only good for temporary use. */
char *
static char *
coff_getfilename (aux_entry)
union internal_auxent *aux_entry;
{
@ -1300,6 +1325,8 @@ enter_linenos (file_offset, first_line, last_line, section_offsets)
register char *rawptr;
struct internal_lineno lptr;
if (!linetab)
return ;
if (file_offset < linetab_offset)
{
complain (&lineno_complaint, file_offset);
@ -1442,22 +1469,8 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
if (ISFCN (cs->c_type))
{
SYMBOL_VALUE (sym) += ANOFFSET (section_offsets, SECT_OFF_TEXT);
#if 0
/* FIXME: This has NOT been tested. The DBX version has.. */
/* Generate a template for the type of this function. The
types of the arguments will be added as we read the symbol
table. */
struct type *new = (struct type *)
obstack_alloc (&objfile->symbol_obstack, sizeof (struct type));
memcpy (new, lookup_function_type (decode_function_type (cs, cs->c_type, aux)),
sizeof(struct type));
SYMBOL_TYPE (sym) = new;
in_function_type = SYMBOL_TYPE(sym);
#else
SYMBOL_TYPE(sym) =
lookup_function_type (decode_function_type (cs, cs->c_type, aux));
#endif
SYMBOL_CLASS (sym) = LOC_BLOCK;
if (cs->c_sclass == C_STAT)
@ -1513,11 +1526,6 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
case C_ARG:
SYMBOL_CLASS (sym) = LOC_ARG;
#if 0
/* FIXME: This has not been tested. */
/* Add parameter to function. */
add_param_to_type(&in_function_type,sym);
#endif
add_symbol_to_list (sym, &local_symbols);
#if !defined (BELIEVE_PCC_PROMOTION)
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
@ -2102,7 +2110,7 @@ coff_symfile_offsets (objfile, addr)
section_offsets = (struct section_offsets *)
obstack_alloc (&objfile -> psymbol_obstack,
sizeof (struct section_offsets)
+ sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
+ sizeof (section_offsets->offsets) * SECT_OFF_MAX);
for (i = 0; i < SECT_OFF_MAX; i++)
ANOFFSET (section_offsets, i) = addr;

View File

@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symtab.h"
#include "value.h"
#include <ctype.h>
#include <string.h>
#include "gdb_string.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -29,14 +29,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_WAIT_STRUCT
#define HAVE_MMAP
#undef HAVE_TERMIO
#define HAVE_TERMIOS
#define USG
#define MEM_FNS_DECLARED
#define NEED_POSIX_SETPGID
#define USE_O_NOCTTY

View File

@ -41,5 +41,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
* USER area using the "PEEKUSER" ptrace call.
*/
#define PT_READ_U 3
#define MEM_FNS_DECLARED /* /usr/include/string.h can get it wrong */

View File

@ -46,10 +46,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef USG /* In case it was defined in the Makefile for cplus-dem.c */
#define USG
/* The mem functions are in <string.h>. */
#undef MEM_FNS_DECLARED
#define MEM_FNS_DECLARED 1
#define HAVE_TERMIOS
#define REGISTER_ADDR(u_ar0, regno) \

View File

@ -20,10 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "m68k/xm-sun3.h"
#define FPU
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()

View File

@ -22,12 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
/* memcpy and memset return void *, not char *. */
extern void *memcpy();
extern void *memset();
#define MEM_FNS_DECLARED
/* Override register locations in upage for SGI machines */
#undef REGISTER_U_ADDR
#define REGISTER_U_ADDR(addr, blockend, regno) \

View File

@ -33,12 +33,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern char *strdup();
#endif
/* DECstation memcpy and memset return void *, not char *. */
extern void *memcpy();
extern void *memset();
#define MEM_FNS_DECLARED
#if ! defined (__STDC__) && ! defined (offsetof)
# define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
#endif

View File

@ -22,5 +22,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (HOST_BYTE_ORDER)
#define HOST_BYTE_ORDER BIG_ENDIAN
#endif
#define MEM_FNS_DECLARED

View File

@ -22,8 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER BIG_ENDIAN
#endif
#define MEM_FNS_DECLARED
#define USG 1
/* setjmp.h requires uid_t. */

View File

@ -39,14 +39,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_TERMIOS
/* HP uses non-ANSI definitions, but with void * results. */
#define MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */
extern void *
memcpy PARAMS ((void *, const void *, size_t)); /* 4.11.2.1 */
extern void *
memset PARAMS ((void *, int, size_t)); /* 4.11.6.1 */
/* HP defines malloc and realloc as returning void *, even for non-ANSI
compilations (such as with the native compiler). */

View File

@ -44,11 +44,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define USG 1
#define HAVE_SIGSETMASK 1
/* AIX declares the mem functions differently than defs.h does. AIX is
right, but defs.h works on more old systems. For now, override it. */
#define MEM_FNS_DECLARED 1
/* This system requires that we open a terminal with O_NOCTTY for it to
not become our controlling terminal. */

View File

@ -20,10 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "sparc/xm-sparc.h"
#define FPU
/* SunOS 4.x has memory mapped files. */
#define HAVE_MMAP
/* If you expect to use the mmalloc package to obtain mapped symbol files,
for now you have to specify some parameters that determine how gdb places
the mappings in it's address space. See the comments in map_to_address()
@ -41,14 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MALLOC_INCOMPATIBLE
#include <malloc.h>
/* acc for SunOS4 comes with string.h and memory.h headers which we
pick up somewhere (where?) and which use char *, not void *. The
following should work with acc, gcc, or /bin/cc, at least with
SunOS 4.1.1. */
#define MEM_FNS_DECLARED
#include <memory.h>
/* SunOS 4.x uses nonstandard "char *" as type of third argument to ptrace() */
#define PTRACE_ARG3_TYPE char*

View File

@ -51,10 +51,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Solaris PSRVADDR support does not seem to include a place for nPC. */
#define PRSVADDR_BROKEN
/* The mem functions are in <string.h>. */
#undef MEM_FNS_DECLARED
#define MEM_FNS_DECLARED 1
/* solaris doesn't have siginterrupt, though it has sigaction; however,
in this case siginterrupt would just be setting the default. */
#define NO_SIGINTERRUPT

View File

@ -8,6 +8,3 @@
#include <sys/param.h>
#include "vax/xm-vax.h"
/* In non-ANSI compiles, memcpy and memset are still void *, not char *. */
#define MEM_FNS_DECLARED

View File

@ -3,8 +3,6 @@
#include "vax/xm-vax.h"
extern char *strdup();
#define MEM_FNS_DECLARED
/* This is required for Ultrix 3.1b, not for later versions. Ultrix
3.1b can't just use xm-vaxult2.h because Ultrix 3.1b does define
FD_SET. Sure, we could have separate configurations for vaxult2,

View File

@ -3,7 +3,6 @@
#include "vax/xm-vax.h"
extern char *strdup();
#define MEM_FNS_DECLARED
#define NO_PTRACE_H
/* Old versions of ultrix have fd_set but not the FD_* macros. */

View File

@ -20,5 +20,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* for INT_MIN, to avoid "INT_MIN redefined" warnings from defs.h */
#include <limits.h>
#define MEM_FNS_DECLARED

View File

@ -23,10 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef HAVE_TERMIO
#define HAVE_TERMIOS
/* SVR4 has mmap facilities */
#define HAVE_MMAP
/* SVR4 is a derivative of System V Release 3 (USG) */
#define USG

297
gdb/configure vendored
View File

@ -847,7 +847,127 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
for ac_hdr in unistd.h
# If we cannot run a trivial program, we must be cross compiling.
echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
#line 860 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
eval $ac_link
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_cross=no
else
ac_cv_c_cross=yes
fi
fi
rm -fr conftest*
fi
cross_compiling=$ac_cv_c_cross
echo "$ac_t""$ac_cv_c_cross" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 881 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
EOF
eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_header_stdc=yes
else
echo "$ac_err" >&5
rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 903 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "memchr" >/dev/null 2>&1; then
:
else
rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 921 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "free" >/dev/null 2>&1; then
:
else
rm -rf conftest*
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
ac_cv_header_stdc=no
else
cat > conftest.$ac_ext <<EOF
#line 942 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
eval $ac_link
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
ac_cv_header_stdc=no
fi
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_header_stdc" 1>&6
if test $ac_cv_header_stdc = yes; then
cat >> confdefs.h <<\EOF
#define STDC_HEADERS 1
EOF
fi
for ac_hdr in memory.h string.h strings.h unistd.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@ -855,7 +975,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 859 "configure"
#line 979 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@ -883,6 +1003,161 @@ else
fi
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1012 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
#if defined(S_ISBLK) && defined(S_IFDIR)
# if S_ISBLK (S_IFDIR)
You lose.
# endif
#endif
#if defined(S_ISBLK) && defined(S_IFCHR)
# if S_ISBLK (S_IFCHR)
You lose.
# endif
#endif
#if defined(S_ISLNK) && defined(S_IFREG)
# if S_ISLNK (S_IFREG)
You lose.
# endif
#endif
#if defined(S_ISSOCK) && defined(S_IFREG)
# if S_ISSOCK (S_IFREG)
You lose.
# endif
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "You lose" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_header_stat_broken=yes
else
rm -rf conftest*
ac_cv_header_stat_broken=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_header_stat_broken" 1>&6
if test $ac_cv_header_stat_broken = yes; then
cat >> confdefs.h <<\EOF
#define STAT_MACROS_BROKEN 1
EOF
fi
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_mmap=no
else
cat > conftest.$ac_ext <<EOF
#line 1070 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test. */
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>
#ifdef BSD
# ifndef BSD4_1
# define HAVE_GETPAGESIZE
# endif
#endif
#ifndef HAVE_GETPAGESIZE
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif
# else
# ifdef NBPC
# define getpagesize() NBPC
# else
# define getpagesize() PAGESIZE /* SVR4 */
# endif
# endif
# endif
#endif
#ifdef __osf__
# define valloc malloc
#endif
#ifdef __cplusplus
extern "C" { void *valloc(unsigned), *malloc(unsigned); }
#else
char *valloc(), *malloc();
#endif
int
main()
{
char *buf1, *buf2, *buf3;
int i = getpagesize(), j;
int i2 = getpagesize()*2;
int fd;
buf1 = (char *)valloc(i2);
buf2 = (char *)valloc(i);
buf3 = (char *)malloc(i2);
for (j = 0; j < i2; ++j)
*(buf1 + j) = rand();
fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
write(fd, buf1, i2);
mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0);
for (j = 0; j < i; ++j)
if (*(buf1 + j) != *(buf2 + j))
exit(1);
lseek(fd, (long)i, 0);
read(fd, buf2, i); /* read into mapped memory -- file should not change */
/* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */
lseek(fd, (long)0, 0);
read(fd, buf3, i2);
for (j = 0; j < i2; ++j)
if (*(buf1 + j) != *(buf3 + j))
exit(1);
exit(0);
}
EOF
eval $ac_link
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_func_mmap=yes
else
ac_cv_func_mmap=no
fi
fi
rm -fr conftest*
fi
echo "$ac_t""$ac_cv_func_mmap" 1>&6
if test $ac_cv_func_mmap = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_MMAP 1
EOF
fi
ENABLE_CFLAGS=
ENABLE_CLIBS=
@ -979,7 +1254,7 @@ test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
cat > conftest.$ac_ext <<EOF
#line 983 "configure"
#line 1258 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
@ -1042,7 +1317,7 @@ rm -f conftest*
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1046 "configure"
#line 1321 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1160,7 +1435,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1164 "configure"
#line 1439 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1203,7 +1478,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1207 "configure"
#line 1482 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1237,7 +1512,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1241 "configure"
#line 1516 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1276,7 +1551,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1280 "configure"
#line 1555 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1314,7 +1589,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1318 "configure"
#line 1593 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1371,7 +1646,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1375 "configure"
#line 1650 "configure"
#include "confdefs.h"
#include <tk.h>
EOF
@ -1473,7 +1748,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1477 "configure"
#line 1752 "configure"
#include "confdefs.h"
#include <tclInt.h>
EOF

View File

@ -15,7 +15,11 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AC_CHECK_HEADERS(unistd.h)
AC_HEADER_STDC
AC_CHECK_HEADERS(memory.h string.h strings.h unistd.h)
AC_HEADER_STAT
AC_FUNC_MMAP
dnl Handle optional features that can be enabled.
ENABLE_CFLAGS=

View File

@ -37,7 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/thread.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <sys/mman.h>
#include "gdbcmd.h"

View File

@ -37,7 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/thread.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <sys/mman.h>
#include <convex/vmparam.h>

View File

@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include "gdb_string.h"
#include "inferior.h"
#include "target.h"

View File

@ -39,7 +39,7 @@ regardless of whether or not the actual target has floating point hardware.
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include "gdb_string.h"
#include "inferior.h"
#include "target.h"

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>

View File

@ -31,7 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef USG
#include <sys/dir.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <sys/user.h>
#ifndef NO_PTRACE_H
# ifdef PTRACE_IN_WRONG_PLACE

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>

View File

@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcmd.h"
#include "demangle.h"
#include "annotate.h"
#include <string.h>
#include "gdb_string.h"
int vtblprint; /* Controls printing of vtbl's */
int objectprint; /* Controls looking up an object's derived type

View File

@ -39,7 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include "symtab.h"
#include "setjmp.h"

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
for real. dbx_psymtab_to_symtab() is the function that does this */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#if defined(USG) || defined(__CYGNUSCLIB__)
#include <sys/types.h>
@ -45,7 +45,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef NO_SYS_FILE
#include <sys/file.h>
#endif
#include <sys/stat.h>
#include "gdb_stat.h"
#include <ctype.h>
#include "symtab.h"
#include "breakpoint.h"
@ -70,9 +70,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define SEEK_CUR 1
#endif
/* Each partial symbol table entry contains a pointer to private data for the
sym_read function to use when expanding a partial symbol table entry
to a full symbol table entry. */
/* We put a pointer to this structure in the read_symtab_private field
of the psymtab. */
struct symloc {
@ -573,8 +572,8 @@ dbx_symfile_read (objfile, section_offsets, mainline)
process them and define symbols accordingly. */
read_dbx_symtab (section_offsets, objfile,
bfd_section_vma (sym_bfd, DBX_TEXT_SECT (objfile)),
bfd_section_size (sym_bfd, DBX_TEXT_SECT (objfile)));
DBX_TEXT_ADDR (objfile),
DBX_TEXT_SIZE (objfile));
/* Add the dynamic symbols. */
@ -624,6 +623,7 @@ dbx_symfile_init (objfile)
int val;
bfd *sym_bfd = objfile->obfd;
char *name = bfd_get_filename (sym_bfd);
asection *text_sect;
unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE];
/* Allocate struct to keep track of the symfile */
@ -637,9 +637,12 @@ dbx_symfile_init (objfile)
/* FIXME POKING INSIDE BFD DATA STRUCTURES */
DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
if (!DBX_TEXT_SECT (objfile))
text_sect = bfd_get_section_by_name (sym_bfd, ".text");
if (!text_sect)
error ("Can't find .text section in symbol file");
DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
DBX_SYMBOL_SIZE (objfile) = obj_symbol_entry_size (sym_bfd);
DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
@ -755,6 +758,13 @@ static char *last_function_name;
building psymtabs, right? */
static char *stringtab_global;
/* These variables are used to control fill_symbuf when the stabs
symbols are not contiguous (as may be the case when a COFF file is
linked using --split-by-reloc). */
static struct stab_section_list *symbuf_sections;
static unsigned int symbuf_left;
static unsigned int symbuf_read;
/* Refill the symbol table input buffer
and set the variables that control fetching entries from it.
Reports an error if no data available.
@ -765,13 +775,37 @@ static void
fill_symbuf (sym_bfd)
bfd *sym_bfd;
{
int nbytes = bfd_read ((PTR)symbuf, sizeof (symbuf), 1, sym_bfd);
unsigned int count;
int nbytes;
if (symbuf_sections == NULL)
count = sizeof (symbuf);
else
{
if (symbuf_left <= 0)
{
file_ptr filepos = symbuf_sections->section->filepos;
if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
perror_with_name (bfd_get_filename (sym_bfd));
symbuf_left = bfd_section_size (sym_bfd, symbuf_sections->section);
symbol_table_offset = filepos - symbuf_read;
symbuf_sections = symbuf_sections->next;
}
count = symbuf_left;
if (count > sizeof (symbuf))
count = sizeof (symbuf);
}
nbytes = bfd_read ((PTR)symbuf, count, 1, sym_bfd);
if (nbytes < 0)
perror_with_name (bfd_get_filename (sym_bfd));
else if (nbytes == 0)
error ("Premature end of file reading symbol table");
symbuf_end = nbytes / symbol_size;
symbuf_idx = 0;
symbuf_left -= nbytes;
symbuf_read += nbytes;
}
#define SWAP_SYMBOL(symp, abfd) \
@ -2096,10 +2130,12 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
int l = colon_pos - name;
m = lookup_minimal_symbol_by_pc (last_pc_address);
if (m && STREQN (SYMBOL_NAME (m), name, l))
if (m && STREQN (SYMBOL_NAME (m), name, l)
&& SYMBOL_NAME (m) [l] == '\0')
/* last_pc_address was in this function */
valu = SYMBOL_VALUE (m);
else if (m && STREQN (SYMBOL_NAME (m+1), name, l))
else if (m && STREQN (SYMBOL_NAME (m+1), name, l)
&& SYMBOL_NAME (m+1) [l] == '\0')
/* last_pc_address was in last function */
valu = SYMBOL_VALUE (m+1);
else
@ -2176,9 +2212,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
previous_stab_code = type;
}
/* FIXME: The only difference between this and elfstab_build_psymtabs is
the call to install_minimal_symbols for elf. If the differences are
really that small, the code should be shared. */
/* FIXME: The only difference between this and elfstab_build_psymtabs
is the call to install_minimal_symbols for elf, and the support for
split sections. If the differences are really that small, the code
should be shared. */
/* Scan and build partial symbols for an coff symbol file.
The coff file has already been processed to get its minimal symbols.
@ -2191,8 +2228,9 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
the base address of the text segment).
MAINLINE is true if we are reading the main symbol
table (as opposed to a shared lib or dynamically loaded file).
STABOFFSET and STABSIZE define the location in OBJFILE where the .stab
section exists.
TEXTADDR is the address of the text section.
TEXTSIZE is the size of the text section.
STABSECTS is the list of .stab sections in OBJFILE.
STABSTROFFSET and STABSTRSIZE define the location in OBJFILE where the
.stabstr section exists.
@ -2201,13 +2239,14 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
void
coffstab_build_psymtabs (objfile, section_offsets, mainline,
staboffset, stabsize,
textaddr, textsize, stabsects,
stabstroffset, stabstrsize)
struct objfile *objfile;
struct section_offsets *section_offsets;
int mainline;
file_ptr staboffset;
unsigned int stabsize;
CORE_ADDR textaddr;
unsigned int textsize;
struct stab_section_list *stabsects;
file_ptr stabstroffset;
unsigned int stabstrsize;
{
@ -2215,20 +2254,18 @@ coffstab_build_psymtabs (objfile, section_offsets, mainline,
bfd *sym_bfd = objfile->obfd;
char *name = bfd_get_filename (sym_bfd);
struct dbx_symfile_info *info;
unsigned int stabsize;
/* There is already a dbx_symfile_info allocated by our caller.
It might even contain some info from the coff symtab to help us. */
info = (struct dbx_symfile_info *) objfile->sym_stab_info;
DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
if (!DBX_TEXT_SECT (objfile))
error ("Can't find .text section in symbol file");
DBX_TEXT_ADDR (objfile) = textaddr;
DBX_TEXT_SIZE (objfile) = textsize;
#define COFF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
DBX_SYMBOL_SIZE (objfile) = COFF_STABS_SYMBOL_SIZE;
DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = staboffset;
if (stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
@ -2254,6 +2291,30 @@ coffstab_build_psymtabs (objfile, section_offsets, mainline,
/* In a coff file, we've already installed the minimal symbols that came
from the coff (non-stab) symbol table, so always act like an
incremental load here. */
if (stabsects->next == NULL)
{
stabsize = bfd_section_size (sym_bfd, stabsects->section);
DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
}
else
{
struct stab_section_list *stabsect;
DBX_SYMCOUNT (objfile) = 0;
for (stabsect = stabsects; stabsect != NULL; stabsect = stabsect->next)
{
stabsize = bfd_section_size (sym_bfd, stabsect->section);
DBX_SYMCOUNT (objfile) += stabsize / DBX_SYMBOL_SIZE (objfile);
}
DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
symbuf_sections = stabsects->next;
symbuf_left = bfd_section_size (sym_bfd, stabsects->section);
symbuf_read = 0;
}
dbx_symfile_read (objfile, section_offsets, 0);
}
@ -2293,14 +2354,17 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
bfd *sym_bfd = objfile->obfd;
char *name = bfd_get_filename (sym_bfd);
struct dbx_symfile_info *info;
asection *text_sect;
/* There is already a dbx_symfile_info allocated by our caller.
It might even contain some info from the ELF symtab to help us. */
info = (struct dbx_symfile_info *) objfile->sym_stab_info;
DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
if (!DBX_TEXT_SECT (objfile))
text_sect = bfd_get_section_by_name (sym_bfd, ".text");
if (!text_sect)
error ("Can't find .text section in symbol file");
DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
#define ELF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
DBX_SYMBOL_SIZE (objfile) = ELF_STABS_SYMBOL_SIZE;
@ -2368,6 +2432,7 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
char *name = bfd_get_filename (sym_bfd);
asection *stabsect;
asection *stabstrsect;
asection *text_sect;
stabsect = bfd_get_section_by_name (sym_bfd, stab_name);
stabstrsect = bfd_get_section_by_name (sym_bfd, stabstr_name);
@ -2382,9 +2447,11 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
objfile->sym_stab_info = (PTR) xmalloc (sizeof (struct dbx_symfile_info));
memset (DBX_SYMFILE_INFO (objfile), 0, sizeof (struct dbx_symfile_info));
DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, text_name);
if (!DBX_TEXT_SECT (objfile))
text_sect = bfd_get_section_by_name (sym_bfd, text_name);
if (!text_sect)
error ("Can't find %s section in symbol file", text_name);
DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
DBX_SYMCOUNT (objfile) = bfd_section_size (sym_bfd, stabsect)

View File

@ -22,7 +22,7 @@
#include "defs.h"
#include "dcache.h"
#include "gdbcmd.h"
#include <string.h>
#include "gdb_string.h"
/*

View File

@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "command.h"
#include "gdbcmd.h"
#include "demangle.h"
#include <string.h>
#include "gdb_string.h"
/* Select the default C++ demangling style to use. The default is "auto",
which allows gdb to attempt to pick an appropriate demangling style for

View File

@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "gdbcore.h"
#include <string.h>
#include "gdb_string.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/dir.h>

View File

@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "buildsym.h"
#include <obstack.h>
#include <string.h>
#include "gdb_string.h"
#include "dst.h"

View File

@ -51,7 +51,7 @@ other things to work on, if you get bored. :-)
#include "complaints.h"
#include <fcntl.h>
#include <string.h>
#include "gdb_string.h"
#ifndef NO_SYS_FILE
#include <sys/file.h>

View File

@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "bfd.h"
#include <string.h>
#include "gdb_string.h"
#include "libelf.h"
#include "elf/mips.h"
#include "symtab.h"

View File

@ -20,8 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "environ.h"
#include <string.h>
#include "defs.h" /* For strsave(). */
#include "gdb_string.h"
#include "gdbcore.h"
/* Return a new environment object. */
@ -64,6 +64,9 @@ init_environ (e)
extern char **environ;
register int i;
if (environ == NULL)
return;
for (i = 0; environ[i]; i++) /*EMPTY*/;
if (e->allocated < i)
@ -149,26 +152,16 @@ set_in_environ (e, var, value)
strcat (s, value);
vector[i] = s;
/* Certain variables get exported back to the parent (e.g. our)
environment, too. FIXME: this is a hideous hack and should not be
allowed to live. What if we want to change the environment we pass to
the program without affecting GDB's behavior? */
if (STREQ(var, "PATH") /* Object file location */
|| STREQ (var, "G960BASE") /* Intel 960 downloads */
|| STREQ (var, "G960BIN") /* Intel 960 downloads */
)
{
putenv (strsave (s));
}
/* This used to handle setting the PATH and GNUTARGET variables
specially. The latter has been replaced by "set gnutarget"
(which has worked since GDB 4.11). The former affects searching
the PATH to find SHELL, and searching the PATH to find the
argument of "symbol-file" or "exec-file". Maybe we should have
some kind of "set exec-path" for that. But in any event, having
"set env" affect anything besides the inferior is a bad idea.
What if we want to change the environment we pass to the program
without afecting GDB's behavior? */
/* This is a compatibility hack, since GDB 4.10 and older didn't have
`set gnutarget'. Eventually it should go away, so that (for example)
you can debug objdump's handling of GNUTARGET without affecting GDB's
behavior. */
if (STREQ (var, "GNUTARGET"))
{
set_gnutarget (value);
}
return;
}

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
@ -226,10 +226,8 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
struct type *type;
int nargs;
value_ptr *argvec;
struct symbol *tmp_symbol;
int upper, lower, retcode;
int code;
struct internalvar *var;
/* This expect_type crap should not be used for C. C expressions do
not have any notion of expected types, never has and (goddess
@ -1173,8 +1171,12 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT)
error ("Non-integral right operand for \"@\" operator.");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return allocate_repeat_value (VALUE_TYPE (arg1),
longest_to_int (value_as_long (arg2)));
{
if (VALUE_REPEATED (arg1))
error ("Cannot create artificial arrays of artificial arrays.");
return allocate_repeat_value (VALUE_TYPE (arg1),
longest_to_int (value_as_long (arg2)));
}
else
return value_repeat (arg1, longest_to_int (value_as_long (arg2)));

View File

@ -32,12 +32,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/param.h>
#include <fcntl.h>
#include <string.h>
#include "gdb_string.h"
#include "gdbcore.h"
#include <ctype.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
@ -588,26 +588,47 @@ ignore (addr, contents)
}
struct target_ops exec_ops = {
"exec", "Local exec file",
"Use an executable file as a target.\n\
Specify the filename of the executable file.",
exec_file_command, exec_close, /* open, close */
find_default_attach, 0, 0, 0, /* attach, detach, resume, wait, */
0, 0, /* fetch_registers, store_registers, */
0, /* prepare_to_store, */
xfer_memory, exec_files_info,
ignore, ignore, /* insert_breakpoint, remove_breakpoint, */
0, 0, 0, 0, 0, /* terminal stuff */
0, 0, /* kill, load */
0, /* lookup sym */
find_default_create_inferior,
0, /* mourn_inferior */
0, /* can_run */
0, /* notice_signals */
file_stratum, 0, /* next */
0, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
OPS_MAGIC, /* Always the last thing */
"exec", /* to_shortname */
"Local exec file", /* to_longname */
"Use an executable file as a target.\n\
Specify the filename of the executable file.", /* to_doc */
exec_file_command, /* to_open */
exec_close, /* to_close */
find_default_attach, /* to_attach */
0, /* to_detach */
0, /* to_resume */
0, /* to_wait */
0, /* to_fetch_registers */
0, /* to_store_registers */
0, /* to_prepare_to_store */
xfer_memory, /* to_xfer_memory */
exec_files_info, /* to_files_info */
ignore, /* to_insert_breakpoint */
ignore, /* to_remove_breakpoint */
0, /* to_terminal_init */
0, /* to_terminal_inferior */
0, /* to_terminal_ours_for_output */
0, /* to_terminal_ours */
0, /* to_terminal_info */
0, /* to_kill */
0, /* to_load */
0, /* to_lookup_symbol */
find_default_create_inferior, /* to_create_inferior */
0, /* to_mourn_inferior */
0, /* to_can_run */
0, /* to_notice_signals */
0, /* to_thread_alive */
0, /* to_stop */
file_stratum, /* to_stratum */
0, /* to_next */
0, /* to_has_all_memory */
1, /* to_has_memory */
0, /* to_has_stack */
0, /* to_has_registers */
0, /* to_has_execution */
0, /* to_sections */
0, /* to_sections_end */
OPS_MAGIC, /* to_magic */
};
void

View File

@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"

View File

@ -36,7 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "typeprint.h"
#include "frame.h" /* ??? */
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
#if 0 /* Currently unused */

View File

@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"

View File

@ -25,7 +25,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
#include <string.h>
#include "gdb_string.h"
/* Registers we shouldn't try to store. */
#if !defined (CANNOT_STORE_REGISTER)
#define CANNOT_STORE_REGISTER(regno) 0
#endif
static void write_register_pid PARAMS ((int regno, LONGEST val, int pid));
@ -499,6 +504,9 @@ registers_changed ()
for (i = 0; i < numregs; i++)
register_valid[i] = 0;
if (registers_changed_hook)
registers_changed_hook ();
}
/* Indicate that all registers have been fetched, so mark them all valid. */
@ -511,18 +519,33 @@ registers_fetched ()
register_valid[i] = 1;
}
/* Copy LEN bytes of consecutive data from registers
starting with the REGBYTE'th byte of register data
/* read_register_bytes and write_register_bytes are generally a *BAD* idea.
They are inefficient because they need to check for partial updates, which
can only be done by scanning through all of the registers and seeing if the
bytes that are being read/written fall inside of an invalid register. [The
main reason this is necessary is that register sizes can vary, so a simple
index won't suffice.] It is far better to call read_register_gen if you
want to get at the raw register contents, as it only takes a regno as an
argument, and therefore can't do a partial register update. It would also
be good to have a write_register_gen for similar reasons.
Prior to the recent fixes to check for partial updates, both read and
write_register_bytes always checked to see if any registers were stale, and
then called target_fetch_registers (-1) to update the whole set. This
caused really slowed things down for remote targets. */
/* Copy INLEN bytes of consecutive data from registers
starting with the INREGBYTE'th byte of register data
into memory at MYADDR. */
void
read_register_bytes (regbyte, myaddr, len)
int regbyte;
read_register_bytes (inregbyte, myaddr, inlen)
int inregbyte;
char *myaddr;
int len;
int inlen;
{
/* Fetch all registers. */
int i, numregs;
int inregend = inregbyte + inlen;
int regno;
if (registers_pid != inferior_pid)
{
@ -530,15 +553,37 @@ read_register_bytes (regbyte, myaddr, len)
registers_pid = inferior_pid;
}
numregs = ARCH_NUM_REGS;
for (i = 0; i < numregs; i++)
if (!register_valid[i])
{
target_fetch_registers (-1);
break;
}
/* See if we are trying to read bytes from out-of-date registers. If so,
update just those registers. */
for (regno = 0; regno < NUM_REGS; regno++)
{
int regstart, regend;
int startin, endin;
if (register_valid[regno])
continue;
regstart = REGISTER_BYTE (regno);
regend = regstart + REGISTER_RAW_SIZE (regno);
startin = regstart >= inregbyte && regstart < inregend;
endin = regend > inregbyte && regend <= inregend;
if (!startin && !endin)
continue;
/* We've found an invalid register where at least one byte will be read.
Update it from the target. */
target_fetch_registers (regno);
if (!register_valid[regno])
error ("read_register_bytes: Couldn't update register %d.", regno);
}
if (myaddr != NULL)
memcpy (myaddr, &registers[regbyte], len);
memcpy (myaddr, &registers[inregbyte], inlen);
}
/* Read register REGNO into memory at MYADDR, which must be large enough
@ -562,25 +607,99 @@ read_register_gen (regno, myaddr)
REGISTER_RAW_SIZE (regno));
}
/* Copy LEN bytes of consecutive data from memory at MYADDR
into registers starting with the REGBYTE'th byte of register data. */
/* Write register REGNO at MYADDR to the target. MYADDR points at
REGISTER_RAW_BYTES(REGNO), which must be in target byte-order. */
void
write_register_bytes (regbyte, myaddr, len)
int regbyte;
write_register_gen (regno, myaddr)
int regno;
char *myaddr;
int len;
{
int size;
/* On the sparc, writing %g0 is a no-op, so we don't even want to change
the registers array if something writes to this register. */
if (CANNOT_STORE_REGISTER (regno))
return;
if (registers_pid != inferior_pid)
{
registers_changed ();
registers_pid = inferior_pid;
}
/* Make sure the entire registers array is valid. */
read_register_bytes (0, (char *)NULL, REGISTER_BYTES);
memcpy (&registers[regbyte], myaddr, len);
target_store_registers (-1);
size = REGISTER_RAW_SIZE(regno);
/* If we have a valid copy of the register, and new value == old value,
then don't bother doing the actual store. */
if (register_valid [regno]
&& memcmp (&registers[REGISTER_BYTE (regno)], myaddr, size) == 0)
return;
target_prepare_to_store ();
memcpy (&registers[REGISTER_BYTE (regno)], myaddr, size);
register_valid [regno] = 1;
target_store_registers (regno);
}
/* Copy INLEN bytes of consecutive data from memory at MYADDR
into registers starting with the MYREGSTART'th byte of register data. */
void
write_register_bytes (myregstart, myaddr, inlen)
int myregstart;
char *myaddr;
int inlen;
{
int myregend = myregstart + inlen;
int regno;
target_prepare_to_store ();
/* Scan through the registers updating any that are covered by the range
myregstart<=>myregend using write_register_gen, which does nice things
like handling threads, and avoiding updates when the new and old contents
are the same. */
for (regno = 0; regno < NUM_REGS; regno++)
{
int regstart, regend;
int startin, endin;
char regbuf[MAX_REGISTER_RAW_SIZE];
regstart = REGISTER_BYTE (regno);
regend = regstart + REGISTER_RAW_SIZE (regno);
startin = regstart >= myregstart && regstart < myregend;
endin = regend > myregstart && regend <= myregend;
if (!startin && !endin)
continue; /* Register is completely out of range */
if (startin && endin) /* register is completely in range */
{
write_register_gen (regno, myaddr + (regstart - myregstart));
continue;
}
/* We may be doing a partial update of an invalid register. Update it
from the target before scribbling on it. */
read_register_gen (regno, regbuf);
if (startin)
memcpy (registers + regstart,
myaddr + regstart - myregstart,
myregend - regstart);
else /* endin */
memcpy (registers + myregstart,
myaddr,
regend - myregstart);
target_store_registers (regno);
}
}
/* Return the raw contents of register REGNO, regarding it as an integer. */
@ -624,11 +743,6 @@ read_register_pid (regno, pid)
return retval;
}
/* Registers we shouldn't try to store. */
#if !defined (CANNOT_STORE_REGISTER)
#define CANNOT_STORE_REGISTER(regno) 0
#endif
/* Store VALUE, into the raw contents of register number REGNO. */
void

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "target.h"

68
gdb/gdb_stat.h Normal file
View File

@ -0,0 +1,68 @@
/* Portable <sys/stat.h>
Copyright 1995 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined(GDB_STAT_H)
#define GDB_STAT_H
#include <sys/types.h>
#include <sys/stat.h>
#ifdef STAT_MACROS_BROKEN
#undef S_ISBLK
#undef S_ISCHR
#undef S_ISDIR
#undef S_ISREG
#undef S_ISFIFO
#undef S_ISLNK
#undef S_ISSOCK
#undef S_ISMPB
#undef S_ISMPC
#undef S_ISNWK
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
#endif
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
#endif /* !defined(GDB_STAT_H) */

48
gdb/gdb_string.h Normal file
View File

@ -0,0 +1,48 @@
/* Portable <string.h>
Copyright 1995 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined(GDB_STRING_H)
#define GDB_STRING_H
#ifdef STDC_HEADERS
#include <string.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# include <strings.h>
# endif
extern char *strchr();
extern char *strrchr();
extern char *strstr();
extern char *strtok();
extern char *strerror();
# ifdef HAVE_MEMORY_H
# include <memory.h>
# else
extern void *memset();
extern void *memcpy();
extern void *memmove();
extern int memcmp();
# endif
#endif
extern char *strdup();
#endif /* !defined(GDB_STRING_H) */

View File

@ -40,7 +40,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <setjmp.h>
#include "top.h"
#include <sys/ioctl.h>
#include <string.h>
#include "gdb_string.h"
#include "dis-asm.h"
#include <stdio.h>
#include "gdbcmd.h"

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "bfd.h"
#include "symtab.h"
#include "symfile.h"

View File

@ -31,7 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
/* Work with core dump and executable files, for GDB.

View File

@ -46,7 +46,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*#include <sys/user.h> After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include "wait.h"
#include "gdbcore.h"

View File

@ -22,7 +22,7 @@
#include "defs.h"
#include "bfd.h"
#include <string.h>
#include "gdb_string.h"
#include "hp-symtab.h"
#include "syms.h"
#include "symtab.h"

View File

@ -17,7 +17,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <string.h>
#include "gdb_string.h"
#include "defs.h"
#include "frame.h"
#include "inferior.h"

View File

@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <stddef.h>
#include <sys/ptrace.h>

View File

@ -90,7 +90,7 @@ i386_register_u_addr (blockend, regnum)
#include <sys/user.h>
#undef curpcb
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <sys/ptrace.h>
extern void print_387_control_word (); /* i387-tdep.h */

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <machine/reg.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <sys/core.h>

View File

@ -39,7 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#ifndef NO_SYS_REG_H
#include <sys/reg.h>

View File

@ -1,5 +1,5 @@
/* Memory-access and commands for "inferior" process, for GDB.
Copyright 1986, 1987, 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1995 Free Software Foundation, Inc.
This file is part of GDB.
@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <signal.h>
#include <sys/param.h>
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "frame.h"
@ -359,7 +359,6 @@ step_1 (skip_subroutines, single_inst, count_string)
printf_filtered ("\
Single stepping until exit from function %s, \n\
which has no line number information.\n", name);
gdb_flush (gdb_stdout);
}
}
else
@ -571,7 +570,7 @@ run_stack_dummy (addr, buffer)
bpt = set_momentary_breakpoint (sal,
get_current_frame (),
bp_call_dummy);
bpt->disposition = delete;
bpt->disposition = del;
/* If all error()s out of proceed ended up calling normal_stop (and
perhaps they should; it already does in the special case of error

View File

@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "thread.h"
#include <string.h>
#include "gdb_string.h"
#include <signal.h>
#include <fcntl.h>

View File

@ -1,5 +1,6 @@
/* Low level Unix child interface to ptrace, for GDB when running under Unix.
Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
@ -21,6 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "frame.h"
#include "inferior.h"
#include "target.h"
#include "gdb_string.h"
#ifdef USG
#include <sys/types.h>
@ -69,7 +71,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Don't think this is used anymore. On the sequent (not sure whether it's
dynix or ptx or both), it is included unconditionally by sys/user.h and
not protected against multiple inclusion. */
#include <sys/stat.h>
#include "gdb_stat.h"
#endif
#if !defined (FETCH_INFERIOR_REGISTERS)
@ -110,13 +112,18 @@ kill_inferior ()
if (inferior_pid == 0)
return;
/* ptrace PT_KILL only works if process is stopped!!! So stop it with
a real signal first, if we can. */
a real signal first, if we can. FIXME: This is bogus. When the inferior
is not stopped, GDB should just be waiting for it. Either the following
line is unecessary, or there is some problem elsewhere in GDB which
causes us to get here when the inferior is not stopped. */
kill (inferior_pid, SIGKILL);
ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0);
wait ((int *)0);
target_mourn_inferior ();
}
#ifndef CHILD_RESUME
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
@ -131,15 +138,9 @@ child_resume (pid, step, signal)
if (pid == -1)
/* Resume all threads. */
#ifdef PIDGET
/* This is for Lynx, and should be cleaned up by having Lynx be
a separate debugging target, with its own target_resume function. */
pid = PIDGET (inferior_pid);
#else
/* I think this only gets used in the non-threaded case, where "resume
all threads" and "resume inferior_pid" are the same. */
pid = inferior_pid;
#endif
/* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
it was. (If GDB wanted it to start some other way, we have already
@ -160,6 +161,8 @@ child_resume (pid, step, signal)
if (errno)
perror_with_name ("ptrace");
}
#endif /* CHILD_RESUME */
#ifdef ATTACH_DETACH
/* Start debugging the process whose number is PID. */
@ -243,7 +246,8 @@ static void
fetch_register (regno)
int regno;
{
register unsigned int regaddr;
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
char buf[MAX_REGISTER_RAW_SIZE];
char mess[128]; /* For messages */
register int i;
@ -283,9 +287,14 @@ void
fetch_inferior_registers (regno)
int regno;
{
int numregs;
if (regno == -1)
for (regno = 0; regno < NUM_REGS; regno++)
fetch_register (regno);
{
numregs = ARCH_NUM_REGS;
for (regno = 0; regno < numregs; regno++)
fetch_register (regno);
}
else
fetch_register (regno);
}
@ -303,9 +312,10 @@ void
store_inferior_registers (regno)
int regno;
{
register unsigned int regaddr;
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
char buf[80];
register int i;
register int i, numregs;
unsigned int offset = U_REGS_OFFSET;
@ -327,7 +337,8 @@ store_inferior_registers (regno)
}
else
{
for (regno = 0; regno < NUM_REGS; regno++)
numregs = ARCH_NUM_REGS;
for (regno = 0; regno < numregs; regno++)
{
if (CANNOT_STORE_REGISTER (regno))
continue;

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <ctype.h>
#include "symtab.h"
#include "frame.h"
@ -479,7 +479,9 @@ wait_for_inferior ()
else
pid = target_wait (-1, &w);
#ifdef HAVE_NONSTEPPABLE_WATCHPOINT
have_waited:
#endif
flush_cached_frames ();
@ -527,6 +529,12 @@ wait_for_inferior ()
(unsigned int)w.value.integer);
else
printf_filtered ("\nProgram exited normally.\n");
/* Record the exit code in the convenience variable $_exitcode, so
that the user can inspect this again later. */
set_internalvar (lookup_internalvar ("_exitcode"),
value_from_longest (builtin_type_int,
(LONGEST) w.value.integer));
gdb_flush (gdb_stdout);
target_mourn_inferior ();
#ifdef NO_SINGLE_STEP
@ -650,32 +658,28 @@ wait_for_inferior ()
/* It's a SIGTRAP or a signal we're interested in. Switch threads,
and fall into the rest of wait_for_inferior(). */
/* Save infrun state for the old thread. */
save_infrun_state (inferior_pid, prev_pc,
prev_func_start, prev_func_name,
trap_expected, step_resume_breakpoint,
through_sigtramp_breakpoint,
step_range_start, step_range_end,
step_frame_address, handling_longjmp,
another_trap);
inferior_pid = pid;
/* Load infrun state for the new thread. */
load_infrun_state (inferior_pid, &prev_pc,
&prev_func_start, &prev_func_name,
&trap_expected, &step_resume_breakpoint,
&through_sigtramp_breakpoint,
&step_range_start, &step_range_end,
&step_frame_address, &handling_longjmp,
&another_trap);
printf_filtered ("[Switching to %s]\n", target_pid_to_str (pid));
flush_cached_frames ();
trap_expected = 0;
if (step_resume_breakpoint)
{
delete_breakpoint (step_resume_breakpoint);
step_resume_breakpoint = NULL;
}
/* Not sure whether we need to blow this away too,
but probably it is like the step-resume
breakpoint. */
if (through_sigtramp_breakpoint)
{
delete_breakpoint (through_sigtramp_breakpoint);
through_sigtramp_breakpoint = NULL;
}
prev_pc = 0;
prev_func_name = NULL;
step_range_start = 0;
step_range_end = 0;
step_frame_address = 0;
handling_longjmp = 0;
another_trap = 0;
}
#ifdef NO_SINGLE_STEP

View File

@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include <string.h>
#include "gdb_string.h"
#include <sys/time.h>
#include <sys/procfs.h>
#include <setjmp.h> /* For JB_XXX. */

View File

@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
whenever the working language changes. That would be a lot faster. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else

View File

@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "demangle.h"
#include "m2-lang.h"
#include <string.h>
#include "gdb_string.h"
#include <errno.h>
void

View File

@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include "symtab.h"
#include "setjmp.h"

View File

@ -28,10 +28,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "getopt.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <ctype.h>
#include <string.h>
#include "gdb_string.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -77,8 +77,8 @@ typedef struct mips_extra_func_info {
#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <string.h>
#include "gdb_stat.h"
#include "gdb_string.h"
#include "gdb-stabs.h"

View File

@ -38,7 +38,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"

View File

@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
mdebugread.c. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "bfd.h"
#include "symtab.h"
#include "symfile.h"
@ -101,7 +101,8 @@ mipscoff_symfile_read (objfile, section_offsets, mainline)
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
if (ecoff_slurp_symbolic_info (abfd) == false)
if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info)
(abfd, (asection *) NULL, &ecoff_data (abfd)->debug_info)))
error ("Error reading symbol table: %s", bfd_errmsg (bfd_get_error ()));
mdebug_build_psymtabs (objfile, &ecoff_backend (abfd)->debug_swap,
@ -112,13 +113,6 @@ mipscoff_symfile_read (objfile, section_offsets, mainline)
if (mainline)
read_alphacoff_dynamic_symtab (section_offsets, objfile);
if (!have_partial_symbols ())
{
wrap_here ("");
printf_filtered ("(no debugging symbols found)...");
wrap_here ("");
}
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */

View File

@ -38,7 +38,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include "gdb_string.h"
#include <sys/types.h>
#include "command.h"
#include "serial.h"
@ -865,7 +865,7 @@ monitor_files_info (ops)
static int
monitor_write_memory (memaddr, myaddr, len)
CORE_ADDR memaddr;
unsigned char *myaddr;
char *myaddr;
int len;
{
unsigned LONGEST val;
@ -929,7 +929,7 @@ monitor_write_memory (memaddr, myaddr, len)
static int
monitor_read_memory_single (memaddr, myaddr, len)
CORE_ADDR memaddr;
unsigned char *myaddr;
char *myaddr;
int len;
{
unsigned LONGEST val;
@ -1426,7 +1426,7 @@ monitor_make_srec (buffer, type, memaddr, myaddr, len)
unsigned char checksum;
int i;
char *buf;
static char hextab[16] = "0123456789ABCDEF";
static char hextab[] = "0123456789ABCDEF";
static char data_code_table[] = { 0,0,1,2,3};
static char term_code_table[] = { 0,0,9,8,7};
int addr_size; /* Number of bytes in the record */
@ -1545,6 +1545,7 @@ static struct target_ops monitor_ops =
monitor_mourn_inferior, /* to_mourn_inferior */
0, /* to_can_run */
0, /* to_notice_signals */
0, /* to_thread_alive */
monitor_stop, /* to_stop */
process_stratum, /* to_stratum */
0, /* to_next */

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "bfd.h"
#include "symtab.h"
#include "symfile.h"

View File

@ -30,10 +30,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include <fcntl.h>
#include <obstack.h>
#include <string.h>
#include "gdb_string.h"
/* Prototypes for local functions */

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
for real. os9k_psymtab_to_symtab() is the function that does this */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <stdio.h>
#if defined(USG) || defined(__CYGNUSCLIB__)
@ -46,7 +46,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef NO_SYS_FILE
#include <sys/file.h>
#endif
#include <sys/stat.h>
#include "gdb_stat.h"
#include <ctype.h>
#include "symtab.h"
#include "breakpoint.h"

View File

@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/types.h>
#include <signal.h>
#include <string.h>
#include "gdb_string.h"
#include <fcntl.h>
#include "symtab.h"

View File

@ -29,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
come first in the result. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "frame.h"

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "frame.h"
#include "symtab.h"
#include "gdbtypes.h"
@ -945,7 +945,7 @@ address_info (exp, from_tty)
printf_filtered ("Symbol \"");
fprintf_symbol_filtered (gdb_stdout, SYMBOL_NAME (sym),
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is ", SYMBOL_NAME (sym));
printf_filtered ("\" is ");
val = SYMBOL_VALUE (sym);
basereg = SYMBOL_BASEREG (sym);
@ -1702,7 +1702,7 @@ print_frame_nameless_args (fi, start, num, first, stream)
#ifdef PRINT_TYPELESS_INTEGER
PRINT_TYPELESS_INTEGER (stream, builtin_type_int, (LONGEST) arg_value);
#else
fprintf_filtered (stream, "%d", arg_value);
fprintf_filtered (stream, "%ld", arg_value);
#endif /* PRINT_TYPELESS_INTEGER */
#endif /* PRINT_NAMELESS_INTEGER */
first = 0;

View File

@ -41,11 +41,11 @@ regardless of whether or not the actual target has floating point hardware.
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include "gdb_string.h"
#include <stropts.h>
#include <poll.h>
#include <unistd.h>
#include <sys/stat.h>
#include "gdb_stat.h"
#include "inferior.h"
#include "target.h"

View File

@ -30,7 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include "gdb_stat.h"
void

View File

@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#else /* not emacs */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
/*
* Define the syntax stuff, so we can do the \<...\> things.

View File

@ -30,7 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
7/91 o - Freeze mode tracing can be done on a 29050. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "inferior.h"
#include "wait.h"
#include "value.h"

View File

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <fcntl.h>
#include "frame.h"
#include "inferior.h"

View File

@ -34,7 +34,7 @@
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include "gdb_string.h"
#include <sys/types.h>
#include "command.h"
#include "serial.h"

View File

@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "inferior.h"
#include "wait.h"
#include <string.h>
#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
over the net in real time. */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include "inferior.h"
#include "bfd.h"

View File

@ -96,7 +96,7 @@ STP
#include <sys/file.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include "gdb_string.h"
#include <setjmp.h>
#include <fcntl.h>
#include "defs.h"

View File

@ -172,7 +172,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
#include "inferior.h"
#include "wait.h"
#include "value.h"
#include <string.h>
#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>

View File

@ -37,7 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include "gdb_string.h"
#include "terminal.h"
#include "minimon.h"
#include "target.h"

View File

@ -43,7 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include "gdb_string.h"
#include <sys/types.h>
#include "command.h"
#include "serial.h"

View File

@ -135,7 +135,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
"0* " means the same as "0000". */
#include "defs.h"
#include <string.h>
#include "gdb_string.h"
#include <fcntl.h>
#include "frame.h"
#include "inferior.h"

Some files were not shown because too many files have changed in this diff Show More