* defs.h: Define CONST_PTR as blank if compiling with Microsoft
authorStu Grossman <grossman@cygnus>
Tue, 13 Aug 1996 00:01:37 +0000 (00:01 +0000)
committerStu Grossman <grossman@cygnus>
Tue, 13 Aug 1996 00:01:37 +0000 (00:01 +0000)
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:  <string.h> -> "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.

13 files changed:
gdb/ChangeLog
gdb/c-lang.c
gdb/c-lang.h
gdb/ch-lang.c
gdb/configure
gdb/configure.in
gdb/dwarf2read.c
gdb/f-lang.c
gdb/language.c
gdb/m2-lang.c
gdb/remote-sim.c
gdb/scm-lang.c
gdb/sparcl-tdep.c

index 7a5f284..28459f2 100644 (file)
@@ -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:  <string.h> -> "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.
index c01a56e..a104e61 100644 (file)
@@ -371,7 +371,7 @@ const struct op_print c_op_print_tab[] =
     {NULL, 0, 0, 0}
 };
 \f
-struct type ** const (c_builtin_types[]) = 
+struct type ** CONST_PTR (c_builtin_types[]) = 
 {
   &builtin_type_int,
   &builtin_type_long,
index fbd8b69..c8f8aa3 100644 (file)
@@ -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: */
 
index b726243..a91ee17 100644 (file)
@@ -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,
index 200fd70..75f6d46 100755 (executable)
@@ -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 <<EOF
+#line 1435 "configure"
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->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 <<EOF
-#line 1437 "configure"
+#line 1512 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1457,7 +1532,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1461: \"$ac_link\") 1>&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 <<EOF
-#line 1489 "configure"
+#line 1564 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 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 <<EOF
-#line 1521 "configure"
+#line 1596 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
 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 <<EOF
-#line 1554 "configure"
+#line 1629 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1563,7 +1638,7 @@ void bar ()
 }
 ; return 0; }
 EOF
-if { (eval echo configure:1567: \"$ac_compile\") 1>&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 <<EOF
-#line 1595 "configure"
+#line 1670 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -1601,7 +1676,7 @@ int main () {
   return (strcmp ("12345", buf));
 }
 EOF
-{ (eval echo configure:1605: \"$ac_link\") 1>&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 <<EOF
-#line 1629 "configure"
+#line 1704 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1633,7 +1708,7 @@ int t() {
 long double foo;
 ; return 0; }
 EOF
-if { (eval echo configure:1637: \"$ac_compile\") 1>&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 <<EOF
-#line 1665 "configure"
+#line 1740 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -1671,7 +1746,7 @@ int main () {
   return (strncmp ("3.14159", buf, 7));
 }
 EOF
-{ (eval echo configure:1675: \"$ac_link\") 1>&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 <<EOF
-#line 1700 "configure"
+#line 1775 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1720,7 +1795,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1724: \"$ac_link\") 1>&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 <<EOF
-#line 1754 "configure"
+#line 1829 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test. */
@@ -1819,7 +1894,7 @@ main()
 }
 
 EOF
-{ (eval echo configure:1823: \"$ac_link\") 1>&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
-#line 2236 "configure"
+#line 2311 "configure"
 #include "confdefs.h"
 #include <tclInt.h>
 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
-#line 2368 "configure"
+#line 2443 "configure"
 #include "confdefs.h"
 #include <tk.h>
 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*
index 90423e6..a8ffc6a 100644 (file)
@@ -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])
index 2ece594..f0f008b 100644 (file)
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "language.h"
 
 #include <fcntl.h>
-#include <string.h>
+#include "gdb_string.h"
 #include <sys/types.h>
 
 /* .debug_info header for a compilation unit 
index a72b103..a477c40 100644 (file)
@@ -434,7 +434,7 @@ static const struct op_print f_op_print_tab[] = {
   { NULL,    0, 0, 0 }
 };
 \f
-struct type ** const (f_builtin_types[]) = 
+struct type ** CONST_PTR (f_builtin_types[]) = 
 {
   &builtin_type_f_character,
   &builtin_type_f_logical,
index 61a95d8..17ab815 100644 (file)
@@ -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}
 };
index b25dda3..7200824 100644 (file)
@@ -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,
index 124022a..5c9e712 100644 (file)
@@ -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 ();
 
index c54b2c1..16739a0 100644 (file)
@@ -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;
 
index 08736aa..0bcc3a4 100644 (file)
@@ -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;