1998-10-13 Jason Molenda (jsm@bugshack.cygnus.com)
authorJason Molenda <jmolenda@apple.com>
Wed, 14 Oct 1998 01:15:00 +0000 (01:15 +0000)
committerJason Molenda <jmolenda@apple.com>
Wed, 14 Oct 1998 01:15:00 +0000 (01:15 +0000)
        * blockframe.c (find_pc_sect_partial_function): Add braces to avoid
        possible nested-if confusion.
        * breakpoint.c (breakpoint_here_p): Ditto.
        (breakpoint_inserted_here_p): Ditto.
        (breakpoint_thread_match): Ditto.

        * gnu-regex.c: Define _REGEX_RE_COMP only if it isn't already defined.
        * gnu-regex.h: Define _REGEX_RE_COMP to pick up old compatability
        prototypes.

        * symtab.h: Add prototype for _initialize_source.
        * value.h: Add prototype for _initialize_value.

        * defs.h: Include sys/types.h or stddef.h to get size_t.
        (make_cleanup): Add make_cleanup_func typedef and switch to using
        a prototype for this function.
        (mfree): Add prototypes for mmalloc, mrealloc, mfree if we aren't
        using mmalloc.

        * ax-gdb.c breakpoint.c coffread.c corelow.c dbxread.c dwarf2read.c
        dwarfread.c elfread.c eval.c exec.c gdbtk-cmds.c gdbtk.c infcmd.c
        infrun.c mipsread.c nlmread.c os9kread.c parse.c printcmd.c symfile.c
        symmisc.c symtab.c thread.c top.c tracepoint.c typeprint.c valops.c:
        Cast parameters passed to make_cleanup to use the new
        make_cleanup_func typedef.

More warning cleanups.  There are still a bunch of places where the first
argument to make_cleanup is not cast to (make_cleanup_func); these are
either due to the function fitting the make_cleanup_func specification
already (e.g. free()) or they are in files that weren't compiled when
I did my make on a Linux native system.  Bwahahaha.  You can see them
like this:

grep make_cleanup\  * | grep -v make_cleanup_func

I'll surely go back and clean up the remaining suspicious calls in
GDB one of these days. :-)

23 files changed:
gdb/ChangeLog
gdb/ax-gdb.c
gdb/blockframe.c
gdb/breakpoint.c
gdb/corelow.c
gdb/defs.h
gdb/dwarf2read.c
gdb/dwarfread.c
gdb/elfread.c
gdb/gdbtk-cmds.c
gdb/gdbtk.c
gdb/gnu-regex.c
gdb/gnu-regex.h
gdb/nlmread.c
gdb/os9kread.c
gdb/parse.c
gdb/printcmd.c
gdb/symtab.h
gdb/thread.c
gdb/top.c
gdb/tracepoint.c
gdb/typeprint.c
gdb/value.h

index 90bb232..09c6be5 100644 (file)
@@ -1,3 +1,31 @@
+1998-10-13  Jason Molenda  (jsm@bugshack.cygnus.com)
+
+       * blockframe.c (find_pc_sect_partial_function): Add braces to avoid
+       possible nested-if confusion.
+       * breakpoint.c (breakpoint_here_p): Ditto.
+       (breakpoint_inserted_here_p): Ditto.
+       (breakpoint_thread_match): Ditto.
+
+       * gnu-regex.c: Define _REGEX_RE_COMP only if it isn't already defined.
+       * gnu-regex.h: Define _REGEX_RE_COMP to pick up old compatability 
+       prototypes.
+       
+       * symtab.h: Add prototype for _initialize_source.
+       * value.h: Add prototype for _initialize_value.
+
+       * defs.h: Include sys/types.h or stddef.h to get size_t.
+       (make_cleanup): Add make_cleanup_func typedef and switch to using 
+        a prototype for this function.
+       (mfree): Add prototypes for mmalloc, mrealloc, mfree if we aren't
+       using mmalloc.
+       
+       * ax-gdb.c breakpoint.c coffread.c corelow.c dbxread.c dwarf2read.c 
+        dwarfread.c elfread.c eval.c exec.c gdbtk-cmds.c gdbtk.c infcmd.c 
+        infrun.c mipsread.c nlmread.c os9kread.c parse.c printcmd.c symfile.c 
+        symmisc.c symtab.c thread.c top.c tracepoint.c typeprint.c valops.c:   
+        Cast parameters passed to make_cleanup to use the new 
+        make_cleanup_func typedef.
+
 Tue Oct 13 00:51:48 1998  Felix Lee  <flee@cygnus.com>
 
        * sol-thread.c (ps_pstop, etc): different solaris versions have
index a55df32..de6f870 100644 (file)
@@ -1155,7 +1155,7 @@ gen_deref (ax, value)
      actually emit any code; we just change the type from "Pointer to
      T" to "T", and mark the value as an lvalue in memory.  Leave it
      to the consumer to actually dereference it.  */
-  value->type = TYPE_TARGET_TYPE (value->type);
+  value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
   value->kind = ((value->type->code == TYPE_CODE_FUNC)
                 ? axs_rvalue : axs_lvalue_memory);
 }
@@ -1782,7 +1782,7 @@ expr_to_agent (expr, value)
   struct agent_expr *ax = new_agent_expr ();
   union exp_element *pc;
 
-  old_chain = make_cleanup (free_agent_expr, ax);
+  old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
 
   pc = expr->elts;
   trace_kludge = 0;
@@ -1836,7 +1836,7 @@ gen_trace_for_expr (expr)
   union exp_element *pc;
   struct axs_value value;
 
-  old_chain = make_cleanup (free_agent_expr, ax);
+  old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
 
   pc = expr->elts;
   trace_kludge = 1;
@@ -1905,9 +1905,9 @@ agent_command (exp, from_tty)
     error_no_arg ("expression to translate");
   
   expr = parse_expression (exp);
-  old_chain = make_cleanup (free_current_contents, &expr);
+  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
   agent = gen_trace_for_expr (expr);
-  make_cleanup (free_agent_expr, agent);
+  make_cleanup ((make_cleanup_func) free_agent_expr, agent);
   ax_print (gdb_stdout, agent);
   ax_reqs (agent, &reqs);
 
index 85fd61f..9e042de 100644 (file)
@@ -1,6 +1,6 @@
 /* Get info from stack frames;
    convert between frames, blocks, functions and pc values.
-   Copyright 1986, 1987, 1988, 1989, 1991, 1994, 1995, 1996, 1997
+   Copyright 1986, 87, 88, 89, 91, 94, 95, 96, 97, 1998
              Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -807,14 +807,19 @@ find_pc_sect_partial_function (pc, section, name, address, endaddr)
   cache_pc_function_name    = SYMBOL_NAME (msymbol);
   cache_pc_function_section = section;
 
-  /* Use the lesser of the next minimal symbol in the same section, or the end
-     of the section, as the end of the function. Step over other symbols at 
-     this same address to find the next one.  */
+  /* Use the lesser of the next minimal symbol in the same section, or
+     the end of the section, as the end of the function.  */
+  
+  /* Step over other symbols at this same address, and symbols in
+     other sections, to find the next symbol in this section with
+     a different address.  */
 
