aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-02-21 03:35:37 +0000
committerJohn Gilmore <gnu@cygnus>1992-02-21 03:35:37 +0000
commit7919c3ed86bcf8aa2fafe4284ec6d0453e5d993e (patch)
tree50ee9fb4fd3b30fb6b0a041774a8e593afc01442
parent573da2f371655db279fe819e0ef555d203b4a9d8 (diff)
downloadgdb-7919c3ed86bcf8aa2fafe4284ec6d0453e5d993e.zip
gdb-7919c3ed86bcf8aa2fafe4284ec6d0453e5d993e.tar.gz
gdb-7919c3ed86bcf8aa2fafe4284ec6d0453e5d993e.tar.bz2
* tm-sparc.h, tm-sysv4.h, solib.h: Move shared lib definitions
into solib.h. * sparc-pinsn.c, sparc-tdep.c, standalonec, sun3-xdep.c, sun386-xdep.c, symm-xdep.c, target.c, ultra3-xdep.c, utils.c, value.h: Prototypes for static functions; lint. * gdbtypes.h: Empty file to ease transition.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/gdbtypes.h0
-rw-r--r--gdb/solib.h57
-rw-r--r--gdb/sparc-pinsn.c2
-rw-r--r--gdb/standalone.c2
-rw-r--r--gdb/sun3-xdep.c15
-rw-r--r--gdb/sun386-xdep.c13
-rw-r--r--gdb/symm-xdep.c12
-rw-r--r--gdb/target.c56
-rw-r--r--gdb/tm-sysv4.h22
-rw-r--r--gdb/ultra3-xdep.c8
-rw-r--r--gdb/utils.c78
-rw-r--r--gdb/valops.c8
13 files changed, 192 insertions, 90 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 059ae53..536e271 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+Thu Feb 20 18:10:17 1992 Fred Fish (fnf at cygnus.com)
+
+ * tm-sparc.h, tm-sysv4.h, solib.h: Move shared lib definitions
+ into solib.h.
+ * sparc-pinsn.c, sparc-tdep.c, standalonec, sun3-xdep.c,
+ sun386-xdep.c, symm-xdep.c, target.c, ultra3-xdep.c, utils.c,
+ value.h: Prototypes for static functions; lint.
+ * gdbtypes.h: Empty file to ease transition.
+
Thu Feb 20 16:43:13 1992 Fred Fish (fnf at cygnus.com)
* environ.h, expression.h, frame.h, gdbcmd.h, gdbcore.h,
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gdb/gdbtypes.h
diff --git a/gdb/solib.h b/gdb/solib.h
new file mode 100644
index 0000000..b0c6afc
--- /dev/null
+++ b/gdb/solib.h
@@ -0,0 +1,57 @@
+/* Shared library declarations for GDB, the GNU Debugger.
+ Copyright (C) 1992 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. */
+
+#ifdef __STDC__ /* Forward decl's for prototypes */
+struct target_ops;
+#endif
+
+/* Called when we free all symtabs, to free the shared library information
+ as well. */
+
+#define CLEAR_SOLIB clear_solib
+
+extern void
+clear_solib PARAMS ((void));
+
+/* Called to add symbols from a shared library to gdb's symbol table. */
+
+#define SOLIB_ADD(filename, from_tty, targ) \
+ solib_add (filename, from_tty, targ)
+
+extern void
+solib_add PARAMS ((char *, int, struct target_ops *));
+
+/* Function to be called when the inferior starts up, to discover the names
+ of shared libraries that are dynamically linked, the base addresses to
+ which they are linked, and sufficient information to read in their symbols
+ at a later time. */
+
+#define SOLIB_CREATE_INFERIOR_HOOK solib_create_inferior_hook
+
+extern void
+solib_create_inferior_hook PARAMS((void)); /* solib.c */
+
+/* If we can't set a breakpoint, and it's in a shared library, just
+ disable it. */
+
+#define DISABLE_UNSETTABLE_BREAK(addr) solib_address(addr)
+
+extern int
+solib_address PARAMS ((CORE_ADDR)); /* solib.c */
+
diff --git a/gdb/sparc-pinsn.c b/gdb/sparc-pinsn.c
index 332b0ad..cb4b5d2 100644
--- a/gdb/sparc-pinsn.c
+++ b/gdb/sparc-pinsn.c
@@ -116,7 +116,7 @@ print_insn (memaddr, stream)
opcodes_sorted = 1;
}
- read_memory (memaddr, &insn, sizeof (insn));
+ read_memory (memaddr, (char *) &insn, sizeof (insn));
for (i = 0; i < NUMOPCODES; ++i)
{
diff --git a/gdb/standalone.c b/gdb/standalone.c
index b91a1f8..163a639 100644
--- a/gdb/standalone.c
+++ b/gdb/standalone.c
@@ -338,6 +338,8 @@ get_exec_file (err)
return "run";
}
+/* Nonzero if there is a core file. */
+
have_core_file_p ()
{
return 0;
diff --git a/gdb/sun3-xdep.c b/gdb/sun3-xdep.c
index 295dff8..2a3a4a1 100644
--- a/gdb/sun3-xdep.c
+++ b/gdb/sun3-xdep.c
@@ -31,7 +31,8 @@ extern int errno;
#if defined (GDB_TARGET_IS_SUN3)
/* All of this stuff is only relevant if both host and target are sun3. */
void
-fetch_inferior_registers ()
+fetch_inferior_registers (regno)
+ int regno;
{
struct regs inferior_registers;
#ifdef FP0_REGNUM
@@ -64,6 +65,7 @@ fetch_inferior_registers ()
If REGNO is -1, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
+void
store_inferior_registers (regno)
int regno;
{
@@ -96,10 +98,11 @@ store_inferior_registers (regno)
/* Machine-dependent code for pulling registers out of a Sun-3 core file. */
void
-fetch_core_registers (core_reg_sect, core_reg_size, which)
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
int which;
+ unsigned int reg_addr; /* Unused in this version */
{
extern char registers[];
struct regs *regs = (struct regs *) core_reg_sect;
@@ -135,12 +138,15 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
#else /* Not sun3 target. */
/* These functions shouldn't be called when we're cross-debugging. */
+/* ARGSUSED */
void
-fetch_inferior_registers ()
+fetch_inferior_registers (regno)
+ int regno;
{
}
/* ARGSUSED */
+void
store_inferior_registers (regno)
int regno;
{
@@ -148,10 +154,11 @@ store_inferior_registers (regno)
/* ARGSUSED */
void
-fetch_core_registers (core_reg_sect, core_reg_size, which)
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
int which;
+ unsigned int reg_addr; /* Unused in this version */
{
}
#endif /* Not sun3 target. */
diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c
index 0a35647..b56a159 100644
--- a/gdb/sun386-xdep.c
+++ b/gdb/sun386-xdep.c
@@ -41,9 +41,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/core.h>
+
void
-fetch_inferior_registers ()
+fetch_inferior_registers (regno)
+ int regno;
{
struct regs inferior_registers;
struct fp_state inferior_fp_registers;
@@ -67,6 +69,7 @@ fetch_inferior_registers ()
If REGNO is -1, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
+void
store_inferior_registers (regno)
int regno;
{
@@ -255,12 +258,15 @@ double_to_i387 (from, to)
/* These functions shouldn't be called when we're cross-debugging. */
+/* ARGSUSED */
void
-fetch_inferior_registers ()
+fetch_inferior_registers (regno)
+ int regno;
{
}
/* ARGSUSED */
+void
store_inferior_registers (regno)
int regno;
{
@@ -268,10 +274,11 @@ store_inferior_registers (regno)
/* ARGSUSED */
void
-fetch_core_registers (core_reg_sect, core_reg_size, which)
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
int which;
+ unsigned int reg_addr; /* Unused in this version */
{
}
diff --git a/gdb/symm-xdep.c b/gdb/symm-xdep.c
index a0508a9..0d20c53 100644
--- a/gdb/symm-xdep.c
+++ b/gdb/symm-xdep.c
@@ -1,5 +1,5 @@
/* Sequent Symmetry host interface, for GDB when running under Unix.
- Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,10 +37,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sgtty.h>
#define TERMINAL struct sgttyb
-extern void print_387_control_word ();
-extern void print_387_status_word ();
-extern void i387_to_double (from, to);
+#include "gdbcore.h"
+void
store_inferior_registers(regno)
int regno;
{
@@ -112,7 +111,8 @@ int regno;
}
void
-fetch_inferior_registers()
+fetch_inferior_registers (regno)
+ int regno;
{
int i;
struct pt_regset regs;
@@ -148,8 +148,6 @@ fetch_inferior_registers()
/* Work with core dump and executable files, for GDB.
This code would be in core.c if it weren't machine-dependent. */
-#include "gdbcore.h"
-
void
core_file_command (filename, from_tty)
char *filename;
diff --git a/gdb/target.c b/gdb/target.c
index eefdbea..c78eecb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -31,10 +31,41 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int errno;
-extern int memory_insert_breakpoint(), memory_remove_breakpoint();
-extern void host_convert_to_virtual(), host_convert_from_virtual();
+static void
+target_info PARAMS ((char *, int));
+
+static void
+cleanup_target PARAMS ((struct target_ops *));
+
+static void
+maybe_kill_then_create_inferior PARAMS ((char *, char *, char **));
+
+static void
+maybe_kill_then_attach PARAMS ((char *, int));
+
+static void
+kill_or_be_killed PARAMS ((int));
+
+static void
+default_terminal_info PARAMS ((char *, int));
+
+static int
+nosymbol PARAMS ((char *, CORE_ADDR *));
+
+static void
+noprocess PARAMS ((void));
+
+static void
+tcomplain PARAMS ((void));
+
+static int
+nomemory PARAMS ((CORE_ADDR, char *, int, int));
+
+static void
+ignore PARAMS ((void));
-static void cleanup_target ();
+static void
+target_command PARAMS ((char *, int));
/* Pointer to array of target architecture structures; the size of the
array; the current index into the array; the allocated size of the
@@ -110,8 +141,9 @@ add_target (t)
if (target_struct_size >= target_struct_allocsize)
{
target_struct_allocsize *= 2;
- target_structs = (struct target_ops **) xrealloc (target_structs,
- target_struct_allocsize * sizeof (*target_structs));
+ target_structs = (struct target_ops **)
+ xrealloc ((char *) target_structs,
+ target_struct_allocsize * sizeof (*target_structs));
}
target_structs[target_struct_size++] = t;
cleanup_target (t);
@@ -152,7 +184,7 @@ tcomplain ()
current_target->to_shortname);
}
-static int
+static void
noprocess ()
{
error ("You can't do that without a process to debug");
@@ -271,19 +303,19 @@ cleanup_target (t)
/* FIELD DEFAULT VALUE */
- de_fault (to_open, tcomplain);
+ de_fault (to_open, (void (*)())tcomplain);
de_fault (to_close, (void (*)())ignore);
de_fault (to_attach, maybe_kill_then_attach);
de_fault (to_detach, (void (*)())ignore);
de_fault (to_resume, (void (*)())noprocess);
- de_fault (to_wait, noprocess);
- de_fault (to_fetch_registers, ignore);
+ de_fault (to_wait, (int (*)())noprocess);
+ de_fault (to_fetch_registers, (void (*)())ignore);
de_fault (to_store_registers, (void (*)())noprocess);
de_fault (to_prepare_to_store, (void (*)())noprocess);
de_fault (to_convert_to_virtual, host_convert_to_virtual);
de_fault (to_convert_from_virtual, host_convert_from_virtual);
- de_fault (to_xfer_memory, nomemory);
- de_fault (to_files_info, ignore);
+ de_fault (to_xfer_memory, (int (*)())nomemory);
+ de_fault (to_files_info, (void (*)())ignore);
de_fault (to_insert_breakpoint, memory_insert_breakpoint);
de_fault (to_remove_breakpoint, memory_remove_breakpoint);
de_fault (to_terminal_init, ignore);
@@ -292,7 +324,7 @@ cleanup_target (t)
de_fault (to_terminal_ours, ignore);
de_fault (to_terminal_info, default_terminal_info);
de_fault (to_kill, (void (*)())noprocess);
- de_fault (to_load, tcomplain);
+ de_fault (to_load, (void (*)())tcomplain);
de_fault (to_lookup_symbol, nosymbol);
de_fault (to_create_inferior, maybe_kill_then_create_inferior);
de_fault (to_mourn_inferior, (void (*)())noprocess);
diff --git a/gdb/tm-sysv4.h b/gdb/tm-sysv4.h
index f1eea20..4d95ea0 100644
--- a/gdb/tm-sysv4.h
+++ b/gdb/tm-sysv4.h
@@ -1,6 +1,6 @@
/* Macro definitions for GDB on all SVR4 target systems.
- Copyright (C) 1991, Free Software Foundation, Inc.
- Written by Fred Fish at Cygnus Support (fnf@cygint)
+ Copyright (C) 1991, 1992, Free Software Foundation, Inc.
+ Written by Fred Fish at Cygnus Support (fnf@cygnus.com).
This file is part of GDB.
@@ -18,20 +18,4 @@ 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. */
-/* Support for SVR4 shared libraries. */
-
-#define CLEAR_SOLIB clear_solib
-extern void clear_solib (); /* solib.c */
-
-#define SOLIB_ADD(filename, from_tty, targ) solib_add (filename, from_tty, targ)
-extern void solib_add (); /* solib.c */
-
-#define SOLIB_CREATE_INFERIOR_HOOK solib_create_inferior_hook
-extern void solib_create_inferior_hook(); /* solib.c */
-
-/* If we can't set a breakpoint, and it's in a shared library, just
- disable it. */
-
-#define DISABLE_UNSETTABLE_BREAK(addr) solib_address(addr)
-extern int solib_address (); /* solib.c */
-
+#include "solib.h" /* Support for shared libraries. */
diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c
index 35eff11..505df6a 100644
--- a/gdb/ultra3-xdep.c
+++ b/gdb/ultra3-xdep.c
@@ -156,7 +156,7 @@ fetch_inferior_registers (regno)
* NOTE: Assumes AMD's binary compatibility standard.
*/
-int
+void
store_inferior_registers (regno)
int regno;
{
@@ -166,7 +166,7 @@ store_inferior_registers (regno)
if (regno >= 0)
{
if (CANNOT_STORE_REGISTER(regno))
- return 0; /* Pretend success */
+ return;
regaddr = register_addr (regno, 0);
errno = 0;
ptrace (PT_WRITE_U, inferior_pid,(int*)regaddr,read_register(regno));
@@ -209,7 +209,7 @@ store_inferior_registers (regno)
{
sprintf (buf, "writing all special registers");
perror_with_name (buf);
- return -1;
+ return;
}
#else
store_inferior_registers(GR1_REGNUM);
@@ -229,13 +229,13 @@ store_inferior_registers (regno)
store_inferior_registers(FC_REGNUM);
#endif /* ULTRA3 */
}
- return 0;
}
/*
* Read AMD's Binary Compatibilty Standard conforming core file.
* struct ptrace_user is the first thing in the core file
*/
+
void
fetch_core_registers ()
{
diff --git a/gdb/utils.c b/gdb/utils.c
index 3fba8bf..0f7b2f8 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1,5 +1,5 @@
/* General utility routines for GDB, the GNU debugger.
- Copyright (C) 1986, 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,10 +32,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "target.h"
-extern volatile void return_to_top_level ();
-extern volatile void exit ();
-extern char *gdb_readline ();
-extern char *getenv();
+/* Prototypes for local functions */
+
+#if !defined (NO_MALLOC_CHECK)
+static void
+malloc_botch PARAMS ((void));
+#endif /* NO_MALLOC_CHECK */
+
+static void
+fatal_dump_core (); /* Can't prototype with <varargs.h> usage... */
+
+static void
+prompt_for_continue PARAMS ((void));
+
+static void
+set_width_command PARAMS ((char *, int, struct cmd_list_element *));
+
+static void
+vfprintf_filtered PARAMS ((FILE *, char *, va_list));
/* If this definition isn't overridden by the header files, assume
that isatty and fileno exist on this system. */
@@ -86,8 +100,8 @@ char *warning_pre_print;
struct cleanup *
make_cleanup (function, arg)
- void (*function) ();
- int arg;
+ void (*function) PARAMS ((PTR));
+ PTR arg;
{
register struct cleanup *new
= (struct cleanup *) xmalloc (sizeof (struct cleanup));
@@ -223,7 +237,7 @@ warning (va_alist)
and the remaining args are passed as arguments to it. */
/* VARARGS */
-volatile void
+NORETURN void
error (va_alist)
va_dcl
{
@@ -245,10 +259,13 @@ error (va_alist)
/* Print an error message and exit reporting failure.
This is for a error that we cannot continue from.
- The arguments are printed a la printf. */
+ The arguments are printed a la printf.
+
+ This function cannot be declared volatile (NORETURN) in an
+ ANSI environment because exit() is not declared volatile. */
/* VARARGS */
-volatile void
+NORETURN void
fatal (va_alist)
va_dcl
{
@@ -266,8 +283,9 @@ fatal (va_alist)
/* Print an error message and exit, dumping core.
The arguments are printed a la printf (). */
+
/* VARARGS */
-void
+static void
fatal_dump_core (va_alist)
va_dcl
{
@@ -288,6 +306,7 @@ fatal_dump_core (va_alist)
/* We should never get here, but just in case... */
exit (1);
}
+
/* Memory management stuff (malloc friends). */
@@ -305,6 +324,8 @@ malloc_botch ()
void
init_malloc ()
{
+ extern PTR (*__morecore) PARAMS ((long));
+
mcheck (malloc_botch);
mtrace ();
}
@@ -312,18 +333,13 @@ init_malloc ()
/* Like malloc but get error if no storage available. */
-#ifdef __STDC__
-void *
-#else
-char *
-#endif
+PTR
xmalloc (size)
long size;
{
register char *val;
- /* At least one place (dbxread.c:condense_misc_bunches where misc_count == 0)
- GDB wants to allocate zero bytes. */
+ /* Protect against gdb wanting to allocate zero bytes. */
if (size == 0)
return NULL;
@@ -335,11 +351,7 @@ xmalloc (size)
/* Like realloc but get error if no storage available. */
-#ifdef __STDC__
-void *
-#else
-char *
-#endif
+PTR
xrealloc (ptr, size)
char *ptr;
long size;
@@ -550,6 +562,7 @@ query (va_alist)
printf ("Please answer y or n.\n");
}
}
+
/* Parse a C escape sequence. STRING_PTR points to a variable
containing a pointer to the string to parse. That pointer
@@ -804,7 +817,7 @@ fputs_filtered (linebuffer, stream)
const char *linebuffer;
FILE *stream;
{
- char *lineptr;
+ const char *lineptr;
if (linebuffer == 0)
return;
@@ -912,11 +925,6 @@ fputs_demangled (linebuffer, stream, arg_mode)
FILE *stream;
int arg_mode;
{
-#ifdef __STDC__
- extern char *cplus_demangle (const char *, int);
-#else
- extern char *cplus_demangle ();
-#endif
#define SYMBOL_MAX 1024
#define SYMBOL_CHAR(c) (isascii(c) \
@@ -998,12 +1006,11 @@ fputs_demangled (linebuffer, stream, arg_mode)
(since prompt_for_continue may do so) so this routine should not be
called when cleanups are not in place. */
-/* VARARGS */
-void
+static void
vfprintf_filtered (stream, format, args)
- va_list args;
FILE *stream;
char *format;
+ va_list args;
{
static char *linebuffer = (char *) 0;
static int line_size;
@@ -1041,9 +1048,9 @@ void
fprintf_filtered (va_alist)
va_dcl
{
- va_list args;
FILE *stream;
char *format;
+ va_list args;
va_start (args);
stream = va_arg (args, FILE *);
@@ -1051,7 +1058,7 @@ fprintf_filtered (va_alist)
/* This won't blow up if the restrictions described above are
followed. */
- (void) vfprintf_filtered (stream, format, args);
+ vfprintf_filtered (stream, format, args);
va_end (args);
}
@@ -1066,7 +1073,7 @@ printf_filtered (va_alist)
va_start (args);
format = va_arg (args, char *);
- (void) vfprintf_filtered (stdout, format, args);
+ vfprintf_filtered (stdout, format, args);
va_end (args);
}
@@ -1113,7 +1120,6 @@ print_spaces_filtered (n, stream)
}
/* C++ demangler stuff. */
-char *cplus_demangle ();
/* Print NAME on STREAM, demangling if necessary. */
void
diff --git a/gdb/valops.c b/gdb/valops.c
index c340932..83d6ec8 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1211,8 +1211,8 @@ value_struct_elt (argp, args, name, static_memfuncp, err)
if NAME is inappropriate for TYPE, an error is signaled. */
int
destructor_name_p (name, type)
- char *name;
- struct type *type;
+ const char *name;
+ const struct type *type;
{
/* destructors are a special case. */
@@ -1272,8 +1272,8 @@ check_field_in (type, name)
int
check_field (arg1, name)
- register value arg1;
- char *name;
+ register const value arg1;
+ const char *name;
{
register struct type *t;