From: John Gilmore Date: Fri, 21 Feb 1992 01:33:14 +0000 (+0000) Subject: * core.c, exec.c, infrun.c, inftarg.c, language.c, remote.c, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ed0f002ede4baa5bba71173818d14b818184410;p=binutils-gdb.git * core.c, exec.c, infrun.c, inftarg.c, language.c, remote.c, signame.c, sparc-xdep.c: Prototypes for all static functions. Lint. --- diff --git a/gdb/core.c b/gdb/core.c index c880d869249..deeb5238c00 100644 --- a/gdb/core.c +++ b/gdb/core.c @@ -1,5 +1,5 @@ /* Work with core dump and executable files, for GDB. - Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. This file is part of GDB. @@ -30,9 +30,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "target.h" #include "gdbcore.h" -extern int xfer_memory (); -extern void child_attach (), child_create_inferior (); -extern void print_section_info (); +#ifdef SOLIB_ADD +static int +solib_add_stub PARAMS ((char *)); +#endif + +static void +core_close PARAMS ((int)); + +static void +core_open PARAMS ((char *, int)); + +static void +core_detach PARAMS ((char *, int)); + +static void +get_core_registers PARAMS ((int)); + +static void +core_files_info PARAMS ((struct target_ops *)); extern int sys_nerr; extern char *sys_errlist[]; @@ -42,7 +58,7 @@ extern char registers[]; /* Hook for `exec_file_command' command to call. */ -void (*exec_file_display_hook) () = NULL; +void (*exec_file_display_hook) PARAMS ((char *)) = NULL; /* Binary file diddling handle for the core file. */ @@ -56,7 +72,7 @@ extern struct target_ops core_ops; and mark data and stack spaces as empty. */ /* ARGSUSED */ -void +static void core_close (quitting) int quitting; { @@ -67,10 +83,10 @@ core_close (quitting) #ifdef CLEAR_SOLIB CLEAR_SOLIB (); #endif - if (core_ops.sections) { - free (core_ops.sections); - core_ops.sections = NULL; - core_ops.sections_end = NULL; + if (core_ops.to_sections) { + free (core_ops.to_sections); + core_ops.to_sections = NULL; + core_ops.to_sections_end = NULL; } } } @@ -78,7 +94,7 @@ core_close (quitting) #ifdef SOLIB_ADD /* Stub function for catch_errors around shared library hacking. */ -int +static int solib_add_stub (from_tty) char *from_tty; { @@ -89,7 +105,7 @@ solib_add_stub (from_tty) /* This routine opens and sets up the core file bfd */ -void +static void core_open (filename, from_tty) char *filename; int from_tty; @@ -131,7 +147,8 @@ core_open (filename, from_tty) if (!bfd_check_format (temp_bfd, bfd_core)) { - make_cleanup (bfd_close, temp_bfd); /* Do it after the err msg */ + /* Do it after the err msg */ + make_cleanup (bfd_close, temp_bfd); error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_error)); } @@ -145,8 +162,8 @@ core_open (filename, from_tty) validate_files (); /* Find the data section */ - if (build_section_table (core_bfd, &core_ops.sections, - &core_ops.sections_end)) + if (build_section_table (core_bfd, &core_ops.to_sections, + &core_ops.to_sections_end)) error ("Can't find sections in `%s': %s", bfd_get_filename(core_bfd), bfd_errmsg (bfd_error)); @@ -183,7 +200,7 @@ your %s; do ``info files''\n", current_target->to_longname); } } -void +static void core_detach (args, from_tty) char *args; int from_tty; @@ -215,7 +232,7 @@ core_file_command (filename, from_tty) void specify_exec_file_hook (hook) - void (*hook) (); + void (*hook) PARAMS ((char *)); { exec_file_display_hook = hook; } @@ -280,6 +297,8 @@ core_files_info (t) print_section_info (t, core_bfd); } +/* Report a memory error with error(). */ + void memory_error (status, memaddr) int status; @@ -429,7 +448,7 @@ struct target_ops core_ops = { xfer_memory, core_files_info, 0, 0, /* core_insert_breakpoint, core_remove_breakpoint, */ 0, 0, 0, 0, 0, /* terminal stuff */ - 0, 0, 0, 0, /* kill, load, call fn, lookup sym */ + 0, 0, 0, /* kill, load, lookup sym */ child_create_inferior, 0, /* mourn_inferior */ core_stratum, 0, /* next */ 0, 1, 1, 1, 0, /* all mem, mem, stack, regs, exec */ diff --git a/gdb/language.c b/gdb/language.c index 81b21a99f47..cd5fb69f46c 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1,5 +1,5 @@ /* Multiple source language support for GDB. - Copyright 1991 Free Software Foundation, Inc. + Copyright 1991, 1992 Free Software Foundation, Inc. Contributed by the Department of Computer Science at the State University of New York at Buffalo. @@ -36,19 +36,56 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "value.h" #include "gdbcmd.h" #include "frame.h" -#include "language.h" #include "expression.h" +#include "language.h" #include "target.h" #include "parser-defs.h" -extern volatile void return_to_top_level (); +static void +show_language_command PARAMS ((char *, int)); + +static void +set_language_command PARAMS ((char *, int)); + +static void +show_type_command PARAMS ((char *, int)); -/* Forward function declarations */ -static void set_type_range (); +static void +set_type_command PARAMS ((char *, int)); + +static void +show_range_command PARAMS ((char *, int)); + +static void +set_range_command PARAMS ((char *, int)); + +static void +set_range_str PARAMS ((void)); + +static void +set_type_str PARAMS ((void)); + +static void +set_lang_str PARAMS ((void)); + +static void +unk_lang_error PARAMS ((char *)); + +static int +unk_lang_parser PARAMS ((void)); + +static void +show_check PARAMS ((char *, int)); + +static void +set_check PARAMS ((char *, int)); + +static void +set_type_range PARAMS ((void)); /* Forward declaration */ extern const struct language_defn unknown_language_defn; - + /* The current (default at startup) state of type and range checking. (If the modes are set to "auto", though, these are changed based on the default language at startup, and then again based on the @@ -66,7 +103,7 @@ enum language_mode language_mode = language_mode_auto; /* The list of supported languages. The list itself is malloc'd. */ -static struct language_defn **languages; +static const struct language_defn **languages; static unsigned languages_size; static unsigned languages_allocsize; #define DEFAULT_ALLOCSIZE 3 @@ -86,16 +123,13 @@ static char *range; char lang_frame_mismatch_warn[] = "Warning: the current language does not match this frame."; -void set_lang_str(); -void set_type_str(); -void set_range_str(); /* This page contains the functions corresponding to GDB commands and their helpers. */ /* Show command. Display a warning if the language set does not match the frame. */ -void +static void show_language_command (ignore, from_tty) char *ignore; int from_tty; @@ -110,7 +144,7 @@ show_language_command (ignore, from_tty) } /* Set command. Change the current working language. */ -void +static void set_language_command (ignore, from_tty) char *ignore; int from_tty; @@ -163,7 +197,7 @@ modula-2 Use the Modula-2 language\n"); /* Show command. Display a warning if the type setting does not match the current language. */ -void +static void show_type_command(ignore, from_tty) char *ignore; int from_tty; @@ -174,7 +208,7 @@ show_type_command(ignore, from_tty) } /* Set command. Change the setting for type checking. */ -void +static void set_type_command(ignore, from_tty) char *ignore; int from_tty; @@ -208,7 +242,7 @@ set_type_command(ignore, from_tty) /* Show command. Display a warning if the range setting does not match the current language. */ -void +static void show_range_command(ignore, from_tty) char *ignore; int from_tty; @@ -220,7 +254,7 @@ show_range_command(ignore, from_tty) } /* Set command. Change the setting for range checking. */ -void +static void set_range_command(ignore, from_tty) char *ignore; int from_tty; @@ -290,7 +324,7 @@ set_language(lang) /* This page contains functions that update the global vars language, type and range. */ -void +static void set_lang_str() { char *prefix = ""; @@ -302,7 +336,7 @@ set_lang_str() language = concat(prefix, current_language->la_name, NULL); } -void +static void set_type_str() { char *tmp, *prefix = ""; @@ -329,7 +363,7 @@ set_type_str() type = concat(prefix,tmp,NULL); } -void +static void set_range_str() { char *tmp, *pref = ""; @@ -358,10 +392,12 @@ set_range_str() /* Print out the current language settings: language, range and - type checking. */ + type checking. If QUIETLY, print only what has changed. */ void -language_info () +language_info (quietly) + int quietly; { + /* FIXME: quietly is ignored at the moment. */ printf("Current Language: %s\n",language); show_language_command((char *)0, 1); printf("Type checking: %s\n",type); @@ -371,6 +407,9 @@ language_info () } /* Return the result of a binary operation. */ + +#if 0 /* Currently unused */ + struct type * binop_result_type(v1,v2) value v1,v2; @@ -406,6 +445,9 @@ binop_result_type(v1,v2) abort(); return (struct type *)0; /* For lint */ } + +#endif /* 0 */ + /* This page contains functions that return format strings for printf for printing out numbers in different formats */ @@ -583,6 +625,7 @@ character_type (type) TYPE_LENGTH(type) == sizeof(char) ? 1 : 0; } + return (0); } /* Returns non-zero if the value is a boolean type */ @@ -599,6 +642,7 @@ boolean_type (type) case language_cplus: return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1; } + return (0); } /* Returns non-zero if the value is a floating-point type */ @@ -635,6 +679,7 @@ structured_type(type) (TYPE_CODE(type) == TYPE_CODE_SET) || (TYPE_CODE(type) == TYPE_CODE_ARRAY); } + return (0); } /* This page contains functions that return info about @@ -683,6 +728,9 @@ value_true(val) /* Returns non-zero if the operator OP is defined on the values ARG1 and ARG2. */ + +#if 0 /* Currently unused */ + void binop_type_check(arg1,arg2,op) value arg1,arg2; @@ -836,6 +884,9 @@ binop_type_check(arg1,arg2,op) } } } + +#endif /* 0 */ + /* This page contains functions for the printing out of error messages that occur during type- and range- @@ -867,9 +918,10 @@ op_error (fmt,op,fatal) [type|range]_check is [type|range]_check_on, then return_to_top_level() is called in the style of error (). Otherwise, the message is prefixed by "warning: " and we do not return to the top level. */ + void type_error (va_alist) - va_dcl + va_dcl { va_list args; char *string; @@ -890,7 +942,7 @@ type_error (va_alist) void range_error (va_alist) - va_dcl + va_dcl { va_list args; char *string; @@ -952,7 +1004,7 @@ show_check (arg, from_tty) void add_language (lang) - struct language_defn *lang; + const struct language_defn *lang; { if (lang->la_magic != LANG_MAGIC) { @@ -964,13 +1016,13 @@ add_language (lang) if (!languages) { languages_allocsize = DEFAULT_ALLOCSIZE; - languages = (struct language_defn **) xmalloc + languages = (const struct language_defn **) xmalloc (languages_allocsize * sizeof (*languages)); } if (languages_size >= languages_allocsize) { languages_allocsize *= 2; - languages = (struct language_defn **) xrealloc (languages, + languages = (const struct language_defn **) xrealloc ((char *) languages, languages_allocsize * sizeof (*languages)); } languages[languages_size++] = lang; @@ -978,14 +1030,15 @@ add_language (lang) /* Define the language that is no language. */ -int +static int unk_lang_parser () { return 1; } -void -unk_lang_error () +static void +unk_lang_error (msg) + char *msg; { error ("Attempted to parse an expression with unknown language"); } diff --git a/gdb/signame.c b/gdb/signame.c index 3569da601a2..f0e88babcad 100755 --- a/gdb/signame.c +++ b/gdb/signame.c @@ -1,5 +1,5 @@ /* Convert between signal names and numbers, for GDB. - Copyright 1990, 1991 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992 Free Software Foundation, Inc. This file is part of GDB. @@ -19,22 +19,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include -#include "signame.h" - /* GDB-specific, FIXME. (This is for the SYS_SIGLIST_MISSING define). */ #include "defs.h" +#include "signame.h" -#ifdef __STDC__ -#define CONST const -#else -#define CONST -#endif +static void +init_sig PARAMS ((int, const char *, const char *)); + +static void +init_sigs PARAMS ((void)); #if SYS_SIGLIST_MISSING /* There is too much variation in Sys V signal numbers and names, so we must initialize them at runtime. */ -static CONST char undoc[] = "unknown signal"; +static const char undoc[] = "unknown signal"; /* We'd like to make this const char*[], but whoever's using it might want to assign from it to a char*. */ @@ -46,7 +45,7 @@ char *sys_siglist[NSIG]; typedef struct { int number; - CONST char *abbrev; + const char *abbrev; } num_abbrev; static num_abbrev sig_table[NSIG*2]; /* Number of elements of sig_table used. */ @@ -57,8 +56,8 @@ static int sig_table_nelts = 0; static void init_sig (number, abbrev, name) int number; - CONST char *abbrev; - CONST char *name; + const char *abbrev; + const char *name; { #if SYS_SIGLIST_MISSING sys_siglist[number] = (char *) name; @@ -219,7 +218,7 @@ sig_abbrev (number) signal by that name. */ int sig_number (abbrev) - CONST char *abbrev; + const char *abbrev; { int i; @@ -240,7 +239,7 @@ sig_number (abbrev) void psignal (signal, message) unsigned signal; - CONST char *message; + const char *message; { if (signal <= 0 || signal >= NSIG) fprintf (stderr, "%s: unknown signal", message); diff --git a/gdb/sparc-xdep.c b/gdb/sparc-xdep.c index e85caac1abe..8fb5bb0b04c 100644 --- a/gdb/sparc-xdep.c +++ b/gdb/sparc-xdep.c @@ -1,5 +1,5 @@ /* Host-dependent code for SPARC host systems, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1990, 1991 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. This file is part of GDB. @@ -140,7 +140,7 @@ fetch_inferior_registers (regno) If REGNO is -1, do this for all registers. Otherwise, REGNO specifies which register (so we can save time). */ -int +void store_inferior_registers (regno) int regno; { @@ -181,7 +181,7 @@ store_inferior_registers (regno) else { deferred_stores |= wanna_store; - return 0; + return; } } @@ -241,14 +241,14 @@ store_inferior_registers (regno) ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers)) perror("ptrace_setfpregs"); } - return 0; } 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 */ { if (which == 0) {