-  for (i=1; SYMBOL_NAME (msymbol+i) != NULL 
-        && (SYMBOL_VALUE_ADDRESS(msymbol+i) == SYMBOL_VALUE_ADDRESS (msymbol)
-        || SYMBOL_BFD_SECTION(msymbol+i) != section);
-       i++) /* empty */;
+  for (i=1; SYMBOL_NAME (msymbol+i) != NULL; i++)
+    {
+      if (SYMBOL_VALUE_ADDRESS (msymbol+i) != SYMBOL_VALUE_ADDRESS (msymbol) 
+         && SYMBOL_BFD_SECTION (msymbol+i) == SYMBOL_BFD_SECTION (msymbol))
+       break;
+    }
 
   if (SYMBOL_NAME (msymbol + i) != NULL
       && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr)
@@ -827,27 +832,31 @@ find_pc_sect_partial_function (pc, section, name, address, endaddr)
  return_cached_value:
 
   if (address)
-    if (pc_in_unmapped_range (pc, section))
-      *address = overlay_unmapped_address (cache_pc_function_low, section);
-    else
-      *address = cache_pc_function_low;
+    {
+      if (pc_in_unmapped_range (pc, section))
+        *address = overlay_unmapped_address (cache_pc_function_low, section);
+      else
+        *address = cache_pc_function_low;
+    }
     
   if (name)
     *name = cache_pc_function_name;
 
   if (endaddr)
-    if (pc_in_unmapped_range (pc, section))
-      {
-       /* Because the high address is actually beyond the end of
-          the function (and therefore possibly beyond the end of
-          the overlay), we must actually convert (high - 1)
-          and then add one to that. */
+    {
+      if (pc_in_unmapped_range (pc, section))
+        {
+         /* Because the high address is actually beyond the end of
+            the function (and therefore possibly beyond the end of
+            the overlay), we must actually convert (high - 1)
+            and then add one to that. */
 
-       *endaddr = 1 + overlay_unmapped_address (cache_pc_function_high - 1, 
-                                                section);
-      }
-    else
-      *endaddr = cache_pc_function_high;
+         *endaddr = 1 + overlay_unmapped_address (cache_pc_function_high - 1, 
+                                                  section);
+        }
+      else
+        *endaddr = cache_pc_function_high;
+    }
 
   return 1;
 }
index 71799fa..6706bdd 100644 (file)
@@ -850,12 +850,14 @@ breakpoint_here_p (pc)
   ALL_BREAKPOINTS (b)
     if (b->enable == enabled
        && b->address == pc)    /* bp is enabled and matches pc */
-      if (overlay_debugging &&
-         section_is_overlay (b->section) &&
-         !section_is_mapped (b->section))
-       continue;               /* unmapped overlay -- can't be a match */
-      else
-       return 1;
+      {
+        if (overlay_debugging &&
+           section_is_overlay (b->section) &&
+           !section_is_mapped (b->section))
+         continue;             /* unmapped overlay -- can't be a match */
+        else
+         return 1;
+      }
 
   return 0;
 }
@@ -872,12 +874,14 @@ breakpoint_inserted_here_p (pc)
   ALL_BREAKPOINTS (b)
     if (b->inserted
        && b->address == pc)    /* bp is inserted and matches pc */
-      if (overlay_debugging &&
-         section_is_overlay (b->section) &&
-         !section_is_mapped (b->section))
-       continue;               /* unmapped overlay -- can't be a match */
-      else
-       return 1;
+      {
+        if (overlay_debugging &&
+           section_is_overlay (b->section) &&
+           !section_is_mapped (b->section))
+         continue;             /* unmapped overlay -- can't be a match */
+        else
+         return 1;
+      }
 
   return 0;
 }
@@ -935,12 +939,14 @@ breakpoint_thread_match (pc, pid)
        && b->enable != shlib_disabled
        && b->address == pc
        && (b->thread == -1 || b->thread == thread))
-      if (overlay_debugging &&
-         section_is_overlay (b->section) &&
-         !section_is_mapped (b->section))
-       continue;               /* unmapped overlay -- can't be a match */
-      else
-       return 1;
+      {
+        if (overlay_debugging &&
+           section_is_overlay (b->section) &&
+           !section_is_mapped (b->section))
+         continue;             /* unmapped overlay -- can't be a match */
+        else
+         return 1;
+      }
 
   return 0;
 }
@@ -2937,7 +2943,7 @@ until_break_command (arg, from_tty)
   
   breakpoint = set_momentary_breakpoint (sal, selected_frame, bp_until);
   
-  old_chain = make_cleanup(delete_breakpoint, breakpoint);
+  old_chain = make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
 
   /* Keep within the current frame */
   
@@ -2946,7 +2952,7 @@ until_break_command (arg, from_tty)
       sal = find_pc_line (prev_frame->pc, 0);
       sal.pc = prev_frame->pc;
       breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
-      make_cleanup(delete_breakpoint, breakpoint);
+      make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
     }
   
   proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
@@ -3929,6 +3935,8 @@ is valid is not currently in scope.\n", bpt->number);
         int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
         int mem_cnt = can_use_hardware_watchpoint (bpt->val);
 
+        /* Hack around 'unused var' error for some targets here */
+        (void) mem_cnt, i;
         target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
                 bpt->type, i + mem_cnt, other_type_used);
         /* we can consider of type is bp_hardware_watchpoint, convert to 
index 5090999..710caa0 100644 (file)
@@ -1,5 +1,5 @@
 /* Core dump and executable file functions below target vector, for GDB.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
+   Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 97, 1998
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -189,7 +189,7 @@ core_open (filename, from_tty)
       /* FIXME: should be checking for errors from bfd_close (for one thing,
         on error it does not free all the storage associated with the
         bfd).  */
-      make_cleanup (bfd_close, temp_bfd);
+      make_cleanup ((make_cleanup_func) bfd_close, temp_bfd);
       error ("\"%s\" is not a core dump: %s",
             filename, bfd_errmsg (bfd_get_error ()));
     }
@@ -199,7 +199,7 @@ core_open (filename, from_tty)
   discard_cleanups (old_chain);                /* Don't free filename any more */
   unpush_target (&core_ops);
   core_bfd = temp_bfd;
-  old_chain = make_cleanup (core_close, core_bfd);
+  old_chain = make_cleanup ((make_cleanup_func) core_close, core_bfd);
 
   validate_files ();
 
index aa5dd5f..94faff9 100644 (file)
@@ -1,5 +1,5 @@
 /* Basic, host-specific, and target-specific definitions for GDB.
-   Copyright (C) 1986, 1989, 1991, 1992, 1993, 1994, 1995, 1996
+   Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 1996, 1998
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -25,6 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <stdio.h>
 #include <errno.h>             /* System call error return status */
 
