binutils-gdb/gdb/value.h

501 lines
16 KiB
C
Raw Normal View History

1991-03-28 17:26:26 +01:00
/* Definitions for values of C expressions, for GDB.
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
1991-03-28 17:26:26 +01:00
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
1991-03-28 17:26:26 +01:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
1991-03-28 17:26:26 +01:00
This program is distributed in the hope that it will be useful,
1991-03-28 17:26:26 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1991-03-28 17:26:26 +01:00
#if !defined (VALUE_H)
#define VALUE_H 1
1991-03-28 17:26:26 +01:00
/*
* The structure which defines the type of a value. It should never
* be possible for a program lval value to survive over a call to the inferior
* (ie to be put into the history list or an internal variable).
*/
enum lval_type {
/* Not an lval. */
not_lval,
/* In memory. Could be a saved register. */
lval_memory,
/* In a register. */
lval_register,
/* In a gdb internal variable. */
lval_internalvar,
/* Part of a gdb internal variable (structure field). */
lval_internalvar_component,
/* In a register series in a frame not the current one, which may have been
partially saved or saved in different places (otherwise would be
lval_register or lval_memory). */
lval_reg_frame_relative
1991-03-28 17:26:26 +01:00
};
struct value
{
/* Type of value; either not an lval, or one of the various
different possible kinds of lval. */
enum lval_type lval;
/* Is it modifiable? Only relevant if lval != not_lval. */
int modifiable;
1991-03-28 17:26:26 +01:00
/* Location of value (if lval). */
union
{
/* Address in inferior or byte of registers structure. */
CORE_ADDR address;
/* Pointer to internal variable. */
1991-03-28 17:26:26 +01:00
struct internalvar *internalvar;
/* Number of register. Only used with
lval_reg_frame_relative. */
int regnum;
} location;
/* Describes offset of a value within lval a structure in bytes. */
int offset;
/* Only used for bitfields; number of bits contained in them. */
int bitsize;
/* Only used for bitfields; position of start of field.
For BITS_BIG_ENDIAN=0 targets, it is the position of the LSB.
For BITS_BIG_ENDIAN=1 targets, it is the position of the MSB. */
1991-03-28 17:26:26 +01:00
int bitpos;
/* Frame value is relative to. In practice, this address is only
used if the value is stored in several registers in other than
the current frame, and these registers have not all been saved
at the same place in memory. This will be described in the
lval enum above as "lval_reg_frame_relative". */
CORE_ADDR frame_addr;
/* Type of the value. */
struct type *type;
/* Values are stored in a chain, so that they can be deleted
easily over calls to the inferior. Values assigned to internal
variables or put into the value history are taken off this
list. */
struct value *next;
/* ??? When is this used? */
union {
CORE_ADDR memaddr;
char *myaddr;
} substring_addr;
1991-03-28 17:26:26 +01:00
/* Register number if the value is from a register. Is not kept
if you take a field of a structure that is stored in a
register. Shouldn't it be? */
short regno;
/* If zero, contents of this value are in the contents field.
If nonzero, contents are in inferior memory at address
in the location.address field plus the offset field
(and the lval field should be lval_memory). */
char lazy;
/* If nonzero, this is the value of a variable which does not
actually exist in the program. */
char optimized_out;
/* 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
possible value. */
union {
long contents[1];
double force_double_align;
LONGEST force_longlong_align;
char *literal_data;
1991-03-28 17:26:26 +01:00
} aligner;
};
typedef struct value *value_ptr;
1991-03-28 17:26:26 +01:00
#define VALUE_TYPE(val) (val)->type
#define VALUE_LAZY(val) (val)->lazy
/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of
the gdb buffer used to hold a copy of the contents of the lval.
VALUE_CONTENTS is used when the contents of the buffer are needed --
it uses value_fetch_lazy() to load the buffer from the process being
debugged if it hasn't already been loaded. VALUE_CONTENTS_RAW is
used when data is being stored into the buffer, or when it is
certain that the contents of the buffer are valid. */
#define VALUE_CONTENTS_RAW(val) ((char *) (val)->aligner.contents)
#define VALUE_CONTENTS(val) ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)),\
VALUE_CONTENTS_RAW(val))
extern int value_fetch_lazy PARAMS ((value_ptr val));
1991-03-28 17:26:26 +01:00
#define VALUE_LVAL(val) (val)->lval
#define VALUE_ADDRESS(val) (val)->location.address
#define VALUE_INTERNALVAR(val) (val)->location.internalvar
#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)
#define VALUE_FRAME(val) ((val)->frame_addr)
#define VALUE_OFFSET(val) (val)->offset
#define VALUE_BITSIZE(val) (val)->bitsize
#define VALUE_BITPOS(val) (val)->bitpos
#define VALUE_NEXT(val) (val)->next
#define VALUE_REGNO(val) (val)->regno
#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
/* 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)
1991-03-28 17:26:26 +01:00
/* If ARG is an array, convert it to a pointer.
If ARG is an enum, convert it to an integer.
If ARG is a function, convert it to a function pointer.
References are dereferenced. */
#define COERCE_ARRAY(arg) \
do { COERCE_REF(arg); \
if (current_language->c_style_arrays \
&& TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) \
1991-03-28 17:26:26 +01:00
arg = value_coerce_array (arg); \
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC) \
arg = value_coerce_function (arg); \
} while (0)
#define COERCE_NUMBER(arg) \
do { COERCE_ARRAY(arg); COERCE_ENUM(arg); } while (0)
1991-03-28 17:26:26 +01:00
#define COERCE_VARYING_ARRAY(arg, real_arg_type) \
{ if (chill_varying_type (real_arg_type)) \
arg = varying_to_slice (arg), real_arg_type = VALUE_TYPE (arg); }
1991-03-28 17:26:26 +01:00
/* If ARG is an enum, convert it to an integer. */
#define COERCE_ENUM(arg) { \
1991-03-28 17:26:26 +01:00
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
arg = value_cast (builtin_type_unsigned_int, arg); \
}
/* Internal variables (variables for convenience of use of debugger)
are recorded as a chain of these structures. */
struct internalvar
{
struct internalvar *next;
char *name;
value_ptr value;
1991-03-28 17:26:26 +01:00
};
/* Pointer to member function. Depends on compiler implementation. */
#define METHOD_PTR_IS_VIRTUAL(ADDR) ((ADDR) & 0x80000000)
#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))
#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))
1991-03-28 17:26:26 +01:00
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#ifdef __STDC__
struct frame_info;
struct fn_field;
#endif
extern void
print_address_demangle PARAMS ((CORE_ADDR, GDB_FILE *, int));
extern LONGEST value_as_long PARAMS ((value_ptr val));
extern DOUBLEST value_as_double PARAMS ((value_ptr val));
extern CORE_ADDR value_as_pointer PARAMS ((value_ptr val));
extern LONGEST unpack_long PARAMS ((struct type *type, char *valaddr));
extern DOUBLEST unpack_double PARAMS ((struct type *type, char *valaddr,
int *invp));
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
extern CORE_ADDR unpack_pointer PARAMS ((struct type *type, char *valaddr));
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
extern LONGEST unpack_field_as_long PARAMS ((struct type *type, char *valaddr,
int fieldno));
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_lazy PARAMS ((struct type *type, CORE_ADDR addr));
extern value_ptr value_from_register PARAMS ((struct type *type, int regnum,
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
struct frame_info * frame));
extern value_ptr value_of_variable PARAMS ((struct symbol *var,
struct block *b));
extern value_ptr value_of_register PARAMS ((int regnum));
extern int symbol_read_needs_frame PARAMS ((struct symbol *));
extern value_ptr read_var_value PARAMS ((struct symbol *var,
struct frame_info *frame));
extern value_ptr locate_var_value PARAMS ((struct symbol *var,
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
struct frame_info *frame));
extern value_ptr allocate_value PARAMS ((struct type *type));
extern value_ptr allocate_repeat_value PARAMS ((struct type *type, int count));
extern value_ptr value_mark PARAMS ((void));
extern void value_free_to_mark PARAMS ((value_ptr mark));
extern value_ptr value_string PARAMS ((char *ptr, int len));
extern value_ptr value_bitstring PARAMS ((char *ptr, int len));
extern value_ptr value_array PARAMS ((int lowbound, int highbound,
value_ptr *elemvec));
* defs.h (CC_HAS_LONG_LONG): Set up to define CC_HAS_LONG_LONG when compiling with gcc, but disable it for now. See comment. * defs.h (LONGEST): Define as either "long" or "long long" based on CC_HAS_LONG_LONG. * defs.h (longest_to_int): Use CC_HAS_LONG_LONG to control how longest_to_int is defined. * c-valprint.c (c_val_print): Call print_longest. * expprint.c (dump_expression): Use PRINTF_HAS_LONG_LONG instead of LONG_LONG. * {printcmd.c, gdbtypes.h} (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * printcmd.c (print_scalar_formatted): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * typeprint.c (print_type_scalar): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * valprint.c (val_print_type_code_int): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * stabsread.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * value.h (struct value): Replace usage of LONG_LONG with CC_HAS_LONG_LONG. * value.h (print_longest): Add prototype. * values.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * values.c (unpack_double): Collapse code that was unnecessarily dependent on CC_HAS_LONG_LONG. Use LONGEST instead of direct types. * values.c (value_from_longest): Remove dependency on CC_HAS_LONG_LONG and just use LONGEST. * solib.c (solib_map_sections): Use bfd_get_filename to access filename field. * solib.c (clear_solib): Save filename and free it later, after bfd_close, since bfd_close may reference it. Use bfd_get_filename to access the field. * config/convex/xm-convex.h (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add define for PRINTF_HAS_LONG_LONG. * doc/gdbint.texinfo (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add PRINTF_HAS_LONG_LONG references.
1993-04-29 09:07:39 +02:00
extern value_ptr value_concat PARAMS ((value_ptr arg1, value_ptr arg2));
* defs.h (CC_HAS_LONG_LONG): Set up to define CC_HAS_LONG_LONG when compiling with gcc, but disable it for now. See comment. * defs.h (LONGEST): Define as either "long" or "long long" based on CC_HAS_LONG_LONG. * defs.h (longest_to_int): Use CC_HAS_LONG_LONG to control how longest_to_int is defined. * c-valprint.c (c_val_print): Call print_longest. * expprint.c (dump_expression): Use PRINTF_HAS_LONG_LONG instead of LONG_LONG. * {printcmd.c, gdbtypes.h} (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * printcmd.c (print_scalar_formatted): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * typeprint.c (print_type_scalar): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * valprint.c (val_print_type_code_int): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * stabsread.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * value.h (struct value): Replace usage of LONG_LONG with CC_HAS_LONG_LONG. * value.h (print_longest): Add prototype. * values.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * values.c (unpack_double): Collapse code that was unnecessarily dependent on CC_HAS_LONG_LONG. Use LONGEST instead of direct types. * values.c (value_from_longest): Remove dependency on CC_HAS_LONG_LONG and just use LONGEST. * solib.c (solib_map_sections): Use bfd_get_filename to access filename field. * solib.c (clear_solib): Save filename and free it later, after bfd_close, since bfd_close may reference it. Use bfd_get_filename to access the field. * config/convex/xm-convex.h (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add define for PRINTF_HAS_LONG_LONG. * doc/gdbint.texinfo (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add PRINTF_HAS_LONG_LONG references.
1993-04-29 09:07:39 +02:00
extern value_ptr value_binop PARAMS ((value_ptr arg1, value_ptr arg2,
enum exp_opcode op));
extern value_ptr value_add PARAMS ((value_ptr arg1, value_ptr arg2));
extern value_ptr value_sub PARAMS ((value_ptr arg1, value_ptr arg2));
extern value_ptr value_coerce_array PARAMS ((value_ptr arg1));
extern value_ptr value_coerce_function PARAMS ((value_ptr arg1));
extern value_ptr value_ind PARAMS ((value_ptr arg1));
extern value_ptr value_addr PARAMS ((value_ptr arg1));
extern value_ptr value_assign PARAMS ((value_ptr toval, value_ptr fromval));
extern value_ptr value_neg PARAMS ((value_ptr arg1));
extern value_ptr value_complement PARAMS ((value_ptr arg1));
* breakpoint.h (enum bptype): Add bp_hardware_watchpoint and bp_watchpoint_scope breakpoints. (struct breakpoint): Add val_chain and related_breakpoint fields for use by watchpoints. * breakpoint.c (within_scope): Delete. No longer used. (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Provide default definition. (target_{remove,insert}_watchpoint): Likewise. (can_use_hardware_watchpoint): New function. (remove_breakpoint): New function to remove a single breakpoint or hardware watchpoint. (insert_breakpoints): Handle insertion of hardware watchpoints. Store a copy of the value chain derived from the watchpoint expression. (remove_breakpoints): Simplify by using remove_breakpoint. (delete_breakpoint): Likewise. (watchpoint_check): Delete the watchpoint and watchpoint scope breakpoints when the watchpoint goes out of scope. Save & restore the current frame after checking watchpoints. (breakpoint_init_inferior): Likewise (restarting the program makes all local watchpoints go out of scope). (bpstat_stop_status): Handle hardware watchpoints much like normal watchpoints. Delete the watchpoint and watchpoint scope breakpoint when the watchpoint goes out of scope. Remove and reinsert all breakpoints before returning if we stopped when a hardware watchpoint fired. (watch_command): Use a hardware watchpoint when possible. If watching a local expression, build a scope breakpoint too. (map_breakpoint_numbers): Also call given function for any related breakpoints. (disable_breakpoint): Never disable a scope breakpoint. (enable_breakpoint): Handle hardware breakpoints much like normal breakpoints, but recompute the watchpoint_scope breakpoint's frame and address (if we have an associated scope breakpoint). (read_memory_nobpt): Handle hardware watchpoints like normal watchpoints. When necessary handle watchpoint_scope breakpoints. (print_it_normal, bpstat_what, breakpoint_1, mention): Likewise. (clear_command, breakpoint_re_set_one, enable_command): Likewise. (disable_command): Likewise. * blockframe.c (find_frame_addr_in_frame_chain): New function. Extern prototype added to frame.h * infrun.c (wait_for_inferior): Set current_frame and select a frame before checking if we stopped due to a hardare watchpoint firing. Handle stepping over hardware watchpoints. (normal_stop): Remove unnecessary call to select_frame. * value.h (value_release_to_mark): Declare. * values.c (value_release_to_mark): New function. * procfs.c (procfs_wait): Add cases for hardware watchpoints. (procfs_set_watchpoint, procfs_stopped_by_watchpoint): New functions. * hppab-nat.c (hppa_set_watchpoint): New function. * config/pa/nm-hppab.h (STOPPED_BY_WATCHPOINT): Define. (HAVE_STEPPABLE_WATCHPOINT): Define. (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Define. (target_{insert,delete}_watchpoint): Define.
1994-04-13 23:57:00 +02:00
extern value_ptr value_struct_elt PARAMS ((value_ptr *argp, value_ptr *args,
char *name,
int *static_memfuncp, char *err));
extern value_ptr value_struct_elt_for_reference PARAMS ((struct type *domain,
int offset,
struct type *curtype,
char *name,
struct type *intype));
extern value_ptr value_field PARAMS ((value_ptr arg1, int fieldno));
extern value_ptr value_primitive_field PARAMS ((value_ptr arg1, int offset,
int fieldno,
struct type *arg_type));
extern value_ptr value_cast PARAMS ((struct type *type, value_ptr arg2));
extern value_ptr value_zero PARAMS ((struct type *type, enum lval_type lv));
extern value_ptr value_repeat PARAMS ((value_ptr arg1, int count));
extern value_ptr value_subscript PARAMS ((value_ptr array, value_ptr idx));
extern value_ptr value_from_vtable_info PARAMS ((value_ptr arg,
struct type *type));
extern value_ptr value_being_returned PARAMS ((struct type *valtype,
char retbuf[REGISTER_BYTES],
int struct_return));
extern value_ptr value_in PARAMS ((value_ptr element, value_ptr set));
extern int value_bit_index PARAMS ((struct type *type, char *addr, int index));
extern int using_struct_return PARAMS ((value_ptr function, CORE_ADDR funcaddr,
struct type *value_type, int gcc_p));
extern void set_return_value PARAMS ((value_ptr val));
extern value_ptr evaluate_expression PARAMS ((struct expression *exp));
extern value_ptr evaluate_type PARAMS ((struct expression *exp));
extern value_ptr evaluate_subexp_with_coercion PARAMS ((struct expression *,
int *, enum noside));
extern value_ptr parse_and_eval PARAMS ((char *exp));
extern value_ptr parse_to_comma_and_eval PARAMS ((char **expp));
extern struct type *parse_and_eval_type PARAMS ((char *p, int length));
extern CORE_ADDR parse_and_eval_address PARAMS ((char *exp));
extern CORE_ADDR parse_and_eval_address_1 PARAMS ((char **expptr));
extern value_ptr access_value_history PARAMS ((int num));
extern value_ptr value_of_internalvar PARAMS ((struct internalvar *var));
extern void set_internalvar PARAMS ((struct internalvar *var, value_ptr val));
extern void set_internalvar_component PARAMS ((struct internalvar *var,
int offset,
int bitpos, int bitsize,
value_ptr newvalue));
extern struct internalvar *lookup_internalvar PARAMS ((char *name));
extern int value_equal PARAMS ((value_ptr arg1, value_ptr arg2));
extern int value_less PARAMS ((value_ptr arg1, value_ptr arg2));
extern int value_logical_not PARAMS ((value_ptr arg1));
1991-03-28 17:26:26 +01:00
/* C++ */
extern value_ptr value_of_this PARAMS ((int complain));
extern value_ptr value_x_binop PARAMS ((value_ptr arg1, value_ptr arg2,
enum exp_opcode op,
enum exp_opcode otherop,
enum noside noside));
extern value_ptr value_x_unop PARAMS ((value_ptr arg1, enum exp_opcode op,
enum noside noside));
extern value_ptr value_fn_field PARAMS ((value_ptr *arg1p, struct fn_field *f,
int j,
struct type* type, int offset));
extern value_ptr value_virtual_fn_field PARAMS ((value_ptr *arg1p,
struct fn_field *f, int j,
struct type *type,
int offset));
extern int binop_user_defined_p PARAMS ((enum exp_opcode op,
value_ptr arg1, value_ptr arg2));
extern int unop_user_defined_p PARAMS ((enum exp_opcode op, value_ptr arg1));
extern int destructor_name_p PARAMS ((const char *name,
const struct type *type));
1991-03-28 17:26:26 +01:00
#define value_free(val) free ((PTR)val)
extern void free_all_values PARAMS ((void));
extern void release_value PARAMS ((value_ptr val));
extern int record_latest_value PARAMS ((value_ptr val));
extern void registers_changed PARAMS ((void));
extern void read_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
extern void write_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
extern void
read_register_gen PARAMS ((int regno, char *myaddr));
extern CORE_ADDR
read_register PARAMS ((int regno));
extern void
write_register PARAMS ((int regno, LONGEST val));
extern void
supply_register PARAMS ((int regno, char *val));
extern void
get_saved_register PARAMS ((char *raw_buffer, int *optimized,
CORE_ADDR *addrp, struct frame_info *frame,
int regnum, enum lval_type *lval));
extern void
Tue Sep 28 09:45:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * symmisc.c (print_symbol): Use %02x not %2x for LOC_CONST_BYTES. Clean up problems with targets and hosts that have 64 bit longs and pointers and 32 bit ints. * breakpoint.c, buildsym.c, c-lang.c, c-valprint.c, ch-lang.c, ch-valprint.c, core.c, cp-valprint.c, dbxread.c, exec.c, expprint.c, gdbtypes.c, infcmd.c, language.c, language.h, m2-lang.c, maint.c, mips-tdep.c, mipsread.c, partial-stab.h, printcmd.c, remote-vx.c, solib.c, source.c, stack.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Change all printf formats from %x to %lx if outputting an address. Change la_*_format to use long format. local_hex_string, local_hex_string_custom now take an unsigned long argument, change all callers. * coffread.c (read_coff_symtab): Remove superfluous cast for complaint output. * dbxread.c (end_psymtab): Cast MSYMBOL_INFO to long, not int. * findvar.c, value.h (write_register): Change register value to long. * gdbtypes.h (struct type): Change `bitsize' to long as TYPE_FIELD_STATIC_PHYSNAME uses this field as a pointer. * inferior.h (struct inferior_status): Change type of stop_pc to CORE_ADDR. * language.h (local_octal_string, local_octal_string_custom): Remove prototype, the functions are neither defined nor used. * mipsread.c (parse_symbol): Use temporary variable for bitsize as f->bitsize is a long now. * objfiles.c (add_to_objfile_sections, build_objfile_section_table): Use unsigned long casts instead of int for abusing sections_end pointer as integer. * stack.c (parse_frame_specification): Change type of `args' to CORE_ADDR for SETUP_ARBITRARY_FRAME. * printcmd.c (make_vasize): Allow redefinition via MAKEVA_SIZE. * mipsread.c (parse_type): Alpha cc now supports the t->continued bit, update algorithm to match the way the compiler uses it.
1993-09-28 18:43:25 +01:00
modify_field PARAMS ((char *addr, LONGEST fieldval, int bitpos, int bitsize));
extern void
type_print PARAMS ((struct type *type, char *varstring, GDB_FILE *stream,
int show));
extern char *baseclass_addr PARAMS ((struct type *type, int index,
char *valaddr,
value_ptr *valuep, int *errp));
* defs.h (CC_HAS_LONG_LONG): Set up to define CC_HAS_LONG_LONG when compiling with gcc, but disable it for now. See comment. * defs.h (LONGEST): Define as either "long" or "long long" based on CC_HAS_LONG_LONG. * defs.h (longest_to_int): Use CC_HAS_LONG_LONG to control how longest_to_int is defined. * c-valprint.c (c_val_print): Call print_longest. * expprint.c (dump_expression): Use PRINTF_HAS_LONG_LONG instead of LONG_LONG. * {printcmd.c, gdbtypes.h} (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * printcmd.c (print_scalar_formatted): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * typeprint.c (print_type_scalar): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * valprint.c (val_print_type_code_int): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * stabsread.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * value.h (struct value): Replace usage of LONG_LONG with CC_HAS_LONG_LONG. * value.h (print_longest): Add prototype. * values.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * values.c (unpack_double): Collapse code that was unnecessarily dependent on CC_HAS_LONG_LONG. Use LONGEST instead of direct types. * values.c (value_from_longest): Remove dependency on CC_HAS_LONG_LONG and just use LONGEST. * solib.c (solib_map_sections): Use bfd_get_filename to access filename field. * solib.c (clear_solib): Save filename and free it later, after bfd_close, since bfd_close may reference it. Use bfd_get_filename to access the field. * config/convex/xm-convex.h (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add define for PRINTF_HAS_LONG_LONG. * doc/gdbint.texinfo (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add PRINTF_HAS_LONG_LONG references.
1993-04-29 09:07:39 +02:00
extern void
print_longest PARAMS ((GDB_FILE *stream, int format, int use_local,
LONGEST val));
* defs.h (CC_HAS_LONG_LONG): Set up to define CC_HAS_LONG_LONG when compiling with gcc, but disable it for now. See comment. * defs.h (LONGEST): Define as either "long" or "long long" based on CC_HAS_LONG_LONG. * defs.h (longest_to_int): Use CC_HAS_LONG_LONG to control how longest_to_int is defined. * c-valprint.c (c_val_print): Call print_longest. * expprint.c (dump_expression): Use PRINTF_HAS_LONG_LONG instead of LONG_LONG. * {printcmd.c, gdbtypes.h} (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * printcmd.c (print_scalar_formatted): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * typeprint.c (print_type_scalar): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * valprint.c (val_print_type_code_int): Call print_longest and let it figure out what to do for PRINTF_HAS_LONG_LONG. * stabsread.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * value.h (struct value): Replace usage of LONG_LONG with CC_HAS_LONG_LONG. * value.h (print_longest): Add prototype. * values.c (LONG_LONG): Replace usages with CC_HAS_LONG_LONG. * values.c (unpack_double): Collapse code that was unnecessarily dependent on CC_HAS_LONG_LONG. Use LONGEST instead of direct types. * values.c (value_from_longest): Remove dependency on CC_HAS_LONG_LONG and just use LONGEST. * solib.c (solib_map_sections): Use bfd_get_filename to access filename field. * solib.c (clear_solib): Save filename and free it later, after bfd_close, since bfd_close may reference it. Use bfd_get_filename to access the field. * config/convex/xm-convex.h (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add define for PRINTF_HAS_LONG_LONG. * doc/gdbint.texinfo (LONG_LONG): Replace with CC_HAS_LONG_LONG. Add PRINTF_HAS_LONG_LONG references.
1993-04-29 09:07:39 +02:00
extern void
print_floating PARAMS ((char *valaddr, struct type *type, GDB_FILE *stream));
extern int value_print PARAMS ((value_ptr val, GDB_FILE *stream, int format,
enum val_prettyprint pretty));
Initial Fortran language support, adapted from work by Farooq Butt (fmbutt@engage.sps.mot.com). * Makefile.in: Add Fortran-related files and dependencies. * defs.h (language_fortran): New language enum. * language.h (_LANG_fortran): Define. (MAX_FORTRAN_DIMS): Define. * expression.h: Reformat to standard. (MULTI_F77_SUBSCRIPT, OP_F77_UNDETERMINED_ARGLIST, OP_F77_LITERAL_COMPLEX, OP_F77_SUBSTR): New expression opcodes. * gdbtypes.h (TYPE_CODE_COMPLEX, TYPE_CODE_LITERAL_COMPLEX, TYPE_CODE_LITERAL_STRING): New type codes. (type): New fields upper_bound_type and lower_bound_type. (TYPE_ARRAY_UPPER_BOUND_TYPE, TYPE_ARRAY_LOWER_BOUND_TYPE, TYPE_ARRAY_UPPER_BOUND_VALUE, TYPE_ARRAY_LOWER_BOUND_VALUE): New macros. (builtin_type_f_character, etc): Declare. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_START): Define. * f-exp.y: New file, Fortran expression grammar. * f-lang.c: New file, Fortran language support functions. * f-lang.h: New file, Fortran language support declarations. * f-typeprint.c: New file, Fortran type printing. * f-valprint.c: New file, Fortran value printing. * eval.c (evaluate_subexp): Add code for new expression opcodes, fix wording of error message. * gdbtypes.c (f77_create_literal_complex_type, f77_create_literal_string_type): New functions. * language.c (set_language_command): Add Fortran info. (calc_f77_array_dims): New function. * parse.c (length_of_subexp, prefixify_subexp): Add cases for new expression opcodes. * symfile.c (deduce_language_from_filename): Recognize .f and .F as Fortran source files. * valops.c (f77_value_literal_string, f77_value_substring, f77_value_literal_complex): New functions.
1994-08-19 23:59:05 +02:00
extern void
value_print_array_elements PARAMS ((value_ptr val, GDB_FILE* stream,
int format, enum val_prettyprint pretty));
* breakpoint.h (enum bptype): Add bp_hardware_watchpoint and bp_watchpoint_scope breakpoints. (struct breakpoint): Add val_chain and related_breakpoint fields for use by watchpoints. * breakpoint.c (within_scope): Delete. No longer used. (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Provide default definition. (target_{remove,insert}_watchpoint): Likewise. (can_use_hardware_watchpoint): New function. (remove_breakpoint): New function to remove a single breakpoint or hardware watchpoint. (insert_breakpoints): Handle insertion of hardware watchpoints. Store a copy of the value chain derived from the watchpoint expression. (remove_breakpoints): Simplify by using remove_breakpoint. (delete_breakpoint): Likewise. (watchpoint_check): Delete the watchpoint and watchpoint scope breakpoints when the watchpoint goes out of scope. Save & restore the current frame after checking watchpoints. (breakpoint_init_inferior): Likewise (restarting the program makes all local watchpoints go out of scope). (bpstat_stop_status): Handle hardware watchpoints much like normal watchpoints. Delete the watchpoint and watchpoint scope breakpoint when the watchpoint goes out of scope. Remove and reinsert all breakpoints before returning if we stopped when a hardware watchpoint fired. (watch_command): Use a hardware watchpoint when possible. If watching a local expression, build a scope breakpoint too. (map_breakpoint_numbers): Also call given function for any related breakpoints. (disable_breakpoint): Never disable a scope breakpoint. (enable_breakpoint): Handle hardware breakpoints much like normal breakpoints, but recompute the watchpoint_scope breakpoint's frame and address (if we have an associated scope breakpoint). (read_memory_nobpt): Handle hardware watchpoints like normal watchpoints. When necessary handle watchpoint_scope breakpoints. (print_it_normal, bpstat_what, breakpoint_1, mention): Likewise. (clear_command, breakpoint_re_set_one, enable_command): Likewise. (disable_command): Likewise. * blockframe.c (find_frame_addr_in_frame_chain): New function. Extern prototype added to frame.h * infrun.c (wait_for_inferior): Set current_frame and select a frame before checking if we stopped due to a hardare watchpoint firing. Handle stepping over hardware watchpoints. (normal_stop): Remove unnecessary call to select_frame. * value.h (value_release_to_mark): Declare. * values.c (value_release_to_mark): New function. * procfs.c (procfs_wait): Add cases for hardware watchpoints. (procfs_set_watchpoint, procfs_stopped_by_watchpoint): New functions. * hppab-nat.c (hppa_set_watchpoint): New function. * config/pa/nm-hppab.h (STOPPED_BY_WATCHPOINT): Define. (HAVE_STEPPABLE_WATCHPOINT): Define. (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Define. (target_{insert,delete}_watchpoint): Define.
1994-04-13 23:57:00 +02:00
extern value_ptr
value_release_to_mark PARAMS ((value_ptr mark));
extern int
val_print PARAMS ((struct type *type, char *valaddr, CORE_ADDR address,
GDB_FILE *stream, int format, int deref_ref,
int recurse, enum val_prettyprint pretty));
extern int
val_print_string PARAMS ((CORE_ADDR addr, unsigned int len, GDB_FILE *stream));
extern void
print_variable_value PARAMS ((struct symbol *var, struct frame_info *frame,
GDB_FILE *stream));
extern int check_field PARAMS ((value_ptr, const char *));
extern void
c_typedef_print PARAMS ((struct type *type, struct symbol *news, GDB_FILE *stream));
extern char *
internalvar_name PARAMS ((struct internalvar *var));
extern void
clear_value_history PARAMS ((void));
extern void
clear_internalvars PARAMS ((void));
/* From values.c */
extern value_ptr value_copy PARAMS ((value_ptr));
extern int baseclass_offset PARAMS ((struct type *, int, char *, CORE_ADDR));
/* From valops.c */
1991-03-28 17:26:26 +01:00
extern value_ptr varying_to_slice PARAMS ((value_ptr));
extern value_ptr value_slice PARAMS ((value_ptr, int, int));
extern value_ptr call_function_by_hand PARAMS ((value_ptr, int, value_ptr *));
extern value_ptr value_literal_complex PARAMS ((value_ptr, value_ptr, struct type*));
Initial Fortran language support, adapted from work by Farooq Butt (fmbutt@engage.sps.mot.com). * Makefile.in: Add Fortran-related files and dependencies. * defs.h (language_fortran): New language enum. * language.h (_LANG_fortran): Define. (MAX_FORTRAN_DIMS): Define. * expression.h: Reformat to standard. (MULTI_F77_SUBSCRIPT, OP_F77_UNDETERMINED_ARGLIST, OP_F77_LITERAL_COMPLEX, OP_F77_SUBSTR): New expression opcodes. * gdbtypes.h (TYPE_CODE_COMPLEX, TYPE_CODE_LITERAL_COMPLEX, TYPE_CODE_LITERAL_STRING): New type codes. (type): New fields upper_bound_type and lower_bound_type. (TYPE_ARRAY_UPPER_BOUND_TYPE, TYPE_ARRAY_LOWER_BOUND_TYPE, TYPE_ARRAY_UPPER_BOUND_VALUE, TYPE_ARRAY_LOWER_BOUND_VALUE): New macros. (builtin_type_f_character, etc): Declare. * value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_START): Define. * f-exp.y: New file, Fortran expression grammar. * f-lang.c: New file, Fortran language support functions. * f-lang.h: New file, Fortran language support declarations. * f-typeprint.c: New file, Fortran type printing. * f-valprint.c: New file, Fortran value printing. * eval.c (evaluate_subexp): Add code for new expression opcodes, fix wording of error message. * gdbtypes.c (f77_create_literal_complex_type, f77_create_literal_string_type): New functions. * language.c (set_language_command): Add Fortran info. (calc_f77_array_dims): New function. * parse.c (length_of_subexp, prefixify_subexp): Add cases for new expression opcodes. * symfile.c (deduce_language_from_filename): Recognize .f and .F as Fortran source files. * valops.c (f77_value_literal_string, f77_value_substring, f77_value_literal_complex): New functions.
1994-08-19 23:59:05 +02:00
extern value_ptr find_function_in_inferior PARAMS ((char *));
extern value_ptr value_allocate_space_in_inferior PARAMS ((int));
#endif /* !defined (VALUE_H) */