+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
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);
}
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;
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;
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);
/* 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.
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)
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;
}
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;
}
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;
}
&& 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;
}
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 */
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);
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
/* 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.
/* 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 ()));
}
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 ();
/* 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.
#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
#include "progress.h"
-#ifndef NO_MMALLOC
+#ifdef USE_MMALLOC
#include "mmalloc.h"
#endif
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 */
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 *));
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 **));
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 *));
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));
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 *". */
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 **));
# 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 */
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));
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));
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);
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);
(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;
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);
}
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)
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;
}
(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 =
(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 =
/* 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.
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)
{
/* 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.
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));
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);
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))
{
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);
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);
/* 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
# 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
/* 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.
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. */
/* 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.
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,
/* 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);
/* 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.
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 ();
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);
/* 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.
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
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);
}
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);
{
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);
}
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);
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");
char *name;
CORE_ADDR pc, pc_masked;
char *space_index;
- asection *section;
name = NULL;
if (!arg)
/* 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.
#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
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;
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; \
} \
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
} \
} \
+ /* start-sanitize-java */ \
if (SYMBOL_LANGUAGE (symbol) == language_java) \
{ \
demangled = \
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
} \
} \
+ /* end-sanitize-java */ \
if (demangled == NULL \
&& (SYMBOL_LANGUAGE (symbol) == language_chill \
|| SYMBOL_LANGUAGE (symbol) == language_auto)) \
#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) \
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;
/* 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. */
/* 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
{
}
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
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
/* 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 */
/* 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,
extern char **make_symbol_completion_list PARAMS ((char *, char *));
+extern void _initialize_source PARAMS ((void));
+
/* symtab.c */
extern struct partial_symtab *
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
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) */
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))
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)
{
{
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);
/* 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)
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;
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;
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;
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;
/* 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)
{
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)
else
{
head = next;
- old_chain = make_cleanup (free_command_lines, &head);
+ old_chain = make_cleanup ((make_cleanup_func) free_command_lines,
+ &head);
}
tail = next;
}
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;
/* 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.
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
/* 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)
/* 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");
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:
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)
/* 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.
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
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)
{
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. */
/* 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
LONGEST force_longlong_align;
char *literal_data;
} aligner;
-
};
typedef struct value *value_ptr;
#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.
/* 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); \
}
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));
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,
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));
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,
extern value_ptr value_allocate_space_in_inferior PARAMS ((int));
+extern void _initialize_values PARAMS ((void));
+
#endif /* !defined (VALUE_H) */