+#ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+#else
+#  include <sys/types.h>   /* for size_t */
+#endif
+
 /* Just in case they're not defined in stdio.h. */
 
 #ifndef SEEK_SET
@@ -52,7 +58,7 @@ extern char *strsignal PARAMS ((int));
 
 #include "progress.h"
 
-#ifndef NO_MMALLOC
+#ifdef USE_MMALLOC
 #include "mmalloc.h"
 #endif
 
@@ -134,7 +140,9 @@ enum language
    language_auto,              /* Placeholder for automatic setting */
    language_c,                         /* C */
    language_cplus,             /* C++ */
+   /* start-sanitize-java */
    language_java,              /* Java */
+   /* end-sanitize-java */
    language_chill,             /* Chill */
    language_fortran,           /* Fortran */
    language_m2,                        /* Modula-2 */
@@ -212,6 +220,8 @@ extern int inside_entry_file PARAMS ((CORE_ADDR addr));
 
 extern int inside_main_func PARAMS ((CORE_ADDR pc));
 
+extern void _initialize_blockframe PARAMS ((void));
+
 /* From ch-lang.c, for the moment. (FIXME) */
 
 extern char *chill_demangle PARAMS ((const char *));
@@ -238,25 +248,20 @@ extern void discard_cleanups PARAMS ((struct cleanup *));
 extern void discard_final_cleanups PARAMS ((struct cleanup *));
 extern void discard_my_cleanups PARAMS ((struct cleanup **, 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.
+typedef void (*make_cleanup_func) (void *);
 
-   Should be, once all calls and called-functions are cleaned up:
 extern struct cleanup *
-make_cleanup PARAMS ((void (*function) (void *), void *));
+make_cleanup PARAMS ((make_cleanup_func, void *));
 
-   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 *
 make_final_cleanup PARAMS ((void (*function) (void *), void *));
+
 extern struct cleanup *
 make_my_cleanup PARAMS ((struct cleanup **, void (*function) (void *), void *));
 
+extern struct cleanup *
+make_run_cleanup PARAMS ((void (*function) (void *), void *));
+
 extern struct cleanup *save_cleanups PARAMS ((void));
 extern struct cleanup *save_final_cleanups PARAMS ((void));
 extern struct cleanup *save_my_cleanups PARAMS ((struct cleanup **));
@@ -274,6 +279,12 @@ extern int myread PARAMS ((int, char *, int));
 extern int query PARAMS((char *, ...))
      ATTR_FORMAT(printf, 1, 2);
 
+#if !defined (USE_MMALLOC)
+extern PTR mmalloc PARAMS ((PTR, size_t));
+extern PTR mrealloc PARAMS ((PTR, PTR, size_t));
+extern void mfree PARAMS ((PTR, PTR));
+#endif
+
 /* From demangle.c */
 
 extern void set_demangling_style PARAMS ((char *));
@@ -301,6 +312,8 @@ extern void fputs_filtered PARAMS ((const char *, GDB_FILE *));
 
 extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *));
 
+extern int fputc_filtered PARAMS ((int c, GDB_FILE *));
+
 extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *));
 
 extern int putchar_unfiltered PARAMS ((int c));
@@ -368,6 +381,8 @@ extern NORETURN void perror_with_name PARAMS ((char *)) ATTR_NORETURN;
 
 extern void print_sys_errmsg PARAMS ((char *, int));
 
+extern void _initialize_stack PARAMS ((void));
+
 /* From regex.c or libc.  BSD 4.4 declares this with the argument type as
    "const char *" in unistd.h, so we can't declare the argument
    as "char *".  */
@@ -403,6 +418,8 @@ extern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *));
 
 extern void print_address PARAMS ((CORE_ADDR, GDB_FILE *));
 
+extern void _initialize_printcmd PARAMS ((void));
+
 /* From source.c */
 
 extern int openp PARAMS ((char *, int, char *, int, int, char **));
@@ -722,18 +739,23 @@ extern void free ();
 # ifdef __GNUC__
 #  define alloca __builtin_alloca
 # else /* Not GNU C */
-#  ifdef sparc
-#   include <alloca.h>         /* NOTE:  Doesn't declare alloca() */
-#  endif
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
 
 /* We need to be careful not to declare this in a way which conflicts with
    bison.  Bison never declares it as char *, but under various circumstances
    (like __hpux) we need to use void *.  */
-#  if defined (__STDC__) || defined (__hpux)
+#    if defined (__STDC__) || defined (__hpux)
    extern void *alloca ();
-#  else /* Don't use void *.  */
+#    else /* Don't use void *.  */
    extern char *alloca ();
-#  endif /* Don't use void *.  */
+#    endif /* Don't use void *.  */
+#   endif /* Not _AIX */
+#  endif /* Not HAVE_ALLOCA_H */
 # endif /* Not GNU C */
 #endif /* alloca not defined */
 
@@ -1024,7 +1046,8 @@ extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer,
 extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s,
                                                      int line, int stopline,
                                                      int noerror));
-extern int (*query_hook) PARAMS ((const char *, va_list));
+extern int  (*query_hook) PARAMS ((const char *, va_list));
+extern void (*warning_hook) PARAMS ((const char *, va_list));
 extern void (*flush_hook) PARAMS ((FILE *stream));
 extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b));
 extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
@@ -1035,7 +1058,8 @@ extern void (*registers_changed_hook) PARAMS ((void));
 extern void (*readline_begin_hook) PARAMS ((char *, ...));
 extern char * (*readline_hook) PARAMS ((char *));
 extern void (*readline_end_hook) PARAMS ((void));
-
+extern void (*pc_changed_hook) PARAMS ((void));
+extern void (*context_hook) PARAMS ((int));
 extern int (*target_wait_hook) PARAMS ((int pid,
                                        struct target_waitstatus *status));
 
index dffc621..ea0af40 100644 (file)
@@ -1304,7 +1304,7 @@ psymtab_to_symtab_1 (pst)
   back_to = make_cleanup (dwarf2_free_tmp_obstack, NULL);
 
   buildsym_init ();
-  make_cleanup (really_free_pendings, NULL);
+  make_cleanup ((make_cleanup_func) really_free_pendings, NULL);
 
   /* read in the comp_unit header  */
   cu_header.length = read_4_bytes (abfd, info_ptr);
@@ -1322,7 +1322,7 @@ psymtab_to_symtab_1 (pst)
 
   dies = read_comp_unit (info_ptr, abfd);
 
-  make_cleanup (free_die_list, dies);
+  make_cleanup ((make_cleanup_func) free_die_list, dies);
 
   /* Do line number decoding in read_file_scope () */
   process_die (dies, objfile);
@@ -2070,7 +2070,8 @@ dwarf2_add_member_fn (fip, die, type, objfile)
                      (fip->nfnfields + DW_FIELD_ALLOC_CHUNK)
                        * sizeof (struct fnfieldlist));
          if (fip->nfnfields == 0)
