From: Stu Grossman Date: Tue, 13 Aug 1996 00:01:37 +0000 (+0000) Subject: * defs.h: Define CONST_PTR as blank if compiling with Microsoft X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8501c7427079ac2d8668e5e36408fa5af2d59bbe;p=binutils-gdb.git * defs.h: Define CONST_PTR as blank if compiling with Microsoft C, else it's `const'. * c-lang.c c-lang.h ch-lang.c f-lang.c language.c m2-lang.c scm-lang.c: Microsoft C can't hack const pointers. Use CONST_PTR macro instead. * configure configure.in defs.h: Use AC_C_CONST to figure out if the compiler supports const. Gets rid of some cruft in defs.h. * dwarf2read.c: -> "gdb_string.h" * remote-sim.c: Add prototypes. Fix call to gdbsim_kill. * sparcl-tdep.c (download): Add prototypes to write_routine and start_routine args. * mswin/gdbwin.c: Don't include both varargs.h AND stdarg.h. Get rid of varargs.h Include string.h. * (gdbwin_update gdbwin_fputs regs_changed_f bpt_changed_f update): Fix prototypes, fix calls. * (update): Return value for catch_errors. * (run_execute_command togdb_command_from_tty togdb_command): Cleanup catching of errors from calls to execute_command. Also, dup command string to avoid modifying const strings. * (togdb_breakinfo_i_init togdb_breakinfo_i_next): Use 0 instead of NULL when see if b->address isn't set. * (bi_disable_bpt bi_enable_bpt bi_delete_all bi_delete_breakpoint): Add arg to calls to update. * (gui_command): Add prototype. * (mswin_query): Fix prototype. * (_initialize_gdbwin): Dup string to avoid modifying const. * (info_path togdb_get_info_path): Remove const from decls cuz this can't be const (it points at malloc'ed memory). * (togdb_searchpath): Remove const from path. Dup string to avoid modifying const strings. * rindex -> strrchr. * (gdbwin_list_symbols): Regexp param is const. * Fix lots of refs to psymtabs to deref correct pointers. * (togdb_set_breakpoint_sal): Call set_breakpoint_sal with sal, not &sal. * mswin/gdbwin.h (togdb_searchpath togdb_get_info_path toget_set_info_path): Fix prototypes to match reality. * mswin/gui.cpp: Define _beginthreadex and _endthreadex routines with proper prototypes. * mswin/iface.cpp (gdbwin_fputs): Define with correct number of args. * mswin/ser-win32s.c: Fix defs of min and max. * mswin/serdll32.c (OpenComm16): Make cbInQueue and cbOutQueue be USHORT. * (WriteComm16): Change lpBug from LPVOID to LPCSTR. * mswin/serdll32.h: Fix prototypes for OpenComm16 and WriteComm16. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7a5f284ebac..28459f24b17 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,52 @@ +Mon Aug 12 16:20:58 1996 Stu Grossman (grossman@critters.cygnus.com) + + * defs.h: Define CONST_PTR as blank if compiling with Microsoft + C, else it's `const'. + * c-lang.c c-lang.h ch-lang.c f-lang.c language.c m2-lang.c + scm-lang.c: Microsoft C can't hack const pointers. Use CONST_PTR + macro instead. + * configure configure.in defs.h: Use AC_C_CONST to figure out if + the compiler supports const. Gets rid of some cruft in defs.h. + * dwarf2read.c: -> "gdb_string.h" + * remote-sim.c: Add prototypes. Fix call to gdbsim_kill. + * sparcl-tdep.c (download): Add prototypes to write_routine and + start_routine args. + + * mswin/gdbwin.c: Don't include both varargs.h AND stdarg.h. Get + rid of varargs.h Include string.h. + * (gdbwin_update gdbwin_fputs regs_changed_f bpt_changed_f + update): Fix prototypes, fix calls. + * (update): Return value for catch_errors. + * (run_execute_command togdb_command_from_tty togdb_command): + Cleanup catching of errors from calls to execute_command. Also, + dup command string to avoid modifying const strings. + * (togdb_breakinfo_i_init togdb_breakinfo_i_next): Use 0 instead + of NULL when see if b->address isn't set. + * (bi_disable_bpt bi_enable_bpt bi_delete_all + bi_delete_breakpoint): Add arg to calls to update. + * (gui_command): Add prototype. + * (mswin_query): Fix prototype. + * (_initialize_gdbwin): Dup string to avoid modifying const. + * (info_path togdb_get_info_path): Remove const from decls cuz + this can't be const (it points at malloc'ed memory). + * (togdb_searchpath): Remove const from path. Dup string to + avoid modifying const strings. + * rindex -> strrchr. + * (gdbwin_list_symbols): Regexp param is const. + * Fix lots of refs to psymtabs to deref correct pointers. + * (togdb_set_breakpoint_sal): Call set_breakpoint_sal with sal, + not &sal. + * mswin/gdbwin.h (togdb_searchpath togdb_get_info_path + toget_set_info_path): Fix prototypes to match reality. + * mswin/gui.cpp: Define _beginthreadex and _endthreadex routines + with proper prototypes. + * mswin/iface.cpp (gdbwin_fputs): Define with correct number of args. + * mswin/ser-win32s.c: Fix defs of min and max. + * mswin/serdll32.c (OpenComm16): Make cbInQueue and cbOutQueue be + USHORT. + * (WriteComm16): Change lpBug from LPVOID to LPCSTR. + * mswin/serdll32.h: Fix prototypes for OpenComm16 and WriteComm16. + Sun Aug 11 20:54:16 1996 Stu Grossman (grossman@critters.cygnus.com) * main.c (main): Make sure command loop is used with cygwin32. diff --git a/gdb/c-lang.c b/gdb/c-lang.c index c01a56edaed..a104e6129e9 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -371,7 +371,7 @@ const struct op_print c_op_print_tab[] = {NULL, 0, 0, 0} }; -struct type ** const (c_builtin_types[]) = +struct type ** CONST_PTR (c_builtin_types[]) = { &builtin_type_int, &builtin_type_long, diff --git a/gdb/c-lang.h b/gdb/c-lang.h index fbd8b69e95f..c8f8aa3468b 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -45,7 +45,7 @@ extern void c_printstr PARAMS ((GDB_FILE *, char *, unsigned int, int)); extern struct type * c_create_fundamental_type PARAMS ((struct objfile*, int)); -extern struct type ** const (c_builtin_types[]); +extern struct type ** CONST_PTR (c_builtin_types[]); /* These are in c-typeprint.c: */ diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c index b7262433603..a91ee17347c 100644 --- a/gdb/ch-lang.c +++ b/gdb/ch-lang.c @@ -330,7 +330,7 @@ struct type *builtin_type_chill_long; struct type *builtin_type_chill_ulong; struct type *builtin_type_chill_real; -struct type ** const (chill_builtin_types[]) = +struct type ** CONST_PTR (chill_builtin_types[]) = { &builtin_type_chill_bool, &builtin_type_chill_char, diff --git a/gdb/configure b/gdb/configure index 200fd709ed7..75f6d460110 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1426,6 +1426,81 @@ EOF fi +echo $ac_n "checking for working const""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + + for ac_func in setpgid sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 @@ -1433,7 +1508,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1485,7 +1560,7 @@ if eval "test \"`echo '$''{'gdb_cv_have_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } @@ -1493,7 +1568,7 @@ int t() { gregset_t *gregsetp = 0 ; return 0; } EOF -if { (eval echo configure:1497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gdb_cv_have_gregset_t=yes else @@ -1517,7 +1592,7 @@ if eval "test \"`echo '$''{'gdb_cv_have_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } @@ -1525,7 +1600,7 @@ int t() { fpregset_t *fpregsetp = 0 ; return 0; } EOF -if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gdb_cv_have_fpregset_t=yes else @@ -1550,7 +1625,7 @@ if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -1591,7 +1666,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then gdb_cv_printf_has_long_long=yes else @@ -1625,7 +1700,7 @@ if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -1661,7 +1736,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then gdb_cv_printf_has_long_double=yes else @@ -1696,7 +1771,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1750,7 +1825,7 @@ else ac_cv_func_mmap=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_func_mmap=yes else @@ -2232,12 +2307,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2364,12 +2439,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* diff --git a/gdb/configure.in b/gdb/configure.in index 90423e6a867..a8ffc6ad726 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -42,6 +42,8 @@ AC_HEADER_STDC AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h sys/procfs.h link.h endian.h) AC_HEADER_STAT +AC_C_CONST + AC_CHECK_FUNCS(setpgid sbrk) AC_MSG_CHECKING([for gregset_t type]) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2ece59486ec..f0f008baeec 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "language.h" #include -#include +#include "gdb_string.h" #include /* .debug_info header for a compilation unit diff --git a/gdb/f-lang.c b/gdb/f-lang.c index a72b1032cc8..a477c40d047 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -434,7 +434,7 @@ static const struct op_print f_op_print_tab[] = { { NULL, 0, 0, 0 } }; -struct type ** const (f_builtin_types[]) = +struct type ** CONST_PTR (f_builtin_types[]) = { &builtin_type_f_character, &builtin_type_f_logical, diff --git a/gdb/language.c b/gdb/language.c index 61a95d8b92b..17ab815fae0 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1274,7 +1274,7 @@ unk_lang_value_print (val, stream, format, pretty) error ("internal error - unimplemented function unk_lang_value_print called."); } -static struct type ** const (unknown_builtin_types[]) = { 0 }; +static struct type ** CONST_PTR (unknown_builtin_types[]) = { 0 }; static const struct op_print unk_op_print_tab[] = { {NULL, OP_NULL, PREC_NULL, 0} }; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index b25dda339af..720082433f2 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -403,7 +403,7 @@ struct type *builtin_type_m2_card; struct type *builtin_type_m2_real; struct type *builtin_type_m2_bool; -struct type ** const (m2_builtin_types[]) = +struct type ** CONST_PTR (m2_builtin_types[]) = { &builtin_type_m2_char, &builtin_type_m2_int, diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 124022accb8..5c9e7129f66 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -36,6 +36,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "remote-utils.h" #include "callback.h" +/* Prototypes */ + +static void dump_mem PARAMS ((char *buf, int len)); + +static void gdbsim_fetch_register PARAMS ((int regno)); + +static void gdbsim_store_register PARAMS ((int regno)); + +static void gdbsim_kill PARAMS ((void)); + +static void gdbsim_load PARAMS ((char *prog, int fromtty)); + +static void gdbsim_create_inferior PARAMS ((char *exec_file, char *args, char **env)); + +static void gdbsim_open PARAMS ((char *args, int from_tty)); + +static void gdbsim_close PARAMS ((int quitting)); + +static void gdbsim_detach PARAMS ((char *args, int from_tty)); + +static void gdbsim_resume PARAMS ((int pid, int step, enum target_signal siggnal)); + +static int gdbsim_wait PARAMS ((int pid, struct target_waitstatus *status)); + +static void gdbsim_prepare_to_store PARAMS ((void)); + +static int gdbsim_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr, + char *myaddr, int len, + int write, + struct target_ops *target)); + +static void gdbsim_files_info PARAMS ((struct target_ops *target)); + +static void gdbsim_mourn_inferior PARAMS ((void)); + +static void simulator_command PARAMS ((char *args, int from_tty)); + /* Naming convention: sim_* are the interface to the simulator (see remote-sim.h). @@ -186,7 +223,7 @@ gdbsim_create_inferior (exec_file, args, env) entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd); - gdbsim_kill (NULL, NULL); + gdbsim_kill (); remove_breakpoints (); init_wait_for_inferior (); diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index c54b2c11874..16739a0d13d 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -36,7 +36,7 @@ static value_ptr scm_lookup_name PARAMS ((char *)); static int in_eval_c PARAMS ((void)); static void scm_printstr PARAMS ((GDB_FILE *, char *, unsigned int, int)); -extern struct type ** const (c_builtin_types[]); +extern struct type ** CONST_PTR (c_builtin_types[]); struct type *builtin_type_scm; diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index 08736aa9715..0bcc3a4f01d 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -532,8 +532,9 @@ download (target_name, args, from_tty, write_routine, start_routine) char *target_name; char *args; int from_tty; - void (*write_routine)(); - void (*start_routine)(); + void (*write_routine) PARAMS ((bfd *from_bfd, asection *from_sec, + file_ptr from_addr, bfd_vma to_addr, int len)); + void (*start_routine) PARAMS ((bfd_vma entry)); { struct cleanup *old_chain; asection *section;