* All GDB files that #include defs.h: Removed stdio.h.
(defs.h): #include stdio.h.
This has been tested by building GDBs for all targets hosted on Sun4.
None of the build problems were related to stdio.h inclusion. (n.b.
many configurations don't build for other reasons.)
+Tue Mar 3 15:11:52 1992 Michael Tiemann (tiemann@cygnus.com)
+
+ * All GDB files that #include defs.h: Removed stdio.h.
+ (defs.h): #include stdio.h.
+
Mon Mar 2 23:00:12 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* gdbtypes.c (lookup_pointer_type): initialize the TYPE_LENGTH of
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "target.h"
#include "am29k-opcode.h"
#include "defs.h"
#include "gdbcore.h"
-#include <stdio.h>
#include "frame.h"
#include "value.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
+#include "defs.h"
#include <ctype.h>
#include <assert.h>
-#include "defs.h"
#include "symtab.h"
#include "opcode/arm.h"
#include "inferior.h"
#include "arm-opcode.h"
-#include <stdio.h>
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
They originated in dbxread.c of gdb-4.2, and were split out to
make xcoffread.c more maintainable by sharing code. */
-#include <stdio.h>
#include "defs.h"
#include "obstack.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "gdbcmd.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "command.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "command.h"
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
+#include "defs.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
-#include "defs.h"
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "symtab.h"
/* core.c is supposed to be the more machine-independent aspects of this;
this file is more machine-specific. */
-#include <stdio.h>
+#include "defs.h"
#include <sys/types.h>
#include <sys/param.h>
-#include "defs.h"
#include "gdbcore.h"
/* These are needed on various systems to expand REGISTER_U_ADDR. */
/* define this if names don't start with _ */
/* #define nounderscore 1 */
-#include <stdio.h>
-#include <ctype.h>
-
/* GDB-specific, FIXME. */
#include "defs.h"
+#include <ctype.h>
+
#ifdef USG
#include <memory.h>
#include <string.h>
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (DEFS_H)
-#define DEFS_H
+#define DEFS_H 1
+
+#include <stdio.h>
+
+/* First include ansidecl.h so we can use the various macro definitions
+ in all subsequent file inclusions. FIXME: This inclusion can now
+ be removed from all files that include defs.h */
+
+#include "ansidecl.h"
+
+/* We could use the EXFUN macro in ansidecl.h to handle prototypes, but
+ the name is misleading the the result is ugly. So just define a simple
+ macro to handle the parameter lists. */
+
+#ifdef __STDC__
+#define PARAMS(paramlist) paramlist
+#else
+#define PARAMS(paramlist) ()
+#endif
/* An address in the program being debugged. Host byte order. */
typedef unsigned int CORE_ADDR;
extern int quit_flag;
extern int immediate_quit;
-extern void quit ();
+
+extern void
+quit PARAMS ((void));
#define QUIT { if (quit_flag) quit (); }
struct cleanup
{
struct cleanup *next;
- void (*function) ();
- int arg;
+ void (*function) PARAMS ((PTR));
+ PTR arg;
};
-/* From utils.c. */
-extern void do_cleanups ();
-extern void discard_cleanups ();
-extern struct cleanup *make_cleanup ();
-extern struct cleanup *save_cleanups ();
-extern void restore_cleanups ();
-extern void free_current_contents ();
-extern int myread ();
-extern int query ();
-extern void wrap_here (
-#ifdef __STDC__
- char *
-#endif
- );
-extern void reinitialize_more_filter ();
-extern void fputs_filtered ();
-extern void puts_filtered ();
-extern void fprintf_filtered ();
-extern void printf_filtered ();
-extern void print_spaces ();
-extern void print_spaces_filtered ();
-extern char *n_spaces ();
-extern void printchar ();
-extern void fprint_symbol ();
-extern void fputs_demangled ();
-extern void perror_with_name ();
-extern void print_sys_errmsg ();
+/* From blockframe.c */
+
+extern int
+inside_entry_scope PARAMS ((CORE_ADDR));
+
+extern int
+outside_startup_file PARAMS ((CORE_ADDR addr));
+
+extern int
+inside_main_scope PARAMS ((CORE_ADDR pc));
+
+/* From cplus-dem.c */
+
+extern char *
+cplus_demangle PARAMS ((const char *, int));
+
+extern char *
+cplus_mangle_opname PARAMS ((char *, int));
+
+/* From mmap-*.c */
+
+extern PTR
+mmap_malloc PARAMS ((long));
+
+extern PTR
+mmap_realloc PARAMS ((PTR, long));
+
+extern PTR
+mmap_xmalloc PARAMS ((long));
+
+extern PTR
+mmap_xrealloc PARAMS ((PTR, long));
+
+extern void
+mmap_free PARAMS ((PTR));
+
+extern PTR
+mmap_sbrk PARAMS ((int));
+
+extern PTR
+mmap_base PARAMS ((void));
+
+extern PTR
+mmap_page_align PARAMS ((PTR));
+
+extern PTR
+mmap_remap PARAMS ((PTR, long, int, long));
+
+/* From utils.c */
+
+extern void
+init_malloc PARAMS ((void));
+
+extern void
+request_quit PARAMS ((int));
+
+extern void
+do_cleanups PARAMS ((struct cleanup *));
+
+extern void
+discard_cleanups PARAMS ((struct cleanup *));
+
+/* The bare make_cleanup function is one of those rare beasts that
+ takes almost any type of function as the first arg and anything that
+ will fit in a "void *" as the second arg.
+
+ Should be, once all calls and called-functions are cleaned up:
+extern struct cleanup *
+make_cleanup PARAMS ((void (*function) (PTR), PTR));
+
+ Until then, lint and/or various type-checking compiler options will
+ complain about make_cleanup calls. It'd be wrong to just cast things,
+ since the type actually passed when the function is called would be
+ wrong. */
+
+extern struct cleanup *
+make_cleanup ();
+
+extern struct cleanup *
+save_cleanups PARAMS ((void));
+
+extern void
+restore_cleanups PARAMS ((struct cleanup *));
+
+extern void
+free_current_contents PARAMS ((char **));
+
+extern void
+null_cleanup PARAMS ((char **));
+
+extern int
+myread PARAMS ((int, char *, int));
+
+extern int
+query ();
+
+extern void
+wrap_here PARAMS ((char *));
+
+extern void
+reinitialize_more_filter PARAMS ((void));
+
+extern int
+print_insn PARAMS ((CORE_ADDR, FILE *));
+
+extern void
+fputs_filtered PARAMS ((const char *, FILE *));
+
+extern void
+puts_filtered PARAMS ((char *));
+
+extern void
+fprintf_filtered ();
+
+extern void
+printf_filtered ();
+
+extern void
+print_spaces PARAMS ((int, FILE *));
+
+extern void
+print_spaces_filtered PARAMS ((int, FILE *));
+
+extern char *
+n_spaces PARAMS ((int));
+
+extern void
+printchar PARAMS ((int, FILE *, int));
+
+extern void
+fprint_symbol PARAMS ((FILE *, char *));
+
+extern void
+fputs_demangled PARAMS ((char *, FILE *, int));
+
+extern void
+perror_with_name PARAMS ((char *));
+
+extern void
+print_sys_errmsg PARAMS ((char *, int));
+
+/* From regex.c */
+
+extern char *
+re_comp PARAMS ((char *));
+
+/* From symfile.c */
+
+extern void
+symbol_file_command PARAMS ((char *, int));
+
+/* From main.c */
+
+extern char *
+gdb_readline PARAMS ((char *));
+
+extern char *
+command_line_input PARAMS ((char *, int));
+
+extern void
+print_prompt PARAMS ((void));
+
+extern int
+batch_mode PARAMS ((void));
+
+extern int
+input_from_terminal_p PARAMS ((void));
+
+extern int
+catch_errors PARAMS ((int (*) (char *), char *, char *));
/* From printcmd.c */
-extern void print_address_symbolic ();
-extern void print_address ();
+
+extern void
+set_next_address PARAMS ((CORE_ADDR));
+
+extern void
+print_address_symbolic PARAMS ((CORE_ADDR, FILE *, int, char *));
+
+extern void
+print_address PARAMS ((CORE_ADDR, FILE *));
/* From source.c */
-void mod_path (
-#ifdef __STDC__
- char *, char **
-#endif
- );
+
+extern int
+openp PARAMS ((char *, int, char *, int, int, char **));
+
+extern void
+mod_path PARAMS ((char *, char **));
+
+extern void
+directory_command PARAMS ((char *, int));
+
+extern void
+init_source_path PARAMS ((void));
+
+/* From findvar.c */
+
+extern int
+read_relative_register_raw_bytes PARAMS ((int, char *));
/* From readline (but not in any readline .h files). */
-extern char *tilde_expand ();
+
+extern char *
+tilde_expand PARAMS ((char *));
/* Structure for saved commands lines
(for breakpoints, defined commands, etc). */
char *line;
};
-extern struct command_line *read_command_lines ();
-extern void free_command_lines ();
+extern struct command_line *
+read_command_lines PARAMS ((void));
+
+extern void
+free_command_lines PARAMS ((struct command_line **));
/* String containing the current directory (what getwd would return). */
-char *current_directory;
+extern char *current_directory;
/* Default radixes for input and output. Only some values supported. */
extern unsigned input_radix;
extern unsigned output_radix;
/* Baud rate specified for communication with serial target systems. */
-char *baud_rate;
+extern char *baud_rate;
/* Languages represented in the symbol table and elsewhere. */
options like "08" or "l" (to produce e.g. %08x or %lx). */
#define local_hex_format() (current_language->la_hex_format)
-char *local_hex_format_custom(); /* language.c */
+
+extern char *
+local_hex_format_custom PARAMS ((char *)); /* language.c */
/* Return a string that contains a number formatted in the local
(language-specific) hexadecimal format. Result is static and is
overwritten by the next call. local_hex_string_custom takes printf
options like "08" or "l". */
-char *local_hex_string (); /* language.c */
-char *local_hex_string_custom (); /* language.c */
+extern char *
+local_hex_string PARAMS ((int)); /* language.c */
+
+extern char *
+local_hex_string_custom PARAMS ((int, char *)); /* language.c */
+
\f
/* Host machine definition. This will be a symlink to one of the
xm-*.h files, built by the `configure' script. */
#endif /* STDC */
#endif /* volatile */
+/* Some compilers (many AT&T SVR4 compilers for instance), do not accept
+ declarations of functions that never return (exit for instance) as
+ "volatile void". For such compilers "NORETURN" can be defined away
+ to keep them happy */
+
+#ifndef NORETURN
+# define NORETURN volatile
+#endif
+
/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
#if !defined (UINT_MAX)
#define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT)
#endif
+/* Number of bits in a pointer for the target machine */
+#if !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT TARGET_INT_BIT
+#endif
+
/* Convert a LONGEST to an int. This is used in contexts (e.g. number
of arguments to a function, number in a value history, register
number, etc.) where the value must not be larger than can fit
#endif /* No LONG_LONG. */
#endif /* No longest_to_int. */
+/* This should not be a typedef, because "unsigned LONGEST" needs
+ to work. LONG_LONG is defined if the host has "long long". */
+
+#ifndef LONGEST
+# ifdef LONG_LONG
+# define LONGEST long long
+# else
+# define LONGEST long
+# endif
+#endif
+
/* Assorted functions we can declare, now that const and volatile are
defined. */
-extern char *savestring ();
-extern char *strsave ();
-extern char *concat ();
+
+extern char *
+savestring PARAMS ((const char *, int));
+
+extern char *
+strsave PARAMS ((const char *));
+
+extern char *
+concat PARAMS ((char *, ...));
+
+extern PTR
+xmalloc PARAMS ((long));
+
+extern PTR
+xrealloc PARAMS ((char *, long));
+
+extern int
+parse_escape PARAMS ((char **));
+
+extern char *reg_names[];
+
+extern NORETURN void /* Does not return to the caller. */
+error ();
+
+extern NORETURN void /* Does not return to the caller. */
+fatal ();
+
+extern NORETURN void /* Not specified as volatile in ... */
+exit PARAMS ((int)); /* 4.10.4.3 */
+
+extern NORETURN void /* Does not return to the caller. */
+return_to_top_level PARAMS ((void));
+
+extern void
+warning_setup PARAMS ((void));
+
+extern void
+warning ();
+
+/* Global functions from other, non-gdb GNU thingies (libiberty for
+ instance) */
+
+extern char *
+basename PARAMS ((char *));
+
+extern char *
+getenv PARAMS ((CONST char *));
+
+extern char **
+buildargv PARAMS ((char *));
+
+extern void
+freeargv PARAMS ((char **));
+
+/* For now, we can't include <stdlib.h> because it conflicts with
+ "../include/getopt.h". (FIXME)
+
+ However, since any prototypes for any functions defined in the ANSI
+ specific, defined in any header files in an ANSI conforming environment,
+ must match those in the ANSI standard, we can just duplicate them here
+ since they must be the same in all conforming ANSI environments. If
+ these cause problems, then the environment is not ANSI conformant. */
+
#ifdef __STDC__
-extern void *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
+#include <stddef.h>
#endif
-extern void free ();
-extern int parse_escape ();
-extern char *reg_names[];
-/* Indicate that these routines do not return to the caller. */
-extern volatile void error(), fatal();
-extern void warning_setup(), warning();
+
+extern int
+fclose PARAMS ((FILE *stream)); /* 4.9.5.1 */
+
+extern double
+atof PARAMS ((const char *nptr)); /* 4.10.1.1 */
+
+#ifndef MALLOC_INCOMPATIBLE
+extern PTR
+malloc PARAMS ((size_t size)); /* 4.10.3.3 */
+
+extern PTR
+realloc PARAMS ((void *ptr, size_t size)); /* 4.10.3.4 */
+
+extern void
+free PARAMS ((void *)); /* 4.10.3.2 */
+#endif
+
+extern void
+qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */
+ size_t size,
+ int (*comp)(const void *, const void *)));
+
+extern char *
+strchr PARAMS ((const char *, int)); /* 4.11.5.2 */
+
+extern char *
+strrchr PARAMS ((const char *, int)); /* 4.11.5.5 */
+
+extern char *
+strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */
+
+extern char *
+strerror PARAMS ((int)); /* 4.11.6.2 */
/* Various possibilities for alloca. */
#ifndef alloca
#define SYS_SIGLIST_MISSING defined (USG)
#endif /* No SYS_SIGLIST_MISSING */
-#endif /* no DEFS_H */
+/* From valops.c */
+
+extern CORE_ADDR
+push_bytes PARAMS ((CORE_ADDR, char *, int));
+
+/* In some modules, we don't have a definition of REGISTER_TYPE yet, so we
+ must avoid prototyping this function for now. FIXME. Should be:
+extern CORE_ADDR
+push_word PARAMS ((CORE_ADDR, REGISTER_TYPE));
+ */
+extern CORE_ADDR
+push_word ();
+
+#endif /* !defined (DEFS_H) */
*/
-#include <stdio.h>
+#include "defs.h"
#include <varargs.h>
#include <fcntl.h>
-#include "defs.h"
#include "bfd.h"
#include "symtab.h"
#include "gdbtypes.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "bfd.h"
#define LANGUAGE_C /* Wierd MIPS crap */
* *
************************************************************************/
-#include <stdio.h>
-
#include "defs.h"
#include "elf/common.h"
#include "elf/external.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include <string.h>
#include "bfd.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "frame.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
sac@cygnus.com
*/
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "obstack.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
* the Intel manual for details.
*/
-#include <stdio.h>
+#include "defs.h"
+
#include <ctype.h>
/* For the GDB interface at the bottom of the file... */
-#include "defs.h"
#include "gdbcore.h"
#define Eb OP_E, b_mode
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "gdbcore.h"
+#ifdef USE_PROC_FS /* Target dependent support for /proc */
+#include <sys/procfs.h>
+#endif
+
+static long
+i386_get_frame_setup PARAMS ((int));
+
+static void
+i386_follow_jump PARAMS ((void));
+
+static void
+codestream_read PARAMS ((unsigned char *, int));
+
+static void
+codestream_seek PARAMS ((int));
+
+static unsigned char
+codestream_fill PARAMS ((int));
+
/* helper functions for tm-i386.h */
-/* stdio style buffering to minimize calls to ptrace */
+/* Stdio style buffering was used to minimize calls to ptrace, but this
+ buffering did not take into account that the code section being accessed
+ may not be an even number of buffers long (even if the buffer is only
+ sizeof(int) long). In cases where the code section size happened to
+ be a non-integral number of buffers long, attempting to read the last
+ buffer would fail. Simply using target_read_memory and ignoring errors,
+ rather than read_memory, is not the correct solution, since legitimate
+ access errors would then be totally ignored. To properly handle this
+ situation and continue to use buffering would require that this code
+ be able to determine the minimum code section size granularity (not the
+ alignment of the section itself, since the actual failing case that
+ pointed out this problem had a section alignment of 4 but was not a
+ multiple of 4 bytes long), on a target by target basis, and then
+ adjust it's buffer size accordingly. This is messy, but potentially
+ feasible. It probably needs the bfd library's help and support. For
+ now, the buffer size is set to 1. (FIXME -fnf) */
+
+#define CODESTREAM_BUFSIZ 1 /* Was sizeof(int), see note above. */
static CORE_ADDR codestream_next_addr;
static CORE_ADDR codestream_addr;
-static unsigned char codestream_buf[sizeof (int)];
+static unsigned char codestream_buf[CODESTREAM_BUFSIZ];
static int codestream_off;
static int codestream_cnt;
static unsigned char
codestream_fill (peek_flag)
+ int peek_flag;
{
codestream_addr = codestream_next_addr;
- codestream_next_addr += sizeof (int);
+ codestream_next_addr += CODESTREAM_BUFSIZ;
codestream_off = 0;
- codestream_cnt = sizeof (int);
+ codestream_cnt = CODESTREAM_BUFSIZ;
read_memory (codestream_addr,
(unsigned char *)codestream_buf,
- sizeof (int));
+ CODESTREAM_BUFSIZ);
if (peek_flag)
return (codestream_peek());
static void
codestream_seek (place)
+ int place;
{
- codestream_next_addr = place & -sizeof (int);
+ codestream_next_addr = place / CODESTREAM_BUFSIZ;
+ codestream_next_addr *= CODESTREAM_BUFSIZ;
codestream_cnt = 0;
codestream_fill (1);
while (codestream_tell() != place)
static void
codestream_read (buf, count)
unsigned char *buf;
+ int count;
{
unsigned char *p;
int i;
}
/* next instruction is a jump, move to target */
-static
+
+static void
i386_follow_jump ()
{
int long_delta;
* if entry sequence doesn't make sense, return -1, and leave
* codestream pointer random
*/
+
static long
i386_get_frame_setup (pc)
+ int pc;
{
unsigned char op;
int
i386_frame_num_args (fi)
- struct frame_info fi;
+ struct frame_info *fi;
{
int retpc;
unsigned char op;
nameless arguments. */
return -1;
- pfi = get_prev_frame_info ((fi));
+ pfi = get_prev_frame_info (fi);
if (pfi == 0)
{
/* Note: this can happen if we are looking at the frame for
* next instruction will be a branch back to the start.
*/
+void
i386_frame_find_saved_regs (fip, fsrp)
struct frame_info *fip;
struct frame_saved_regs *fsrp;
}
/* return pc of first real instruction */
+
+int
i386_skip_prologue (pc)
+ int pc;
{
unsigned char op;
int i;
return (codestream_tell ());
}
+void
i386_push_dummy_frame ()
{
CORE_ADDR sp = read_register (SP_REGNUM);
write_register (SP_REGNUM, sp);
}
+void
i386_pop_frame ()
{
FRAME frame = get_current_frame ();
set_current_frame ( create_new_frame (read_register (FP_REGNUM),
read_pc ()));
}
+
+#ifdef USE_PROC_FS /* Target dependent support for /proc */
+
+/* The /proc interface divides the target machine's register set up into
+ two different sets, the general register set (gregset) and the floating
+ point register set (fpregset). For each set, there is an ioctl to get
+ the current register set and another ioctl to set the current values.
+
+ The actual structure passed through the ioctl interface is, of course,
+ naturally machine dependent, and is different for each set of registers.
+ For the i386 for example, the general register set is typically defined
+ by:
+
+ typedef int gregset_t[19]; (in <sys/regset.h>)
+
+ #define GS 0 (in <sys/reg.h>)
+ #define FS 1
+ ...
+ #define UESP 17
+ #define SS 18
+
+ and the floating point set by:
+
+ typedef struct fpregset
+ {
+ union
+ {
+ struct fpchip_state // fp extension state //
+ {
+ int state[27]; // 287/387 saved state //
+ int status; // status word saved at exception //
+ } fpchip_state;
+ struct fp_emul_space // for emulators //
+ {
+ char fp_emul[246];
+ char fp_epad[2];
+ } fp_emul_space;
+ int f_fpregs[62]; // union of the above //
+ } fp_reg_set;
+ long f_wregs[33]; // saved weitek state //
+ } fpregset_t;
+
+ These routines provide the packing and unpacking of gregset_t and
+ fpregset_t formatted data.
+
+ */
+
+/* This is a duplicate of the table in i386-xdep.c. */
+
+static int regmap[] =
+{
+ EAX, ECX, EDX, EBX,
+ UESP, EBP, ESI, EDI,
+ EIP, EFL, CS, SS,
+ DS, ES, FS, GS,
+};
+
+
+/* Given a pointer to a general register set in /proc format (gregset_t *),
+ unpack the register contents and supply them as gdb's idea of the current
+ register values. */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ register int regno;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern int regmap[];
+
+ for (regno = 0 ; regno < NUM_REGS ; regno++)
+ {
+ supply_register (regno, (char *) (regp + regmap[regno]));
+ }
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern char registers[];
+ extern int regmap[];
+
+ for (regi = 0 ; regi < NUM_REGS ; regi++)
+ {
+ if ((regno == -1) || (regno == regi))
+ {
+ *(regp + regmap[regno]) = *(int *) ®isters[REGISTER_BYTE (regi)];
+ }
+ }
+}
+
+#if defined (FP0_REGNUM)
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), unpack the register contents and supply them as gdb's
+ idea of the current floating point register values. */
+
+void
+supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+{
+ register int regno;
+
+ /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+}
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), update the register specified by REGNO from gdb's idea
+ of the current floating point register set. If REGNO is -1, update
+ them all. */
+
+void
+fill_fpregset (fpregsetp, regno)
+ fpregset_t *fpregsetp;
+ int regno;
+{
+ int regi;
+ char *to;
+ char *from;
+ extern char registers[];
+
+ /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+}
+
+#endif /* defined (FP0_REGNUM) */
+
+#endif /* USE_PROC_FS */
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
anyone else from sharing it farther. Help stamp out software hoarding!
*/
-#include <stdio.h>
-
#include "defs.h"
#include "tm-i860.h"
#include "i860-opcode.h"
In other words, go ahead and share GDB, but don't try to stop
anyone else from sharing it farther. Help stamp out software hoarding!
*/
-#include <stdio.h>
+#include "defs.h"
#include <stdlib.h>
#include <stdarg.h>
-#include "defs.h"
#include "tm-i860.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
/* Miscellaneous i80960-dependent routines.
Most are called from macros defined in "tm-i960.h". */
-#include <stdio.h>
-#include <signal.h>
#include "defs.h"
+#include <signal.h>
#include "symtab.h"
#include "value.h"
#include "frame.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "ieee-float.h"
#include <math.h> /* ldexp */
don't worry about this; it will make calls look like simple
jumps (and the stack frames will be printed when the frame
pointer moves), which is a reasonably non-violent response.
-
-#if 0
- We skip this; it causes more problems than it's worth.
-#ifdef SUN4_COMPILER_FEATURE
- We do a special ifdef for the sun 4, forcing it to single step
- into calls which don't have prologues. This means that we can't
- nexti over leaf nodes, we can probably next over them (since they
- won't have debugging symbols, usually), and we can next out of
- functions returning structures (with a "call .stret4" at the end).
-#endif
-#endif
*/
-
-
-
-
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
#define GET_LONGJMP_TARGET(PC_ADDR) 0
#endif
+
+/* Some machines have trampoline code that sits between function callers
+ and the actual functions themselves. If this machine doesn't have
+ such things, disable their processing. */
+#ifndef SKIP_TRAMPOLINE_CODE
+#define SKIP_TRAMPOLINE_CODE(pc) 0
+#endif
+
+
+#ifdef TDESC
+#include "tdesc.h"
+int safe_to_init_tdesc_context = 0;
+extern dc_dcontext_t current_context;
+#endif
+
/* Tables of how to react to signals; the user sets them. */
static char signal_stop[NSIG];
normal_stop ();
}
-#if 0
-/* This might be useful (not sure), but isn't currently used. See also
- write_pc(). */
-/* Writing the inferior pc as a register calls this function
- to inform infrun that the pc has been set in the debugger. */
-
-void
-writing_pc (val)
- CORE_ADDR val;
-{
- stop_pc = val;
- pc_changed = 1;
-}
-#endif
-
/* Record the pc and sp of the program the last time it stopped.
These are just used internally by wait_for_inferior, but need
to be preserved over calls to it and cleared when the inferior
CORE_ADDR stop_sp;
CORE_ADDR stop_func_start;
char *stop_func_name;
- CORE_ADDR prologue_pc;
+ CORE_ADDR prologue_pc, tmp;
int stop_step_resume_break;
struct symtab_and_line sal;
int remove_breakpoints_on_following_step = 0;
/* End of a stack dummy. Some systems (e.g. Sony
news) give another signal besides SIGTRAP,
so check here as well as above. */
- || (stop_sp INNER_THAN stop_pc
- && stop_pc INNER_THAN stop_frame_address)
+ || PC_IN_CALL_DUMMY (stop_pc, stop_sp, stop_frame_address)
);
if (!random_signal)
stop_signal = SIGTRAP;
&& (stop_sp INNER_THAN prev_sp
|| stop_frame_address != step_frame_address)))
{
-#if 0
- /* When "next"ing through a function,
- This causes an extra stop at the end.
- Is there any reason for this?
- It's confusing to the user. */
- /* Don't step through the return from a function
- unless that is the first instruction stepped through. */
- if (ABOUT_TO_RETURN (stop_pc))
- {
- stop_step = 1;
- break;
- }
-#endif
+ ;
}
/* We stepped out of the stepping range. See if that was due
if (step_range_end == 1)
step_range_end = (step_range_start = prev_pc) + 1;
remove_breakpoints_on_following_step = 1;
+ goto save_pc;
}
/* ==> See comments at top of file on this algorithm. <==*/
- else if (stop_pc == stop_func_start
+ if (stop_pc == stop_func_start
&& (stop_func_start != prev_func_start
|| prologue_pc != stop_func_start
|| stop_sp != prev_sp))
{
- /* It's a subroutine call */
- if (step_over_calls > 0
- || (step_over_calls && find_pc_function (stop_pc) == 0))
+ /* It's a subroutine call.
+ (0) If we are not stepping over any calls ("stepi"), we
+ just stop.
+ (1) If we're doing a "next", we want to continue through
+ the call ("step over the call").
+ (2) If we are in a function-call trampoline (a stub between
+ the calling routine and the real function), locate
+ the real function and change stop_func_start.
+ (3) If we're doing a "step", and there are no debug symbols
+ at the target of the call, we want to continue through
+ it ("step over the call").
+ (4) Otherwise, we want to stop soon, after the function
+ prologue ("step into the call"). */
+
+ if (step_over_calls == 0)
{
- /* A subroutine call has happened. */
- /* Set a special breakpoint after the return */
+ /* I presume that step_over_calls is only 0 when we're
+ supposed to be stepping at the assembly language level. */
+ stop_step = 1;
+ break;
+ }
- step_resume_break_address =
- ADDR_BITS_REMOVE (
- SAVED_PC_AFTER_CALL (
- get_current_frame ()));
+ if (step_over_calls > 0)
+ goto step_over_function;
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- }
+ tmp = SKIP_TRAMPOLINE_CODE (stop_pc);
+ if (tmp != NULL)
+ stop_func_start = tmp;
+
+ if (find_pc_function (stop_func_start) != 0)
+ goto step_into_function;
+
+step_over_function:
+ /* A subroutine call has happened. */
+ /* Set a special breakpoint after the return */
+ step_resume_break_address =
+ ADDR_BITS_REMOVE
+ (SAVED_PC_AFTER_CALL (get_current_frame ()));
+ step_resume_break_duplicate
+ = breakpoint_here_p (step_resume_break_address);
+ if (breakpoints_inserted)
+ insert_step_breakpoint ();
+ goto save_pc;
+
+step_into_function:
/* Subroutine call with source code we should not step over.
Do step to the first line of code in it. */
- else if (step_over_calls)
- {
- SKIP_PROLOGUE (stop_func_start);
- sal = find_pc_line (stop_func_start, 0);
- /* Use the step_resume_break to step until
- the end of the prologue, even if that involves jumps
- (as it seems to on the vax under 4.2). */
- /* If the prologue ends in the middle of a source line,
- continue to the end of that source line.
- Otherwise, just go to end of prologue. */
+ SKIP_PROLOGUE (stop_func_start);
+ sal = find_pc_line (stop_func_start, 0);
+ /* Use the step_resume_break to step until
+ the end of the prologue, even if that involves jumps
+ (as it seems to on the vax under 4.2). */
+ /* If the prologue ends in the middle of a source line,
+ continue to the end of that source line.
+ Otherwise, just go to end of prologue. */
#ifdef PROLOGUE_FIRSTLINE_OVERLAP
- /* no, don't either. It skips any code that's
- legitimately on the first line. */
+ /* no, don't either. It skips any code that's
+ legitimately on the first line. */
#else
- if (sal.end && sal.pc != stop_func_start)
- stop_func_start = sal.end;
+ if (sal.end && sal.pc != stop_func_start)
+ stop_func_start = sal.end;
#endif
-
- if (stop_func_start == stop_pc)
- {
- /* We are already there: stop now. */
- stop_step = 1;
- break;
- }
- else
- /* Put the step-breakpoint there and go until there. */
- {
- step_resume_break_address = stop_func_start;
-
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- /* Do not specify what the fp should be when we stop
- since on some machines the prologue
- is where the new fp value is established. */
- step_frame_address = 0;
- /* And make sure stepping stops right away then. */
- step_range_end = step_range_start;
- }
- }
- else
- {
- /* We get here only if step_over_calls is 0 and we
- just stepped into a subroutine. I presume
- that step_over_calls is only 0 when we're
- supposed to be stepping at the assembly
- language level.*/
- stop_step = 1;
- break;
- }
- }
- /* No subroutine call; stop now. */
- else
- {
- /* We've wandered out of the step range (but we haven't done a
- subroutine call or return (that's handled elsewhere)). We
- don't really want to stop until we encounter the start of a
- new statement. If so, we stop. Otherwise, we reset
- step_range_start and step_range_end, and just continue. */
- sal = find_pc_line(stop_pc, 0);
-
- if (step_range_end == 1 /* Don't do this for stepi/nexti */
- || sal.line == 0 /* Stop now if no line # info */
- || (current_line != sal.line
- && stop_pc == sal.pc))
+
+ if (stop_func_start == stop_pc)
{
+ /* We are already there: stop now. */
stop_step = 1;
break;
- }
- else if (sal.line != 0)
+ }
+ else
+ /* Put the step-breakpoint there and go until there. */
{
- /* This is probably not necessary, but it probably makes
- stepping more efficient, as we avoid calling
- find_pc_line() for each instruction we step over. */
- step_range_start = sal.pc;
- step_range_end = sal.end;
+ step_resume_break_address = stop_func_start;
+
+ step_resume_break_duplicate
+ = breakpoint_here_p (step_resume_break_address);
+ if (breakpoints_inserted)
+ insert_step_breakpoint ();
+ /* Do not specify what the fp should be when we stop
+ since on some machines the prologue
+ is where the new fp value is established. */
+ step_frame_address = 0;
+ /* And make sure stepping stops right away then. */
+ step_range_end = step_range_start;
}
+ goto save_pc;
}
+
+ /* We've wandered out of the step range (but haven't done a
+ subroutine call or return). */
+
+ sal = find_pc_line(stop_pc, 0);
+
+ if (step_range_end == 1 || /* stepi or nexti */
+ sal.line == 0 || /* ...or no line # info */
+ (stop_pc == sal.pc /* ...or we're at the start */
+ && current_line != sal.line)) { /* of a different line */
+ /* Stop because we're done stepping. */
+ stop_step = 1;
+ break;
+ } else {
+ /* We aren't done stepping, and we have line number info for $pc.
+ Optimize by setting the step_range for the line.
+ (We might not be in the original line, but if we entered a
+ new line in mid-statement, we continue stepping. This makes
+ things like for(;;) statements work better.) */
+ step_range_start = sal.pc;
+ step_range_end = sal.end;
+ goto save_pc;
+ }
+ abort(); /* We never fall through here */
}
- else if (trap_expected
- && IN_SIGTRAMP (stop_pc, stop_func_name)
- && !IN_SIGTRAMP (prev_pc, prev_func_name))
+ if (trap_expected
+ && IN_SIGTRAMP (stop_pc, stop_func_name)
+ && !IN_SIGTRAMP (prev_pc, prev_func_name))
{
/* What has happened here is that we have just stepped the inferior
with a signal (because it is a signal which shouldn't make
keep_going:
+save_pc:
/* Save the pc before execution, to compare with pc after stop. */
prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
prev_func_start = stop_func_start; /* Ok, since if DECR_PC_AFTER
FRAME_FP (fid) != inf_status->selected_frame_address ||
level != 0)
{
-#if 0
+#if 1
/* I'm not sure this error message is a good idea. I have
only seen it occur after "Can't continue previously
requested operation" (we get called from do_cleanups), in
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
return data out of a "language-specific" struct pointer that is set
whenever the working language changes. That would be a lot faster. */
-#include <stdio.h>
+#include "defs.h"
#include <string.h>
#include <varargs.h>
-#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/m68k.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-#include "opcode/m88k.h"
#include "defs.h"
+#include "opcode/m88k.h"
#include "symtab.h"
void sprint_address ();
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
to figure out what full symbol table entries need to be read in. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/mips.h"
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
for (ireg = 31; mask; --ireg, mask <<= 1)
if (mask & 0x80000000)
{
- fci->saved_regs->regs[32+ireg] = reg_position;
+ fci->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
reg_position -= 4;
}
}
read_relative_register_raw_bytes (regnum, raw_buffer);
- if (!(regnum & 1) && regnum >= FP0_REGNUM && regnum < FP0_REGNUM+32) {
+ /* If an even floating pointer register, also print as double. */
+ if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM+32
+ && !((regnum-FP0_REGNUM) & 1)) {
read_relative_register_raw_bytes (regnum+1, raw_buffer+4);
- printf_filtered ("(d%d: ", regnum&31);
+ printf_filtered ("(d%d: ", regnum-FP0_REGNUM);
val_print (builtin_type_double, raw_buffer, 0,
stdout, 0, 1, 0, Val_pretty_default);
- printf_filtered ("); ", regnum&31);
+ printf_filtered ("); ");
}
fputs_filtered (reg_names[regnum], stdout);
#ifndef NUMERIC_REG_NAMES
struct symbol *f;
struct block *b;
unsigned long inst;
+ int offset;
/* For -g modules and most functions anyways the
- first instruction adjusts the stack. */
- inst = read_memory_integer(pc, 4);
- if ((inst & 0xffff0000) == 0x27bd0000)
- return pc + 4;
+ first instruction adjusts the stack.
+ But we allow some number of stores before the stack adjustment.
+ (These are emitted by varags functions compiled by gcc-2.0. */
+ for (offset = 0; offset < 100; offset += 4) {
+ inst = read_memory_integer(pc + offset, 4);
+ if ((inst & 0xffff0000) == 0x27bd0000) /* addiu $sp,$sp,offset */
+ return pc + offset + 4;
+ if ((inst & 0xFFE00000) != 0xAFA00000) /* sw reg,n($sp) */
+ break;
+ }
/* Well, it looks like a frameless. Let's make sure.
Note that we are not called on the current PC,
return pc;
}
+
+/* Figure out where the longjmp will land.
+ We expect the first arg to be a pointer to the jmp_buf structure from which
+ we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
+ This routine returns true on success. */
+
+int
+get_longjmp_target(pc)
+ CORE_ADDR *pc;
+{
+ CORE_ADDR jb_addr;
+
+ jb_addr = read_register(A0_REGNUM);
+
+ if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, pc,
+ sizeof(CORE_ADDR)))
+ return 0;
+
+ SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR));
+
+ return 1;
+}
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
+#include "defs.h"
#ifdef sgi
#include <sys/inst.h>
#else
#include <mips/inst.h>
#endif
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
/* Read a symbol table in MIPS' format (Third-Eye).
- Copyright 1986, 1987, 1989, 1990, 1991 Free Software Foundation, Inc.
- Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU.
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major
+ work by Per Bothner and John Gilmore at Cygnus Support.
This file is part of GDB.
file, the corresponding partial symbol table is mutated into a full
fledged symbol table by going back and reading the symbols
for real. mipscoff_psymtab_to_symtab() is called indirectly through
- a pointer in the psymtab to do this. */
-
-#include <stdio.h>
+ a pointer in the psymtab to do this.
+
+ ECOFF symbol tables are mostly written in the byte order of the
+ target machine. However, one section of the table (the auxiliary
+ symbol information) is written in the host byte order. There is a
+ bit in the other symbol info which describes which host byte order
+ was used. ECOFF thereby takes the trophy from Intel `b.out' for
+ the most brain-dead adaptation of a file format to byte order.
+
+ This module can read all four of the known byte-order combinations,
+ on any type of host. However, it does make (and check) the assumption
+ that the external form of a symbol table structure (on disk)
+ occupies the same number of bytes as the internal form (in a struct).
+ Fixing this is possible but requires larger structural changes. */
+
+#define TM_FILE_OVERRIDE
#include "defs.h"
+#include "tm-mips.h"
#include "symtab.h"
+#include "gdbtypes.h"
#include "gdbcore.h"
#include "symfile.h"
#include "obstack.h"
#ifdef CMUCS
#include <mips/syms.h>
#else /* not CMUCS */
-#include <symconst.h>
-#include <sym.h>
+#ifndef LANGUAGE_C
+#define LANGUAGE_C
+#endif
+#include "symconst.h"
+#include "sym.h"
#endif /* not CMUCS */
#include "coff/mips.h"
#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
#include "aout/aout64.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */
+#include "coff/ecoff-ext.h"
struct coff_exec {
struct external_filehdr f;
struct complaint array_bitsize_complaint =
{"size of array target type not known, assuming %d bits", 0, 0};
-struct complaint array_parse_complaint =
- {"array type with strange relative symbol", 0, 0};
-
struct complaint bad_tag_guess_complaint =
{"guessed tag type incorrectly", 0, 0};
/* Forward declarations */
+static void
+fixup_symtab ();
+
+static void
+read_mips_symtab ();
+
+static int
+upgrade_type ();
+
+static void
+parse_partial_symbols();
+
+static int
+cross_ref();
+
+static void
+fixup_sigtramp();
+
static struct symbol *new_symbol();
static struct type *new_type();
static struct block *new_block();
install_minimal_symbols (sf -> objfile);
}
-/* Exported procedure: Allocate zeroed memory */
+/* Allocate zeroed memory */
-char *
+static char *
xzalloc(size)
{
char *p = xmalloc(size);
{
int stsize, st_hdrsize;
unsigned st_filptr;
+ struct hdr_ext hdr_ext;
HDRR st_hdr;
/* Header for executable/object file we read symbols from */
struct coff_exec filhdr;
/* We get here with DESC pointing to the symtab header. But we need
* other info from the initial headers */
lseek(fsym, 0L, 0);
- myread(fsym, &filhdr, sizeof filhdr);
+ myread(fsym, (char *)&filhdr, sizeof filhdr);
if (end_of_text_segp)
*end_of_text_segp =
return 0;
lseek(fsym, st_filptr, L_SET);
- if (st_hdrsize > sizeof (st_hdr)) /* Profanity check */
- abort();
- if (read(fsym, &st_hdr, st_hdrsize) != st_hdrsize)
+ if (st_hdrsize != sizeof (hdr_ext)) { /* Profanity check */
+ error ("Wrong header size: %d, not %d", st_hdrsize,
+ sizeof (hdr_ext));
+ }
+ if (read(fsym, &hdr_ext, st_hdrsize) != st_hdrsize)
goto readerr;
+ ecoff_swap_hdr_in (abfd, &hdr_ext, &st_hdr);
/* Find out how large the symbol table is */
stsize = (st_hdr.cbExtOffset - (st_filptr + st_hdrsize))
/* Allocate space for the symbol table. Read it in. */
cur_hdr = (HDRR *) xmalloc(stsize + st_hdrsize);
- memcpy(cur_hdr, &st_hdr, st_hdrsize);
+ memcpy(cur_hdr, &hdr_ext, st_hdrsize);
if (read(fsym, (char *) cur_hdr + st_hdrsize, stsize) != stsize)
goto readerr;
/* Fixup file_pointers in it */
fixup_symtab(cur_hdr, (char *) cur_hdr + st_hdrsize,
- st_filptr + st_hdrsize);
+ st_filptr + st_hdrsize, abfd);
return;
readerr:
/* Turn all file-relative pointers in the symtab described by HDR
into memory pointers, given that the symtab itself is located
- at DATA in memory and F_PTR in the file. */
+ at DATA in memory and F_PTR in the file.
-static
-fixup_symtab( hdr, data, f_ptr)
+ Byte-swap all the data structures, in place, while we are at it --
+ except AUX entries, which we leave in their original byte order.
+ They will be swapped as they are used instead. (FIXME: we ought to
+ do all the data structures that way.) */
+
+static void
+fixup_symtab (hdr, data, f_ptr, abfd)
HDRR *hdr;
char *data;
+ int f_ptr;
+ bfd *abfd;
{
int f_idx, s_idx;
FDR *fh;
SYMR *sh;
- OPTR *op;
PDR *pr;
EXTR *esh;
+ /* This function depends on the external and internal forms
+ of the MIPS symbol table taking identical space. Check this
+ assumption at compile-time. */
+ static check_hdr1[1 + sizeof (struct hdr_ext) - sizeof (HDRR)] = {0};
+ static check_hdr2[1 + sizeof (HDRR) - sizeof (struct hdr_ext)] = {0};
+ static check_fdr1[1 + sizeof (struct fdr_ext) - sizeof (FDR)] = {0};
+ static check_fdr2[1 + sizeof (FDR) - sizeof (struct fdr_ext)] = {0};
+ static check_pdr1[1 + sizeof (struct pdr_ext) - sizeof (PDR)] = {0};
+ static check_pdr2[1 + sizeof (PDR) - sizeof (struct pdr_ext)] = {0};
+ static check_sym1[1 + sizeof (struct sym_ext) - sizeof (SYMR)] = {0};
+ static check_sym2[1 + sizeof (SYMR) - sizeof (struct sym_ext)] = {0};
+ static check_ext1[1 + sizeof (struct ext_ext) - sizeof (EXTR)] = {0};
+ static check_ext2[1 + sizeof (EXTR) - sizeof (struct ext_ext)] = {0};
+
+ /* Swap in the header record. */
+ ecoff_swap_hdr_in (abfd, hdr, hdr);
+
/*
* These fields are useless (and empty) by now:
* hdr->cbDnOffset, hdr->cbOptOffset
#undef FIX
- /*
- * Fix all string pointers inside the symtab, and
- * the FDR records. Also fix other miscellany.
- */
+ /* Fix all string pointers inside the symtab, and
+ the FDR records. Also fix other miscellany. */
+
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) {
register unsigned code_offset;
/* Header itself, and strings */
fh = (FDR *) (hdr->cbFdOffset) + f_idx;
+
+ /* Swap in the FDR */
+ ecoff_swap_fdr_in (abfd, fh, fh);
+
fh->issBase += hdr->cbSsOffset;
if (fh->rss != -1)
fh->rss = (long)fh->rss + fh->issBase;
/* FIXME! Probably don't want to do this here! */
for (s_idx = 0; s_idx < fh->csym; s_idx++) {
sh = (SYMR*)fh->isymBase + s_idx;
+ ecoff_swap_sym_in (abfd, sh, sh);
+
sh->iss = (long) sh->iss + fh->issBase;
sh->reserved = 0;
}
/* Aux symbols */
if (fh->caux)
- fh->iauxBase = hdr->cbAuxOffset + fh->iauxBase * sizeof(AUXU);
+ fh->iauxBase = hdr->cbAuxOffset + fh->iauxBase * sizeof(union aux_ext);
/* Relative file descriptor table */
fh->rfdBase = hdr->cbRfdOffset + fh->rfdBase * sizeof(RFDT);
unsigned name, only_ext;
pr = (PDR*)(IPDFIRST(hdr,fh)) + s_idx;
+ ecoff_swap_pdr_in (abfd, pr, pr);
/* Simple rule to find files linked "-x" */
only_ext = fh->rss == -1;
}
}
- /* External symbols: fix string */
+ /* External symbols: swap in, and fix string */
for (s_idx = 0; s_idx < hdr->iextMax; s_idx++) {
esh = (EXTR*)(hdr->cbExtOffset) + s_idx;
+ ecoff_swap_ext_in (abfd, esh, esh);
esh->asym.iss = esh->asym.iss + hdr->cbSsExtOffset;
}
}
whether we are adding to the general symtab or not.
FIXME: INCREMENTAL is currently always zero, though it should not be. */
-static
+static void
read_mips_symtab (objfile, desc)
struct objfile *objfile;
int desc;
prefix = "";
}
- result = (char*)obstack_alloc (symbol_obstack,
+ result = (char*)obstack_alloc (¤t_objfile->symbol_obstack,
strlen(prefix) + strlen(tag_name) + 1);
sprintf(result, "%s%s", prefix, tag_name);
return result;
/* Parse a single symbol. Mostly just make up a GDB symbol for it.
For blocks, procedures and types we open a new lexical context.
This is basically just a big switch on the symbol's type.
+ Argument AX is the base pointer of aux symbols for this file (fh->iauxBase).
+ BIGEND says whether aux symbols are big-endian or little-endian.
Return count of SYMR's handled (normally one). */
static int
-parse_symbol(sh, ax)
+parse_symbol(sh, ax, bigend)
SYMR *sh;
- AUXU *ax;
+ union aux_ext *ax;
+ int bigend;
{
char *name;
struct symbol *s;
we mark it explicitly */
int pend = (sh->reserved == 1);
enum address_class class;
+ TIR tir;
switch (sh->st) {
sh->index == 0xfffff)
SYMBOL_TYPE(s) = builtin_type_int; /* undefined? */
else
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
/* Value of a data symbol is its memory address */
break;
} else
SYMBOL_CLASS(s) = LOC_ARG;
SYMBOL_VALUE(s) = sh->value;
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
add_symbol(s, top_stack->cur_block);
#if 0
/* FIXME: This has not been tested. See dbxread.c */
if (sh->sc == scUndefined || sh->sc == scNil)
t = builtin_type_int;
else
- t = parse_type(ax + sh->index, sh, 0);
+ t = parse_type(ax + sh->index + 1, 0, bigend);
b = top_stack->cur_block;
if (sh->st == stProc) {
struct blockvector *bv = BLOCKVECTOR(top_stack->cur_st);
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
/* If the type of the member is Nil (or Void)
assume the tag is an enumeration. */
- if (tsym->index == indexNil
- || ax[tsym->index].ti.bt == btNil
- || ax[tsym->index].ti.bt == btVoid)
+ if (tsym->index == indexNil)
type_code = TYPE_CODE_ENUM;
+ else {
+ ecoff_swap_tir_in (bigend,
+ &ax[tsym->index].a_ti,
+ &tir);
+ if (tir.bt == btNil || tir.bt == btVoid)
+ type_code = TYPE_CODE_ENUM;
+ }
nfields++;
if (tsym->value > max_value)
max_value = tsym->value;
+ tsym->index-1;
}
-
/* There is no guaranteed way to distinguish struct,
unions, and enums at this point. This is a bug in the
original design (that has been fixed with the
f->bitsize = 0;
enum_sym = (struct symbol *)
- obstack_alloc (&objfile->symbol_obstack,
+ obstack_alloc (¤t_objfile->symbol_obstack,
sizeof (struct symbol));
memset (enum_sym, 0, sizeof (struct symbol));
SYMBOL_NAME (enum_sym) = f->name;
f->name = (char*)sh->iss;
f->bitpos = sh->value;
f->bitsize = 0;
- f->type = parse_type(ax + sh->index, sh, &f->bitsize);
+ f->type = parse_type(ax + sh->index, &f->bitsize, bigend);
break;
case stTypedef: /* type definition */
SYMBOL_CLASS(s) = LOC_TYPEDEF;
SYMBOL_BLOCK_VALUE(s) = top_stack->cur_block;
add_symbol(s, top_stack->cur_block);
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
sh->value = (long) SYMBOL_TYPE(s);
break;
return count;
}
-/* Parse the type information provided in the AX entries for
- the symbol SH. Return the bitfield size in BS, in case. */
+/* Parse the type information provided in the raw AX entries for
+ the symbol SH. Return the bitfield size in BS, in case.
+ We must byte-swap the AX entries before we use them; BIGEND says whether
+ they are big-endian or little-endian (from fh->fBigendian). */
-static struct type *parse_type(ax, sh, bs)
- AUXU *ax;
- SYMR *sh;
+static struct type *parse_type(ax, bs, bigend)
+ union aux_ext *ax;
int *bs;
+ int bigend;
{
/* Null entries in this map are treated specially */
static struct type **map_bt[] =
&builtin_type_void, /* btVoid */
};
- TIR *t;
+ TIR t[1];
struct type *tp = 0;
char *fmt;
int i;
+ union aux_ext *tax;
int type_code;
- /* Procedures start off by one */
- if (sh->st == stProc || sh->st == stStaticProc)
- ax++;
-
- /* Undefined ? Should not happen */
- if (ax->rndx.rfd == 0xfff) {
- return builtin_type_void;
- }
-
- /* Use aux as a type information record, map its basic type */
- t = &ax->ti;
+ /* Use aux as a type information record, map its basic type. */
+ tax = ax;
+ ecoff_swap_tir_in (bigend, &tax->a_ti, t);
if (t->bt > (sizeof (map_bt)/sizeof (*map_bt))) {
complain (&basic_type_complaint, t->bt);
return builtin_type_int;
}
}
- /* Move on to next aux */
- ax++;
+ /* Skip over any further type qualifiers (FIXME). */
if (t->continued) {
/* This is the way it would work if the compiler worked */
- register TIR *t1 = t;
- while (t1->continued)
+ TIR t1[1];
+ do {
ax++;
+ ecoff_swap_tir_in (bigend, ax, t1);
+ } while (t1->continued);
}
+ /* Move on to next aux */
+ ax++;
+
if (t->fBitfield) {
- *bs = ax->width;
+ *bs = AUX_GET_WIDTH (bigend, ax);
ax++;
}
char name[256], *pn;
/* Try to cross reference this type */
- ax += cross_ref(ax, &tp, type_code, &pn);
+ ax += cross_ref(ax, &tp, type_code, &pn, bigend);
/* reading .o file ? */
if (UNSAFE_DATA_ADDR(tp))
tp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL);
2 * sizeof (struct field));
TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"),
¤t_objfile -> type_obstack);
- TYPE_FIELD_BITPOS (tp, 0) = ax->dnLow;
+ TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax);
ax++;
TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"),
¤t_objfile -> type_obstack);
- TYPE_FIELD_BITPOS (tp, 1) = ax->dnHigh;
+ TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax);
ax++;
}
than 6 the game will continue in the next aux */
#define PARSE_TQ(tq) \
- if (t->tq != tqNil) ax += upgrade_type(&tp, t->tq, ax, sh);
+ if (t->tq != tqNil) ax += upgrade_type(&tp, t->tq, ax, bigend);
again: PARSE_TQ(tq0);
PARSE_TQ(tq1);
#undef PARSE_TQ
if (t->continued) {
- t++;
+ tax++;
+ ecoff_swap_tir_in (bigend, &tax->a_ti, t);
goto again;
}
return tp;
/* Make up a complex type from a basic one. Type is passed by
reference in TPP and side-effected as necessary. The type
qualifier TQ says how to handle the aux symbols at AX for
- the symbol SX we are currently analyzing.
+ the symbol SX we are currently analyzing. BIGEND says whether
+ aux symbols are big-endian or little-endian.
Returns the number of aux symbols we parsed. */
static int
-upgrade_type(tpp, tq, ax, sh)
- struct type **tpp;
- AUXU *ax;
- SYMR *sh;
+upgrade_type(tpp, tq, ax, bigend)
+ struct type **tpp;
+ union aux_ext *ax;
+ int bigend;
{
- int off;
- struct type *t;
+ int off;
+ struct type *t;
/* Used in array processing */
int rf, id;
FDR *fh;
struct field *f;
- SYMR ss;
int lower, upper;
+ RNDXR rndx;
switch (tq) {
case tqPtr:
TYPE_TARGET_TYPE(t) = *tpp;
/* Determine and record the domain type (type of index) */
- id = ax->rndx.index;
- rf = ax->rndx.rfd;
+ ecoff_swap_rndx_in (bigend, ax, &rndx);
+ id = rndx.index;
+ rf = rndx.rfd;
if (rf == 0xfff) {
- rf = (++ax)->isym;
+ ax++;
+ rf = AUX_GET_ISYM (bigend, ax);
off++;
}
fh = get_rfd(cur_fd, rf);
/* FIXME - Memory leak! */
if (TYPE_NFIELDS(t))
TYPE_FIELDS(t) = (struct field*)
- xrealloc(TYPE_FIELDS(t),
+ xrealloc((char *) TYPE_FIELDS(t),
(TYPE_NFIELDS(t)+1) * sizeof(struct field));
else
TYPE_FIELDS(t) = (struct field*)
TYPE_NFIELDS(t)++;
memset(f, 0, sizeof(struct field));
- memset(&ss, 0, sizeof ss);
-/* XXX */ f->type = parse_type(fh->iauxBase + id * sizeof(AUXU),
- &ss, &f->bitsize);
+/* XXX */ f->type = parse_type(fh->iauxBase + id * sizeof(union aux_ext),
+ &f->bitsize, bigend);
- if (off == 0) {
- /*
- * This seems to be a pointer to the end of the Block defining
- * the type. Why it is here is magic for me, and I have no
- * good use for it anyways.
- */
- /* This used to occur because cross_ref returned
- the wrong result (ax pointed wrong). FIXME,
- delete this code in a while. -- gnu@cygnus jul91 */
- complain (&array_parse_complaint, 0);
- off++;
- id = (++ax)->rndx.index;
- if ((rf = ax->rndx.rfd) == 0xfff)
- rf = (++ax)->isym, off++;
- }
- lower = (++ax)->dnLow;
- upper = (++ax)->dnHigh;
- rf = (++ax)->width; /* bit size of array element */
+ ax++;
+ lower = AUX_GET_DNLOW (bigend, ax);
+ ax++;
+ upper = AUX_GET_DNHIGH (bigend, ax);
+ ax++;
+ rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
/* Check whether supplied array element bit size matches
the known size of the element type. If this complaint
parsing of the PDRs has already provided all the needed
information, we only parse them if SKIP_PROCEDURES is false,
and only if this causes no symbol duplication.
+ BIGEND says whether aux entries are big-endian or little-endian.
This routine clobbers top_stack->cur_block and ->cur_st. */
static
-parse_external(es, skip_procedures)
+parse_external(es, skip_procedures, bigend)
EXTR *es;
+ int skip_procedures;
+ int bigend;
{
- AUXU *ax;
+ union aux_ext *ax;
if (es->ifd != ifdNil) {
cur_fd = es->ifd;
cur_fdr = (FDR*)(cur_hdr->cbFdOffset) + cur_fd;
- ax = (AUXU*)cur_fdr->iauxBase;
+ ax = (union aux_ext *)cur_fdr->iauxBase;
} else {
cur_fdr = (FDR*)(cur_hdr->cbFdOffset);
ax = 0;
* Note that the case of a symbol with indexNil
* must be handled anyways by parse_symbol().
*/
- parse_symbol(&es->asym, ax);
+ parse_symbol(&es->asym, ax, bigend);
break;
default:
break;
END_OF_TEXT_SEG gives the address just after the text segment for
the symtab we are reading. */
-static
+static void
parse_partial_symbols(end_of_text_seg, objfile)
int end_of_text_seg;
struct objfile *objfile;
int dependencies_used, dependencies_allocated;
struct cleanup *old_chain;
- extern_tab = (EXTR**)obstack_alloc (psymbol_obstack,
+ extern_tab = (EXTR**)obstack_alloc (&objfile->psymbol_obstack,
sizeof(EXTR *) * hdr->iextMax);
includes_allocated = 30;
}
pst = start_psymtab_common (objfile, 0, (char*)fh->rss,
fh->cpd ? fh->adr : 0,
- global_psymbols.next,
- static_psymbols.next);
+ objfile->global_psymbols.next,
+ objfile->static_psymbols.next);
pst->read_symtab_private = (char *)
- obstack_alloc (psymbol_obstack, sizeof (struct symloc));
+ obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
save_pst = pst;
/* Make everything point to everything. */
(It is the second symbol because the first symbol is
the stFile used to signal the start of a file). */
if (fh->csym >= 2
- && strcmp(((SYMR *)fh->isymBase)[1].iss, stabs_symbol) == 0) {
+ && strcmp((char *)(((SYMR *)fh->isymBase)[1].iss),
+ stabs_symbol) == 0) {
for (cur_sdx = 2; cur_sdx < fh->csym; cur_sdx++) {
int type_code;
char *namestring;
if (!MIPS_IS_STAB(sh)) {
if (sh->st == stProc || sh->st == stStaticProc) {
long procaddr = sh->value;
- sh = (sh->index + (AUXU *)fh->iauxBase)->isym
+ sh = AUX_GET_ISYM (fh->fBigendian,
+ sh->index + (union aux_ext *)(fh->iauxBase))
+ (SYMR *) fh->isymBase - 1;
if (sh->st == stEnd) {
long high = procaddr + sh->value;
case stStaticProc: /* Function */
ADD_PSYMBOL_TO_LIST(name, strlen(name),
VAR_NAMESPACE, LOC_BLOCK,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
/* Skip over procedure to next one. */
- cur_sdx = (sh->index + (AUXU *)fh->iauxBase)->isym;
+ cur_sdx = AUX_GET_ISYM (fh->fBigendian,
+ sh->index + (union aux_ext *)fh->iauxBase);
procaddr = sh->value;
sh = cur_sdx + (SYMR *) fh->isymBase - 1;
if (sh->sc == scInfo) {
ADD_PSYMBOL_TO_LIST(name, strlen(name),
STRUCT_NAMESPACE, LOC_TYPEDEF,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
}
/* Skip over the block */
cur_sdx = sh->index;
/* Use this gdb symbol */
ADD_PSYMBOL_TO_LIST(name, strlen(name),
VAR_NAMESPACE, class,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
skip:
cur_sdx++; /* Go to next file symbol */
}
class = LOC_STATIC;
break;
}
- if (global_psymbols.next >=
- global_psymbols.list + global_psymbols.size)
- extend_psymbol_list (&global_psymbols, objfile);
- psym = global_psymbols.next++;
+ if (objfile->global_psymbols.next >=
+ objfile->global_psymbols.list + objfile->global_psymbols.size)
+ extend_psymbol_list (&objfile->global_psymbols, objfile);
+ psym = objfile->global_psymbols.next++;
SYMBOL_NAME (psym) = (char*)sh->iss;
SYMBOL_NAMESPACE (psym) = VAR_NAMESPACE;
SYMBOL_CLASS (psym) = class;
end_psymtab (save_pst, psymtab_include_list, includes_used,
-1, save_pst->texthigh,
- dependency_list, dependencies_used,
- global_psymbols.next, static_psymbols.next);
+ dependency_list, dependencies_used);
if (entry_point < save_pst->texthigh
&& entry_point >= save_pst->textlow) {
startup_file_start = save_pst->textlow;
}
pst->number_of_dependencies = fh->crfd - s_id0;
pst->dependencies = (struct partial_symtab **)
- obstack_alloc (psymbol_obstack,
+ obstack_alloc (&objfile->psymbol_obstack,
pst->number_of_dependencies *
sizeof (struct partial_symtab *));
for (s_idx = s_id0; s_idx < fh->crfd; s_idx++) {
/* See comment in parse_partial_symbols about the @stabs sentinel. */
have_stabs =
fh && fh->csym >= 2
- && strcmp(((SYMR *)fh->isymBase)[1].iss, stabs_symbol) == 0;
+ && strcmp((char *)(((SYMR *)fh->isymBase)[1].iss), stabs_symbol)
+ == 0;
if (!have_stabs) {
if (fh)
: fh[1].adr;
for (cur_sdx = 0; cur_sdx < fh->csym; ) {
sh = (SYMR *) (fh->isymBase) + cur_sdx;
- cur_sdx += parse_symbol(sh, fh->iauxBase);
+ cur_sdx += parse_symbol(sh, fh->iauxBase, fh->fBigendian);
}
/* Procedures next, note we need to look-ahead to
ext_ptr = PST_PRIVATE(pst)->extern_tab;
for (i = PST_PRIVATE(pst)->extern_count; --i >= 0; ext_ptr++)
- parse_external(*ext_ptr, 1);
+ parse_external(*ext_ptr, 1, fh->fBigendian);
/* If there are undefined, tell the user */
if (n_undef_symbols) {
/* Lookup the type at relative index RN. Return it in TPP
if found and in any event come up with its name PNAME.
- Return value says how many aux symbols we ate */
+ BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
+ Return value says how many aux symbols we ate. */
-static
-cross_ref(rn, tpp, type_code, pname)
- RNDXR *rn;
+static int
+cross_ref(ax, tpp, type_code, pname, bigend)
+ union aux_ext *ax;
struct type **tpp;
int type_code; /* Use to alloc new type if none is found. */
char **pname;
+ int bigend;
{
+ RNDXR rn[1];
unsigned rf;
+ int result = 1;
+
+ ecoff_swap_rndx_in (bigend, ax, rn);
/* Escape index means 'the next one' */
- if (rn->rfd == 0xfff)
- rf = *(unsigned *) (rn + 1);
- else
+ if (rn->rfd == 0xfff) {
+ result++;
+ rf = AUX_GET_ISYM (bigend, ax + 1);
+ } else {
rf = rn->rfd;
+ }
if (rf == -1) {
/* Ooops */
}
/* We used one auxent normally, two if we got a "next one" rf. */
- return (rn->rfd == 0xfff? 2: 1);
+ return result;
}
{
struct blockvector *bv = BLOCKVECTOR(s);
- bv = (struct blockvector *)xrealloc(bv, sizeof(struct blockvector) +
- BLOCKVECTOR_NBLOCKS(bv) * sizeof(bv->block));
+ bv = (struct blockvector *)xrealloc((char *) bv,
+ sizeof(struct blockvector) +
+ BLOCKVECTOR_NBLOCKS(bv)
+ * sizeof(bv->block));
if (bv != BLOCKVECTOR(s))
BLOCKVECTOR(s) = bv;
struct symtab *
new_symtab(name, maxsyms, maxlines, objfile)
char *name;
+ int maxsyms;
+ int maxlines;
+ struct objfile *objfile;
{
struct symtab *s = allocate_symtab (name, objfile);
char *name;
{
struct symbol *s = (struct symbol *)
- obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
+ obstack_alloc (¤t_objfile->symbol_obstack, sizeof (struct symbol));
memset (s, 0, sizeof (*s));
SYMBOL_NAME(s) = name;
t = alloc_type (current_objfile);
TYPE_NAME(t) = name;
- TYPE_CPLUS_SPECIFIC(t) = &cplus_struct_default;
+ TYPE_CPLUS_SPECIFIC(t) = (struct cplus_struct_type *)
+ &cplus_struct_default;
return t;
}
from MIPS does not do so, we make up that information ourselves.
If they fix the library (unlikely) this code will neutralize itself. */
-static
+static void
fixup_sigtramp()
{
struct symbol *s;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#if defined (HAVE_MMAP)
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#ifdef HAVE_MMAP
/* Miscellaneous NINDY-dependent routines.
Some replace macros normally defined in "tm.h". */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "frame.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "ns32k-opcode.h"
/* This file contains support routines for creating, manipulating, and
destroying objfile structures. */
-#include <stdio.h>
#include "defs.h"
#include "bfd.h" /* Binary File Description */
#include "symtab.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
during the process of parsing; the lower levels of the tree always
come first in the result. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
*/
-#include <stdio.h>
-
#include "defs.h"
#ifdef USE_PROC_FS /* Entire file goes away if not using /proc */
-#include <stdio.h>
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/pyr.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
o - I can't get 19200 baud rate to work.
7/91 o - Freeze mode tracing can be done on a 29050. */
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "inferior.h"
#include "wait.h"
#include "value.h"
has PC/NFS, so it can access the same executables that gdb can,
over the net in real time. */
-#include <stdio.h>
-#include <string.h>
-
#define TM_FILE_OVERRIDE
#include "defs.h"
+#include <string.h>
#include "tm-29k.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "wait.h"
You should get tagged at compile time if you need to make any
changes/additions. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "wait.h"
*
******************************************************************************/
-#include <stdio.h>
+#include "defs.h"
#include <signal.h>
#include <sys/types.h>
#include <setjmp.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
/* Memory-access and commands for inferior process, for GDB.
*/
+#include "defs.h"
#include <sys/errno.h>
#include <setjmp.h>
-#include <stdio.h>
-#include "defs.h"
#include "frame.h"
#include "value.h"
#include "inferior.h"
#include "symtab.h"
#include "symfile.h" /* for struct complaint */
-#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
kill req k
*/
-#include <stdio.h>
+#include "defs.h"
#include <string.h>
#include <fcntl.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
sg.c_cflag &= ~PARENB; /* No parity */
sg.c_cflag |= CS8; /* 8-bit path */
if (baudrate_set)
- sg.c_cflag = (sb.c_cflag & ~CBAUD) | b_rate;
+ sg.c_cflag = (sg.c_cflag & ~CBAUD) | b_rate;
#else
sg.sg_flags |= RAW | ANYP;
sg.sg_flags &= ~ECHO;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "rs6k-opcode.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-#include <signal.h>
/* GDB-specific, FIXME. (This is for the SYS_SIGLIST_MISSING define). */
#include "defs.h"
+#include <signal.h>
#include "signame.h"
static void
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/sparc.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
/* This code only compiles when we have the definitions in tm-sparc.h. */
#define TM_FILE_OVERRIDE
*/
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
#if defined (GDB_TARGET_IS_SUN386)
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
/* many 387-specific items of use taken from i386-dep.c */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
merged back in. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "opcode/tahoe.h"
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define DEBUG
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
+#include "defs.h"
+
#include <sys/ioctl.h>
#include <sys/param.h>
#include <pwd.h>
#include <ctype.h>
#include <string.h>
-#include "defs.h"
#include "signals.h"
#include "gdbcmd.h"
#include "terminal.h"
char *ptr;
long size;
{
- register char *val = (char *) realloc (ptr, size);
+ register char *val =
+ ptr ? (char *) realloc (ptr, size) : (char*) malloc (size);
if (!val)
fatal ("virtual memory exhausted.", 0);
return val;
{
if (spaces)
free (spaces);
- spaces = malloc (n+1);
+ spaces = (char *) malloc (n+1);
for (t = spaces+n; t != spaces;)
*--t = ' ';
spaces[n] = '\0';
"Set number of characters gdb thinks are in a line.",
&setlist);
add_show_from_set (c, &showlist);
- c->function = set_width_command;
+ c->function.sfunc = set_width_command;
add_show_from_set
(add_set_cmd ("height", class_support,
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/vax.h"
/* xcoff-exec - deal with executing XCOFF files. */
-#include <stdio.h>
+#include "defs.h"
+
#include <sys/types.h>
#include <sys/param.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ldr.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "bfd.h"