-           make_cleanup (free_current_contents, &fip->fnfieldlists);
+           make_cleanup ((make_cleanup_func) free_current_contents, 
+                          &fip->fnfieldlists);
        }
       flp = &fip->fnfieldlists[fip->nfnfields];
       flp->name = fieldname;
@@ -2576,7 +2577,8 @@ read_array_type (die, objfile)
                xrealloc (range_types, (ndim + DW_FIELD_ALLOC_CHUNK)
                                         * sizeof (struct type *));
              if (ndim == 0)
-               make_cleanup (free_current_contents, &range_types);
+               make_cleanup ((make_cleanup_func) free_current_contents, 
+                              &range_types);
            }
          range_types[ndim++] = create_range_type (NULL, index_type, low, high);
        }
@@ -3828,7 +3830,8 @@ dwarf_decode_lines (offset, comp_dir, abfd)
   line_ptr += 1;
   lh.standard_opcode_lengths = (unsigned char *)
     xmalloc (lh.opcode_base * sizeof (unsigned char));
-  back_to = make_cleanup (free_current_contents, &lh.standard_opcode_lengths);
+  back_to = make_cleanup ((make_cleanup_func) free_current_contents, 
+                          &lh.standard_opcode_lengths);
 
   lh.standard_opcode_lengths[0] = 1;
   for (i = 1; i < lh.opcode_base; ++i)
@@ -3847,7 +3850,7 @@ dwarf_decode_lines (offset, comp_dir, abfd)
            xrealloc (dirs.dirs,
                      (dirs.num_dirs + DIR_ALLOC_CHUNK) * sizeof (char *));
          if (dirs.num_dirs == 0)
-           make_cleanup (free_current_contents, &dirs.dirs);
+           make_cleanup ((make_cleanup_func) free_current_contents, &dirs.dirs);
        }
       dirs.dirs[dirs.num_dirs++] = cur_dir;
     }
@@ -3864,7 +3867,8 @@ dwarf_decode_lines (offset, comp_dir, abfd)
                      (files.num_files + FILE_ALLOC_CHUNK)
                        * sizeof (struct fileinfo));
          if (files.num_files == 0)
-           make_cleanup (free_current_contents, &files.files);
+           make_cleanup ((make_cleanup_func) free_current_contents, 
+                          &files.files);
        }
       files.files[files.num_files].name = cur_file;
       files.files[files.num_files].dir =
@@ -3934,7 +3938,8 @@ dwarf_decode_lines (offset, comp_dir, abfd)
                                  (files.num_files + FILE_ALLOC_CHUNK)
                                    * sizeof (struct fileinfo));
                      if (files.num_files == 0)
-                       make_cleanup (free_current_contents, &files.files);
+                       make_cleanup ((make_cleanup_func) free_current_contents, 
+                                      &files.files);
                    }
                  files.files[files.num_files].name = cur_file;
                  files.files[files.num_files].dir =
index eb95b1a..9de0312 100644 (file)
@@ -1,5 +1,5 @@
 /* DWARF debugging format support for GDB.
-   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996
+   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998
    Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support.  Portions based on dbxread.c,
    mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
@@ -2452,7 +2452,8 @@ psymtab_to_symtab_1 (pst)
          if (DBLENGTH (pst))           /* Otherwise it's a dummy */
            {
              buildsym_init ();
-             old_chain = make_cleanup (really_free_pendings, 0);
+             old_chain = make_cleanup ((make_cleanup_func) 
+                                        really_free_pendings, 0);
              read_ofile_symtab (pst);
              if (info_verbose)
                {
index 2669e97..417039e 100644 (file)
@@ -1,5 +1,5 @@
 /* Read ELF (Executable and Linking Format) object files for GDB.
-   Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support.
 
 This file is part of GDB.
@@ -591,7 +591,7 @@ elf_symfile_read (objfile, section_offsets, mainline)
   CORE_ADDR offset;
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup (discard_minimal_symbols, 0);
+  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
 
   memset ((char *) &ei, 0, sizeof (ei));
 
index c7203d3..00e69dd 100644 (file)
@@ -616,7 +616,7 @@ gdb_eval (clientData, interp, objc, objv)
 
   expr = parse_expression (Tcl_GetStringFromObj (objv[1], NULL));
 
-  old_chain = make_cleanup (free_current_contents, &expr);
+  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
 
   val = evaluate_expression (expr);
 
@@ -816,7 +816,7 @@ gdb_load_info (clientData, interp, objc, objv)
        Tcl_SetStringObj (result_ptr->obj_ptr, "Open failed", -1);
        return TCL_ERROR;
      }
-   old_cleanups = make_cleanup (bfd_close, loadfile_bfd);
+   old_cleanups = make_cleanup ((make_cleanup_func) bfd_close, loadfile_bfd);
    
    if (!bfd_check_format (loadfile_bfd, bfd_object)) 
      {
@@ -1370,7 +1370,7 @@ gdb_search (clientData, interp, objc, objv)
 
   search_symbols (regexp, space, nfiles, files, &ss);
   if (ss != NULL)
-    old_chain = make_cleanup (free_search_symbols, ss);
+    old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, ss);
 
   Tcl_SetListObj(result_ptr->obj_ptr, 0, NULL);  
 
index c59821f..d1760a6 100644 (file)
@@ -339,7 +339,7 @@ gdbtk_init ( argv0 )
     return;
 #endif
 
-  old_chain = make_cleanup (cleanup_init, 0);
+  old_chain = make_cleanup ((make_cleanup_func) cleanup_init, 0);
 
   /* First init tcl and tk. */
   Tcl_FindExecutable (argv0); 
index 846250a..547668e 100644 (file)
@@ -142,8 +142,10 @@ char *realloc ();
 /* How many characters in the character set.  */
 # define CHAR_SET_SIZE 256
 
-/* CYGNUS LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
+/* GDB LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
+#ifndef _REGEX_RE_COMP
 #define _REGEX_RE_COMP
+#endif
 
 # ifdef SYNTAX_TABLE
 
index 57a4f14..9153ea1 100644 (file)
@@ -36,6 +36,11 @@ extern "C" {
 # include <stddef.h>
 #endif
 
+/* GDB LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
+#ifndef _REGEX_RE_COMP
+#define _REGEX_RE_COMP
+#endif
+
 /* The following two types have to be signed and unsigned integer type
    wide enough to hold a value of a pointer.  For most ANSI compilers
    ptrdiff_t and size_t should be likely OK.  Still size of these two
index fa588df..afdea43 100644 (file)
@@ -1,5 +1,5 @@
 /* Read NLM (NetWare Loadable Module) format executable files for GDB.
-   Copyright 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1998 Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support (fnf@cygnus.com).
 
 This file is part of GDB.
@@ -190,7 +190,7 @@ nlm_symfile_read (objfile, section_offsets, mainline)
   struct symbol *mainsym;
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup (discard_minimal_symbols, 0);
+  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
 
   /* FIXME, should take a section_offsets param, not just an offset.  */
 
index ef96f86..673d415 100644 (file)
@@ -1,5 +1,5 @@
 /* Read os9/os9k symbol tables and convert to internal format, for GDB.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996
+   Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 96, 1998
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -333,9 +333,9 @@ os9k_symfile_read (objfile, section_offsets, mainline)
     init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
 
   free_pending_blocks ();
-  back_to = make_cleanup (really_free_pendings, 0);
+  back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
 
-  make_cleanup (discard_minimal_symbols, 0);
+  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
   read_minimal_symbols (objfile, section_offsets);
 
   /* Now that the symbol table data of the executable file are all in core,
@@ -1209,7 +1209,7 @@ os9k_psymtab_to_symtab_1 (pst)
       /* Init stuff necessary for reading in symbols */
       stabsread_init ();
       buildsym_init ();
-      old_chain = make_cleanup (really_free_pendings, 0);
+      old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
 
       /* Read in this file's symbols */
       os9k_read_ofile_symtab (pst);
index a7cd80d..2d4a629 100644 (file)
@@ -1,5 +1,5 @@
 /* Parse expressions for GDB.
-   Copyright (C) 1986, 1989, 1990, 1991, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1986, 89, 90, 91, 94, 1998 Free Software Foundation, Inc.
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
 
@@ -886,7 +886,7 @@ parse_exp_1 (stringptr, block, comma)
   if (lexptr == 0 || *lexptr == 0)
     error_no_arg ("expression to compute");
 
-  old_chain = make_cleanup (free_funcalls, 0);
+  old_chain = make_cleanup ((make_cleanup_func) free_funcalls, 0);
   funcall_chain = 0;
 
   expression_context_block = block ? block : get_selected_block ();
@@ -897,7 +897,7 @@ parse_exp_1 (stringptr, block, comma)
   expout = (struct expression *)
     xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size));
   expout->language_defn = current_language;
-  make_cleanup (free_current_contents, &expout);
+  make_cleanup ((make_cleanup_func) free_current_contents, &expout);
 
   if (current_language->la_parser ())
     current_language->la_error (NULL);
index 7d0f3a5..6d475c9 100644 (file)
@@ -1,5 +1,5 @@
 /* Print values for GNU debugger GDB.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1995
+   Copyright 1986, 87, 88, 89, 90, 91, 93, 94, 95, 1998
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -175,6 +175,8 @@ static struct format_data decode_format PARAMS ((char **, int, int));
 
 static int print_insn PARAMS ((CORE_ADDR, GDB_FILE *));
 
+static void sym_info PARAMS ((char *, int));
+
 \f
 /* Decode a format specification.  *STRING_PTR should point to it.
    OFORMAT and OSIZE are used as defaults for the format and size
@@ -830,7 +832,8 @@ print_command_1 (exp, inspect, voidprint)
       extern int objectprint;
       struct type *type;
       expr = parse_expression (exp);
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       cleanup = 1;
       val = evaluate_expression (expr);
 
@@ -943,7 +946,7 @@ output_command (exp, from_tty)
     }
 
   expr = parse_expression (exp);
-  old_chain = make_cleanup (free_current_contents, &expr);
+  old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
 
   val = evaluate_expression (expr);
 
@@ -964,7 +967,7 @@ set_command (exp, from_tty)
 {
   struct expression *expr = parse_expression (exp);
   register struct cleanup *old_chain
-    = make_cleanup (free_current_contents, &expr);
+    = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
   evaluate_expression (expr);
   do_cleanups (old_chain);
 }
@@ -1241,7 +1244,8 @@ x_command (exp, from_tty)
         But don't clobber a user-defined command's definition.  */
       if (from_tty)
        *exp = 0;
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       val = evaluate_expression (expr);
       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
        val = value_ind (val);
@@ -1928,7 +1932,8 @@ printf_command (arg, from_tty)
   struct cleanup *old_cleanups;
 
   val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
-  old_cleanups = make_cleanup (free_current_contents, &val_args);
+  old_cleanups = make_cleanup ((make_cleanup_func) free_current_contents, 
+                               &val_args);
 
   if (s == 0)
     error_no_arg ("format-control string and values to print");
@@ -2198,7 +2203,6 @@ disassemble_command (arg, from_tty)
   char *name;
   CORE_ADDR pc, pc_masked;
   char *space_index;
-  asection *section;
 
   name = NULL;
   if (!arg)
index 4bf17d7..977a99d 100644 (file)
@@ -1,5 +1,6 @@
 /* Symbol table definitions for GDB.
-   Copyright 1986, 1989, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1986, 89, 91, 92, 93, 94, 95, 96, 1998
+             Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -27,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define obstack_chunk_free free
 #include "bcache.h"
 
+#include "gnu-regex.h"
+
 /* Don't do this; it means that if some .o's are compiled with GNU C
    and some are not (easy to do accidentally the way we configure
    things; also it is a pain to have to "make clean" every time you
@@ -84,7 +87,10 @@ struct general_symbol_info
 
   union
     {
-      struct cplus_specific      /* For C++ and Java */
+      struct cplus_specific      /* For C++ */
+                               /* start-sanitize-java */
+                               /*  and Java */
+                               /* end-sanitize-java */
        {
          char *demangled_name;
        } cplus_specific;
@@ -136,7 +142,10 @@ extern CORE_ADDR symbol_overlayed_address PARAMS((CORE_ADDR, asection *));
   do {                                                                 \
     SYMBOL_LANGUAGE (symbol) = language;                               \
     if (SYMBOL_LANGUAGE (symbol) == language_cplus                     \
-       || SYMBOL_LANGUAGE (symbol) == language_java)                   \
+       /* start-sanitize-java */                                       \
+       || SYMBOL_LANGUAGE (symbol) == language_java                    \
+       /* end-sanitize-java */                                         \
+       )                                                               \
       {                                                                        \
        SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL;                    \
       }                                                                        \
@@ -180,6 +189,7 @@ extern CORE_ADDR symbol_overlayed_address PARAMS((CORE_ADDR, asection *));
            SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL;                \
          }                                                             \
       }                                                                        \
+  /* start-sanitize-java */                                            \
     if (SYMBOL_LANGUAGE (symbol) == language_java)                     \
       {                                                                        \
        demangled =                                                     \
@@ -197,6 +207,7 @@ extern CORE_ADDR symbol_overlayed_address PARAMS((CORE_ADDR, asection *));
            SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL;                \
          }                                                             \
       }                                                                        \
+  /* end-sanitize-java */                                              \
     if (demangled == NULL                                              \
        && (SYMBOL_LANGUAGE (symbol) == language_chill                  \
            || SYMBOL_LANGUAGE (symbol) == language_auto))              \
@@ -226,7 +237,9 @@ extern CORE_ADDR symbol_overlayed_address PARAMS((CORE_ADDR, asection *));
 
 #define SYMBOL_DEMANGLED_NAME(symbol)                                  \
   (SYMBOL_LANGUAGE (symbol) == language_cplus                          \
+   /* start-sanitize-java */                                           \
    || SYMBOL_LANGUAGE (symbol) == language_java                                \
+   /* end-sanitize-java */                                             \
    ? SYMBOL_CPLUS_DEMANGLED_NAME (symbol)                              \
    : (SYMBOL_LANGUAGE (symbol) == language_chill                       \
       ? SYMBOL_CHILL_DEMANGLED_NAME (symbol)                           \
@@ -300,14 +313,17 @@ struct minimal_symbol
 
   struct general_symbol_info ginfo;
 
-  /* The info field is available for caching machine-specific information that
-     The AMD 29000 tdep.c uses it to remember things it has decoded from the
-     instructions in the function header, so it doesn't have to rederive the
-     info constantly (over a serial line).  It is initialized to zero and
-     stays that way until target-dependent code sets it.  Storage for any data
-     pointed to by this field should be allocated on the symbol_obstack for
-     the associated objfile.  The type would be "void *" except for reasons
-     of compatibility with older compilers.  This field is optional. */
+  /* The info field is available for caching machine-specific information
+     so it doesn't have to rederive the info constantly (over a serial line).
+     It is initialized to zero and stays that way until target-dependent code
+     sets it.  Storage for any data pointed to by this field should be allo-
+     cated on the symbol_obstack for the associated objfile.  
+     The type would be "void *" except for reasons of compatibility with older
+     compilers.  This field is optional.
+
+     Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
+     from the instructions in the function header, and the MIPS-16 code uses
+     it to identify 16-bit procedures.  */
 
   char *info;
 
@@ -481,7 +497,24 @@ typedef enum
   /* LABEL_NAMESPACE may be used for names of labels (for gotos);
      currently it is not used and labels are not recorded at all.  */
 
-  LABEL_NAMESPACE
+  LABEL_NAMESPACE,
+
+  /* Searching namespaces. These overlap with VAR_NAMESPACE, providing
+     some granularity with the search_symbols function. */
+
+  /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and
+     METHODS_NAMESPACE */
+  VARIABLES_NAMESPACE,
+
+  /* All functions -- for some reason not methods, though. */
+  FUNCTIONS_NAMESPACE,
+
+  /* All defined types */
+  TYPES_NAMESPACE,
+
+  /* All class methods -- why is this separated out? */
+  METHODS_NAMESPACE
+
 } namespace_enum;
 
 /* An address-class says where to find the value of a symbol.  */
@@ -605,13 +638,20 @@ enum address_class
 
 /* Linked list of symbol's live ranges. */
 
-struct live_range              
+struct range_list              
 {
   CORE_ADDR start;
   CORE_ADDR end;
-  struct live_range *next;     
+  struct range_list *next;     
 };
 
+/* Linked list of aliases for a particular main/primary symbol.  */
+struct alias_list
+  {
+    struct symbol *sym;
+    struct alias_list *next;
+  };
+
 struct symbol
 {
 
@@ -652,34 +692,24 @@ struct symbol
     }
   aux_value;
 
-  /* Live range information (if present) for debugging of optimized code.  
-     Gcc extensions were added to stabs to encode live range information.
-     The syntax for referencing (defining) symbol aliases is "#n" ("#n=")
-     where n is a number.  The syntax for specifying a range is "l(#<m>,#<n>)",
-     where m and n are numbers. 
-     aliases - list of other symbols which are lexically the same symbol, 
-         but were optimized into different storage classes (eg. for the
-         local symbol "x", one symbol contains range information where x 
-         is on the stack, while an alias contains the live ranges where x 
-         is in a register).
-     range - list of instruction ranges where the symbol is live. */
-  struct live_range_info               
-    {
-      struct symbol *aliases;  /* Link to other aliases for this symbol. */
-      struct live_range        *range; /* Linked list of live ranges. */
-    } live;
+
+  /* Link to a list of aliases for this symbol.
+     Only a "primary/main symbol may have aliases.  */
+  struct alias_list *aliases;
+
+  /* List of ranges where this symbol is active.  This is only
+     used by alias symbols at the current time.  */
+  struct range_list *ranges;
 };
 
+
 #define SYMBOL_NAMESPACE(symbol)       (symbol)->namespace
 #define SYMBOL_CLASS(symbol)           (symbol)->aclass
 #define SYMBOL_TYPE(symbol)            (symbol)->type
 #define SYMBOL_LINE(symbol)            (symbol)->line
 #define SYMBOL_BASEREG(symbol)         (symbol)->aux_value.basereg
-#define SYMBOL_ALIASES(symbol)         (symbol)->live.aliases
-#define SYMBOL_RANGE(symbol)           (symbol)->live.range 
-#define SYMBOL_RANGE_START(symbol)     (symbol)->live.range->start
-#define SYMBOL_RANGE_END(symbol)       (symbol)->live.range->end
-#define SYMBOL_RANGE_NEXT(symbol)      (symbol)->live.range->next
+#define SYMBOL_ALIASES(symbol)         (symbol)->aliases
+#define SYMBOL_RANGES(symbol)          (symbol)->ranges
 \f
 /* A partial_symbol records the name, namespace, and address class of
    symbols whose types we have not parsed yet.  For functions, it also
@@ -877,14 +907,6 @@ struct symtab
 
     struct objfile *objfile;
 
-    /* Anything extra for this symtab.  This is for target machines
-       with special debugging info of some sort (which cannot just
-       be represented in a normal symtab).  */
-
-#if defined (EXTRA_SYMTAB_INFO)
-    EXTRA_SYMTAB_INFO
-#endif
-
   };
 
 #define BLOCKVECTOR(symtab)    (symtab)->blockvector
@@ -1098,12 +1120,17 @@ find_pc_sect_function PARAMS ((CORE_ADDR, asection *));
   
 /* lookup function from address, return name, start addr and end addr */
 
-extern int find_pc_partial_function PARAMS ((CORE_ADDR, char **, 
+extern int 
+find_pc_partial_function PARAMS ((CORE_ADDR, char **,
                                             CORE_ADDR *, CORE_ADDR *));
 
 extern void
 clear_pc_function_cache PARAMS ((void));
 
+extern int 
+find_pc_sect_partial_function PARAMS ((CORE_ADDR, asection *, 
+                                       char **, CORE_ADDR *, CORE_ADDR *));
+
 /* from symtab.c: */
 
 /* lookup partial symbol table by filename */
@@ -1263,8 +1290,8 @@ find_addr_symbol PARAMS ((CORE_ADDR, struct symtab **, CORE_ADDR *));
 
 /* Given a symtab and line number, return the pc there.  */
 
-extern CORE_ADDR
-find_line_pc PARAMS ((struct symtab *, int));
+extern int
+find_line_pc PARAMS ((struct symtab *, int, CORE_ADDR *));
 
 extern int 
 find_line_pc_range PARAMS ((struct symtab_and_line,
@@ -1341,6 +1368,8 @@ select_source_symtab PARAMS ((struct symtab *));
 
 extern char **make_symbol_completion_list PARAMS ((char *, char *));
 
+extern void _initialize_source PARAMS ((void));
+
 /* symtab.c */
 
 extern struct partial_symtab *
@@ -1351,10 +1380,10 @@ find_main_psymtab PARAMS ((void));
 extern struct blockvector *
 blockvector_for_pc PARAMS ((CORE_ADDR, int *));
 
-
 extern struct blockvector *
 blockvector_for_pc_sect PARAMS ((CORE_ADDR, asection *, int *, 
                                 struct symtab *));
+
 /* symfile.c */
 
 extern void
@@ -1371,4 +1400,32 @@ in_prologue PARAMS ((CORE_ADDR pc, CORE_ADDR func_start));
 extern struct symbol *
 fixup_symbol_section PARAMS ((struct symbol  *, struct objfile *));
 
+/* Symbol searching */
+
+/* When using search_symbols, a list of the following structs is returned.
+   Callers must free the search list using free_symbol_search! */
+struct symbol_search
+{
+  /* The block in which the match was found. Could be, for example,
+     STATIC_BLOCK or GLOBAL_BLOCK. */
+  int block;
+
+  /* Information describing what was found.
+
+     If symtab abd symbol are NOT NULL, then information was found
+     for this match. */
+  struct symtab *symtab;
+  struct symbol *symbol;
+
+  /* If msymbol is non-null, then a match was made on something for
+     which only minimal_symbols exist. */
+  struct minimal_symbol *msymbol;
+
+  /* A link to the next match, or NULL for the end. */
+  struct symbol_search *next;
+};
+
+extern void search_symbols PARAMS ((char *, namespace_enum, int, char **, struct symbol_search **));
+extern void free_search_symbols PARAMS ((struct symbol_search *));
+
 #endif /* !defined(SYMTAB_H) */
index dba6621..23202db 100644 (file)
@@ -417,7 +417,8 @@ thread_apply_all_command (cmd, from_tty)
   if (cmd == NULL || *cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup (restore_current_thread, inferior_pid);
+  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread, 
+                            (void *) inferior_pid);
 
   for (tp = thread_list; tp; tp = tp->next)
     if (thread_alive (tp))
@@ -446,7 +447,8 @@ thread_apply_command (tidlist, from_tty)
   if (*cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup (restore_current_thread, inferior_pid);
+  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread, 
+                            (void *) inferior_pid);
 
   while (tidlist < cmd)
     {
index d666f43..18be649 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -641,7 +641,7 @@ read_command_file (stream)
 {
   struct cleanup *cleanups;
 
-  cleanups = make_cleanup (source_cleanup, instream);
+  cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream);
   instream = stream;
   command_loop ();
   do_cleanups (cleanups);
@@ -722,7 +722,7 @@ get_command_line (type, arg)
   /* Allocate and build a new command line structure.  */
   cmd = build_command_line (type, arg);
 
-  old_chain = make_cleanup (free_command_lines, &cmd);
+  old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd);
 
   /* Read in the body of this command.  */
   if (recurse_read_control_structure (cmd) == invalid_control)
@@ -839,7 +839,8 @@ execute_control_command (cmd)
       new_line = insert_args (cmd->line);
       if (!new_line)
        return invalid_control;
-      old_chain = make_cleanup (free_current_contents, &new_line);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &new_line);
       execute_command (new_line, 0);
       ret = cmd->control_type;
       break;
@@ -857,9 +858,10 @@ execute_control_command (cmd)
        new_line = insert_args (cmd->line);
        if (!new_line)
          return invalid_control;
-       old_chain = make_cleanup (free_current_contents, &new_line);
+       old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                  &new_line);
        expr = parse_expression (new_line);
-       make_cleanup (free_current_contents, &expr);
+       make_cleanup ((make_cleanup_func) free_current_contents, &expr);
        
        ret = simple_control;
        loop = 1;
@@ -917,10 +919,11 @@ execute_control_command (cmd)
        new_line = insert_args (cmd->line);
        if (!new_line)
          return invalid_control;
-       old_chain = make_cleanup (free_current_contents, &new_line);
+       old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                  &new_line);
        /* Parse the conditional for the if statement.  */
        expr = parse_expression (new_line);
-       make_cleanup (free_current_contents, &expr);
+       make_cleanup ((make_cleanup_func) free_current_contents, &expr);
 
        current = NULL;
        ret = simple_control;
@@ -1033,7 +1036,7 @@ setup_user_args (p)
   args->next = user_args;
   user_args = args;
 
-  old_chain = make_cleanup (arg_cleanup, 0);
+  old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0);
 
   if (p == NULL)
     return old_chain;
@@ -1197,7 +1200,7 @@ execute_user_command (c, args)
 
   /* Set the instream to 0, indicating execution of a
      user-defined function.  */
-  old_chain = make_cleanup (source_cleanup, instream);
+  old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream);
   instream = (FILE *) 0;
   while (cmdlines)
     {
@@ -1331,7 +1334,7 @@ command_loop ()
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
-      old_chain = make_cleanup (command_loop_marker, 0);
+      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
       command = command_line_input (instream == stdin ? prompt : (char *) NULL,
                                    instream == stdin, "prompt");
       if (command == 0)
@@ -2502,7 +2505,8 @@ int from_tty;
       else
        {
          head = next;
-         old_chain = make_cleanup (free_command_lines, &head);
+         old_chain = make_cleanup ((make_cleanup_func) free_command_lines, 
+                                    &head);
        }
       tail = next;
     }
@@ -3110,7 +3114,7 @@ source_command (args, from_tty)
     else
       return;
 
-  make_cleanup (fclose, stream);
+  make_cleanup ((make_cleanup_func) fclose, stream);
 
   old_lines.old_line = source_line_number;
   old_lines.old_file = source_file_name;
index 2a9e7db..d7978dd 100644 (file)
@@ -1,5 +1,5 @@
 /* Tracing functionality for remote targets in custom GDB protocol
-   Copyright 1997 Free Software Foundation, Inc.
+   Copyright 1997, 1998 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -847,7 +847,7 @@ read_actions (t)
   if (job_control)
     signal (STOP_SIGNAL, stop_sig);
 #endif
-  old_chain = make_cleanup (free_actions, (void *) t);
+  old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t);
   while (1)
     {
       /* Make sure that all output has been output.  Some machines may let
@@ -969,7 +969,8 @@ validate_actionline (line, t)
            /* else fall thru, treat p as an expression and parse it! */
          }
        exp   = parse_exp_1 (&p, block_for_pc (t->address), 1);
-       old_chain = make_cleanup (free_current_contents, &exp);
+       old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                  &exp);
 
        if (exp->elts[0].opcode == OP_VAR_VALUE)
          if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST)
@@ -989,7 +990,7 @@ validate_actionline (line, t)
        /* we have something to collect, make sure that the expr to
           bytecode translator can handle it and that it's not too long */
        aexpr = gen_trace_for_expr(exp);
-       (void) make_cleanup (free_agent_expr, aexpr);
+       (void) make_cleanup ((make_cleanup_func) free_agent_expr, aexpr);
 
        if (aexpr->len > MAX_AGENT_EXPR_LEN)
          error ("expression too complicated, try simplifying");
@@ -1522,7 +1523,8 @@ encode_actions (t, tdp_actions, stepping_actions)
                struct agent_reqs areqs;
 
                exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1);
-               old_chain = make_cleanup (free_current_contents, &exp);
+               old_chain = make_cleanup ((make_cleanup_func) 
+                                          free_current_contents, &exp);
 
                switch (exp->elts[0].opcode) {
                case OP_REGISTER:
@@ -1547,7 +1549,8 @@ encode_actions (t, tdp_actions, stepping_actions)
                default:        /* full-fledged expression */
                  aexpr = gen_trace_for_expr (exp);
 
-                 old_chain1 = make_cleanup (free_agent_expr, aexpr);
+                 old_chain1 = make_cleanup ((make_cleanup_func) 
+                                             free_agent_expr, aexpr);
 
                  ax_reqs (aexpr, &areqs);
                  if (areqs.flaw != agent_flaw_none)
index 6b1c6de..144df82 100644 (file)
@@ -1,5 +1,5 @@
 /* Language independent support for printing types for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1986, 88, 89, 91, 92, 93, 1998 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -78,7 +78,8 @@ whatis_exp (exp, show)
   if (exp)
     {
       expr = parse_expression (exp);
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       val = evaluate_type (expr);
     }
   else
@@ -140,7 +141,8 @@ ptype_command (typename, from_tty)
   else
     {
       expr = parse_expression (typename);
-      old_chain = make_cleanup (free_current_contents, &expr);
+      old_chain = make_cleanup ((make_cleanup_func) free_current_contents, 
+                                &expr);
       type = ptype_eval (expr);
       if (type != NULL)
        {
@@ -262,7 +264,7 @@ maintenance_print_type (typename, from_tty)
   if (typename != NULL)
   {
     expr = parse_expression (typename);
-    old_chain = make_cleanup (free_current_contents, &expr);
+    old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr);
     if (expr -> elts[0].opcode == OP_TYPE)
       {
        /* The user expression names a type directly, just use that type. */
index 7ebd041..ae2545a 100644 (file)
@@ -101,6 +101,8 @@ struct value
     /* If nonzero, this is the value of a variable which does not
        actually exist in the program.  */
     char optimized_out;
+    /* The BFD section associated with this value.  */
+    asection *bfd_section;
     /* Actual contents of the value.  For use of this value; setting
        it uses the stuff above.  Not valid if lazy is nonzero.
        Target byte-order.  We force it to be aligned properly for any
@@ -111,7 +113,6 @@ struct value
       LONGEST force_longlong_align;
       char *literal_data;
     } aligner;
-
   };
 
 typedef struct value *value_ptr;
@@ -141,16 +142,18 @@ extern int value_fetch_lazy PARAMS ((value_ptr val));
 #define VALUE_NEXT(val) (val)->next
 #define VALUE_REGNO(val) (val)->regno
 #define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
+#define VALUE_BFD_SECTION(val) ((val)->bfd_section)
 
 /* Convert a REF to the object referenced. */
 
 #define COERCE_REF(arg)    \
-do { CHECK_TYPEDEF (VALUE_TYPE (arg));                                  \
-     if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF)                        \
-     arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)),         \
-                         unpack_long (VALUE_TYPE (arg),                \
-                                      VALUE_CONTENTS (arg)));          \
-} while (0)
+do { struct type *value_type_arg_tmp = check_typedef (VALUE_TYPE (arg));\
+     if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)              \
+        arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),    \
+                             unpack_long (VALUE_TYPE (arg),            \
+                                          VALUE_CONTENTS (arg)),       \
+                             VALUE_BFD_SECTION (arg));                 \
+    } while (0)
 
 /* If ARG is an array, convert it to a pointer.
    If ARG is an enum, convert it to an integer.
@@ -177,7 +180,7 @@ do { COERCE_REF(arg);                                                       \
 /* If ARG is an enum, convert it to an integer.  */
 
 #define COERCE_ENUM(arg)   { \
-  if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM)                  \
+  if (TYPE_CODE (check_typedef (VALUE_TYPE (arg))) == TYPE_CODE_ENUM)  \
     arg = value_cast (builtin_type_unsigned_int, arg);                 \
 }
 
@@ -230,9 +233,9 @@ extern value_ptr value_from_longest PARAMS ((struct type *type, LONGEST num));
 
 extern value_ptr value_from_double PARAMS ((struct type *type, DOUBLEST num));
 
-extern value_ptr value_at PARAMS ((struct type *type, CORE_ADDR addr));
+extern value_ptr value_at PARAMS ((struct type *type, CORE_ADDR addr, asection *sect));
 
-extern value_ptr value_at_lazy PARAMS ((struct type *type, CORE_ADDR addr));
+extern value_ptr value_at_lazy PARAMS ((struct type *type, CORE_ADDR addr, asection *sect));
 
 extern value_ptr value_from_register PARAMS ((struct type *type, int regnum,
                                          struct frame_info * frame));
@@ -297,6 +300,8 @@ extern value_ptr value_struct_elt_for_reference PARAMS ((struct type *domain,
                                                         char *name,
                                                         struct type *intype));
 
+extern value_ptr value_static_field PARAMS ((struct type *type, int fieldno));
+
 extern value_ptr value_field PARAMS ((value_ptr arg1, int fieldno));
 
 extern value_ptr value_primitive_field PARAMS ((value_ptr arg1, int offset,
@@ -412,10 +417,16 @@ read_register_gen PARAMS ((int regno, char *myaddr));
 extern CORE_ADDR
 read_register PARAMS ((int regno));
 
+extern CORE_ADDR
+read_register_pid PARAMS ((int regno, int pid));
+
 extern void
 write_register PARAMS ((int regno, LONGEST val));
 
 extern void
+write_register_pid PARAMS ((int regno, LONGEST val, int pid));
+
+extern void
 supply_register PARAMS ((int regno, char *val));
 
 extern void
@@ -457,7 +468,7 @@ val_print PARAMS ((struct type *type, char *valaddr, CORE_ADDR address,
                   int recurse, enum val_prettyprint pretty));
 
 extern int
-val_print_string PARAMS ((CORE_ADDR addr, unsigned int len, GDB_FILE *stream));
+val_print_string PARAMS ((CORE_ADDR addr, int len, int width, GDB_FILE *stream));
 
 extern void
 print_variable_value PARAMS ((struct symbol *var, struct frame_info *frame,
@@ -497,4 +508,6 @@ extern value_ptr find_function_in_inferior PARAMS ((char *));
 
 extern value_ptr value_allocate_space_in_inferior PARAMS ((int));
 
+extern void _initialize_values PARAMS ((void));
+
 #endif /* !defined (VALUE_H) */