1991-03-28 17:26:26 +01:00
|
|
|
|
/* Perform non-arithmetic operations on values, for GDB.
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
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
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
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
|
|
|
|
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02: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
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "symtab.h"
|
1992-03-20 22:57:17 +01:00
|
|
|
|
#include "gdbtypes.h"
|
1991-03-28 17:26:26 +01:00
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
#include "target.h"
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
#include "demangle.h"
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
|
|
/* Local functions. */
|
1992-03-20 22:57:17 +01:00
|
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
|
find_function_addr PARAMS ((value, struct type **));
|
|
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
|
value_push PARAMS ((CORE_ADDR, value));
|
|
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
|
value_arg_push PARAMS ((CORE_ADDR, value));
|
|
|
|
|
|
|
|
|
|
static value
|
|
|
|
|
search_struct_field PARAMS ((char *, value, int, struct type *, int));
|
|
|
|
|
|
|
|
|
|
static value
|
1992-11-24 04:02:10 +01:00
|
|
|
|
search_struct_method PARAMS ((char *, value *, value *, int, int *,
|
1992-03-20 22:57:17 +01:00
|
|
|
|
struct type *));
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
check_field_in PARAMS ((struct type *, const char *));
|
|
|
|
|
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
/* Cast value ARG2 to type TYPE and return as a value.
|
|
|
|
|
More general than a C cast: accepts any two types of the same length,
|
|
|
|
|
and if ARG2 is an lvalue it can be cast into anything at all. */
|
|
|
|
|
/* In C++, casts may change pointer representations. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_cast (type, arg2)
|
|
|
|
|
struct type *type;
|
|
|
|
|
register value arg2;
|
|
|
|
|
{
|
|
|
|
|
register enum type_code code1;
|
|
|
|
|
register enum type_code code2;
|
|
|
|
|
register int scalar;
|
|
|
|
|
|
|
|
|
|
/* Coerce arrays but not enums. Enums will work as-is
|
|
|
|
|
and coercing them would cause an infinite recursion. */
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ENUM)
|
|
|
|
|
COERCE_ARRAY (arg2);
|
|
|
|
|
|
|
|
|
|
code1 = TYPE_CODE (type);
|
|
|
|
|
code2 = TYPE_CODE (VALUE_TYPE (arg2));
|
|
|
|
|
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_FLT
|
|
|
|
|
|| code2 == TYPE_CODE_ENUM);
|
|
|
|
|
|
|
|
|
|
if (code1 == TYPE_CODE_FLT && scalar)
|
|
|
|
|
return value_from_double (type, value_as_double (arg2));
|
|
|
|
|
else if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_ENUM)
|
|
|
|
|
&& (scalar || code2 == TYPE_CODE_PTR))
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
return value_from_longest (type, value_as_long (arg2));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
else if (TYPE_LENGTH (type) == TYPE_LENGTH (VALUE_TYPE (arg2)))
|
|
|
|
|
{
|
|
|
|
|
if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
|
|
|
|
|
{
|
|
|
|
|
/* Look in the type of the source to see if it contains the
|
|
|
|
|
type of the target as a superclass. If so, we'll need to
|
|
|
|
|
offset the pointer rather than just change its type. */
|
|
|
|
|
struct type *t1 = TYPE_TARGET_TYPE (type);
|
|
|
|
|
struct type *t2 = TYPE_TARGET_TYPE (VALUE_TYPE (arg2));
|
1991-12-05 12:56:20 +01:00
|
|
|
|
if ( TYPE_CODE (t1) == TYPE_CODE_STRUCT
|
1991-03-28 17:26:26 +01:00
|
|
|
|
&& TYPE_CODE (t2) == TYPE_CODE_STRUCT
|
|
|
|
|
&& TYPE_NAME (t1) != 0) /* if name unknown, can't have supercl */
|
|
|
|
|
{
|
|
|
|
|
value v = search_struct_field (type_name_no_tag (t1),
|
1991-04-27 01:02:15 +02:00
|
|
|
|
value_ind (arg2), 0, t2, 1);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (v)
|
|
|
|
|
{
|
|
|
|
|
v = value_addr (v);
|
|
|
|
|
VALUE_TYPE (v) = type;
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* No superclass found, just fall through to change ptr type. */
|
|
|
|
|
}
|
|
|
|
|
VALUE_TYPE (arg2) = type;
|
|
|
|
|
return arg2;
|
|
|
|
|
}
|
|
|
|
|
else if (VALUE_LVAL (arg2) == lval_memory)
|
|
|
|
|
{
|
|
|
|
|
return value_at_lazy (type, VALUE_ADDRESS (arg2) + VALUE_OFFSET (arg2));
|
|
|
|
|
}
|
1991-05-30 10:52:52 +02:00
|
|
|
|
else if (code1 == TYPE_CODE_VOID)
|
|
|
|
|
{
|
|
|
|
|
return value_zero (builtin_type_void, not_lval);
|
|
|
|
|
}
|
1991-03-28 17:26:26 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error ("Invalid cast.");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create a value of type TYPE that is zero, and return it. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_zero (type, lv)
|
|
|
|
|
struct type *type;
|
|
|
|
|
enum lval_type lv;
|
|
|
|
|
{
|
|
|
|
|
register value val = allocate_value (type);
|
|
|
|
|
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 05:22:08 +02:00
|
|
|
|
memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (type));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_LVAL (val) = lv;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a value with type TYPE located at ADDR.
|
|
|
|
|
|
|
|
|
|
Call value_at only if the data needs to be fetched immediately;
|
|
|
|
|
if we can be 'lazy' and defer the fetch, perhaps indefinately, call
|
|
|
|
|
value_at_lazy instead. value_at_lazy simply records the address of
|
|
|
|
|
the data and sets the lazy-evaluation-required flag. The lazy flag
|
|
|
|
|
is tested in the VALUE_CONTENTS macro, which is used if and when
|
|
|
|
|
the contents are actually required. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_at (type, addr)
|
|
|
|
|
struct type *type;
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
{
|
|
|
|
|
register value val = allocate_value (type);
|
|
|
|
|
|
|
|
|
|
read_memory (addr, VALUE_CONTENTS_RAW (val), TYPE_LENGTH (type));
|
|
|
|
|
|
|
|
|
|
VALUE_LVAL (val) = lval_memory;
|
|
|
|
|
VALUE_ADDRESS (val) = addr;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a lazy value with type TYPE located at ADDR (cf. value_at). */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_at_lazy (type, addr)
|
|
|
|
|
struct type *type;
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
{
|
|
|
|
|
register value val = allocate_value (type);
|
|
|
|
|
|
|
|
|
|
VALUE_LVAL (val) = lval_memory;
|
|
|
|
|
VALUE_ADDRESS (val) = addr;
|
|
|
|
|
VALUE_LAZY (val) = 1;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called only from the VALUE_CONTENTS macro, if the current data for
|
|
|
|
|
a variable needs to be loaded into VALUE_CONTENTS(VAL). Fetches the
|
|
|
|
|
data from the user's process, and clears the lazy flag to indicate
|
|
|
|
|
that the data in the buffer is valid.
|
|
|
|
|
|
1991-10-25 10:03:36 +01:00
|
|
|
|
If the value is zero-length, we avoid calling read_memory, which would
|
|
|
|
|
abort. We mark the value as fetched anyway -- all 0 bytes of it.
|
|
|
|
|
|
1991-03-28 17:26:26 +01:00
|
|
|
|
This function returns a value because it is used in the VALUE_CONTENTS
|
|
|
|
|
macro as part of an expression, where a void would not work. The
|
|
|
|
|
value is ignored. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
value_fetch_lazy (val)
|
|
|
|
|
register value val;
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
|
|
|
|
|
|
1991-10-25 10:03:36 +01:00
|
|
|
|
if (TYPE_LENGTH (VALUE_TYPE (val)))
|
|
|
|
|
read_memory (addr, VALUE_CONTENTS_RAW (val),
|
|
|
|
|
TYPE_LENGTH (VALUE_TYPE (val)));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_LAZY (val) = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Store the contents of FROMVAL into the location of TOVAL.
|
|
|
|
|
Return a new value with the location of TOVAL and contents of FROMVAL. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_assign (toval, fromval)
|
|
|
|
|
register value toval, fromval;
|
|
|
|
|
{
|
|
|
|
|
register struct type *type = VALUE_TYPE (toval);
|
|
|
|
|
register value val;
|
|
|
|
|
char raw_buffer[MAX_REGISTER_RAW_SIZE];
|
|
|
|
|
char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
|
|
|
|
|
int use_buffer = 0;
|
|
|
|
|
|
|
|
|
|
COERCE_ARRAY (fromval);
|
1991-12-30 20:22:29 +01:00
|
|
|
|
COERCE_REF (toval);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (toval) != lval_internalvar)
|
|
|
|
|
fromval = value_cast (type, fromval);
|
|
|
|
|
|
|
|
|
|
/* If TOVAL is a special machine register requiring conversion
|
|
|
|
|
of program values to a special raw format,
|
|
|
|
|
convert FROMVAL's contents now, with result in `raw_buffer',
|
|
|
|
|
and set USE_BUFFER to the number of bytes to write. */
|
|
|
|
|
|
|
|
|
|
if (VALUE_REGNO (toval) >= 0
|
|
|
|
|
&& REGISTER_CONVERTIBLE (VALUE_REGNO (toval)))
|
|
|
|
|
{
|
|
|
|
|
int regno = VALUE_REGNO (toval);
|
|
|
|
|
if (VALUE_TYPE (fromval) != REGISTER_VIRTUAL_TYPE (regno))
|
|
|
|
|
fromval = value_cast (REGISTER_VIRTUAL_TYPE (regno), fromval);
|
1991-12-30 20:22:29 +01:00
|
|
|
|
memcpy (virtual_buffer, VALUE_CONTENTS (fromval),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
REGISTER_VIRTUAL_SIZE (regno));
|
1992-11-24 04:02:10 +01:00
|
|
|
|
REGISTER_CONVERT_TO_RAW (regno, virtual_buffer, raw_buffer);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
use_buffer = REGISTER_RAW_SIZE (regno);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (VALUE_LVAL (toval))
|
|
|
|
|
{
|
|
|
|
|
case lval_internalvar:
|
|
|
|
|
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case lval_internalvar_component:
|
|
|
|
|
set_internalvar_component (VALUE_INTERNALVAR (toval),
|
|
|
|
|
VALUE_OFFSET (toval),
|
|
|
|
|
VALUE_BITPOS (toval),
|
|
|
|
|
VALUE_BITSIZE (toval),
|
|
|
|
|
fromval);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case lval_memory:
|
|
|
|
|
if (VALUE_BITSIZE (toval))
|
|
|
|
|
{
|
|
|
|
|
int v; /* FIXME, this won't work for large bitfields */
|
|
|
|
|
read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
1992-03-20 22:57:17 +01:00
|
|
|
|
(char *) &v, sizeof v);
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
modify_field ((char *) &v, (int) value_as_long (fromval),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
|
|
|
|
|
write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
|
|
|
|
(char *)&v, sizeof v);
|
|
|
|
|
}
|
|
|
|
|
else if (use_buffer)
|
|
|
|
|
write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
|
|
|
|
raw_buffer, use_buffer);
|
|
|
|
|
else
|
|
|
|
|
write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
|
|
|
|
VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case lval_register:
|
|
|
|
|
if (VALUE_BITSIZE (toval))
|
|
|
|
|
{
|
|
|
|
|
int v;
|
|
|
|
|
|
|
|
|
|
read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
(char *) &v, sizeof v);
|
|
|
|
|
modify_field ((char *) &v, (int) value_as_long (fromval),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
|
|
|
|
|
write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
(char *) &v, sizeof v);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (use_buffer)
|
|
|
|
|
write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
|
|
|
|
raw_buffer, use_buffer);
|
|
|
|
|
else
|
|
|
|
|
write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
|
|
|
|
|
VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case lval_reg_frame_relative:
|
|
|
|
|
{
|
|
|
|
|
/* value is stored in a series of registers in the frame
|
|
|
|
|
specified by the structure. Copy that value out, modify
|
|
|
|
|
it, and copy it back in. */
|
|
|
|
|
int amount_to_copy = (VALUE_BITSIZE (toval) ? 1 : TYPE_LENGTH (type));
|
|
|
|
|
int reg_size = REGISTER_RAW_SIZE (VALUE_FRAME_REGNUM (toval));
|
|
|
|
|
int byte_offset = VALUE_OFFSET (toval) % reg_size;
|
|
|
|
|
int reg_offset = VALUE_OFFSET (toval) / reg_size;
|
|
|
|
|
int amount_copied;
|
|
|
|
|
char *buffer = (char *) alloca (amount_to_copy);
|
|
|
|
|
int regno;
|
|
|
|
|
FRAME frame;
|
|
|
|
|
|
|
|
|
|
/* Figure out which frame this is in currently. */
|
|
|
|
|
for (frame = get_current_frame ();
|
|
|
|
|
frame && FRAME_FP (frame) != VALUE_FRAME (toval);
|
|
|
|
|
frame = get_prev_frame (frame))
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (!frame)
|
|
|
|
|
error ("Value being assigned to is no longer active.");
|
|
|
|
|
|
|
|
|
|
amount_to_copy += (reg_size - amount_to_copy % reg_size);
|
|
|
|
|
|
|
|
|
|
/* Copy it out. */
|
|
|
|
|
for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset,
|
|
|
|
|
amount_copied = 0);
|
|
|
|
|
amount_copied < amount_to_copy;
|
|
|
|
|
amount_copied += reg_size, regno++)
|
|
|
|
|
{
|
|
|
|
|
get_saved_register (buffer + amount_copied,
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
(int *)NULL, (CORE_ADDR *)NULL,
|
1991-03-28 17:26:26 +01:00
|
|
|
|
frame, regno, (enum lval_type *)NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Modify what needs to be modified. */
|
|
|
|
|
if (VALUE_BITSIZE (toval))
|
|
|
|
|
modify_field (buffer + byte_offset,
|
|
|
|
|
(int) value_as_long (fromval),
|
|
|
|
|
VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
|
|
|
|
|
else if (use_buffer)
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 05:22:08 +02:00
|
|
|
|
memcpy (buffer + byte_offset, raw_buffer, use_buffer);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
else
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 05:22:08 +02:00
|
|
|
|
memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
|
|
|
|
|
TYPE_LENGTH (type));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
/* Copy it back. */
|
|
|
|
|
for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset,
|
|
|
|
|
amount_copied = 0);
|
|
|
|
|
amount_copied < amount_to_copy;
|
|
|
|
|
amount_copied += reg_size, regno++)
|
|
|
|
|
{
|
|
|
|
|
enum lval_type lval;
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
int optim;
|
|
|
|
|
|
|
|
|
|
/* Just find out where to put it. */
|
|
|
|
|
get_saved_register ((char *)NULL,
|
|
|
|
|
&optim, &addr, frame, regno, &lval);
|
|
|
|
|
|
|
|
|
|
if (optim)
|
|
|
|
|
error ("Attempt to assign to a value that was optimized out.");
|
|
|
|
|
if (lval == lval_memory)
|
|
|
|
|
write_memory (addr, buffer + amount_copied, reg_size);
|
|
|
|
|
else if (lval == lval_register)
|
|
|
|
|
write_register_bytes (addr, buffer + amount_copied, reg_size);
|
|
|
|
|
else
|
|
|
|
|
error ("Attempt to assign to an unmodifiable value.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
error ("Left side of = operation is not an lvalue.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a value just like TOVAL except with the contents of FROMVAL
|
|
|
|
|
(except in the case of the type if TOVAL is an internalvar). */
|
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (toval) == lval_internalvar
|
|
|
|
|
|| VALUE_LVAL (toval) == lval_internalvar_component)
|
|
|
|
|
{
|
|
|
|
|
type = VALUE_TYPE (fromval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val = allocate_value (type);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 05:22:08 +02:00
|
|
|
|
memcpy (val, toval, VALUE_CONTENTS_RAW (val) - (char *) val);
|
|
|
|
|
memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),
|
|
|
|
|
TYPE_LENGTH (type));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_TYPE (val) = type;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Extend a value VAL to COUNT repetitions of its type. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_repeat (arg1, count)
|
|
|
|
|
value arg1;
|
|
|
|
|
int count;
|
|
|
|
|
{
|
|
|
|
|
register value val;
|
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (arg1) != lval_memory)
|
|
|
|
|
error ("Only values in memory can be extended with '@'.");
|
|
|
|
|
if (count < 1)
|
|
|
|
|
error ("Invalid number %d of repetitions.", count);
|
|
|
|
|
|
|
|
|
|
val = allocate_repeat_value (VALUE_TYPE (arg1), count);
|
|
|
|
|
|
|
|
|
|
read_memory (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1),
|
|
|
|
|
VALUE_CONTENTS_RAW (val),
|
|
|
|
|
TYPE_LENGTH (VALUE_TYPE (val)) * count);
|
|
|
|
|
VALUE_LVAL (val) = lval_memory;
|
|
|
|
|
VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1);
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_of_variable (var)
|
|
|
|
|
struct symbol *var;
|
|
|
|
|
{
|
|
|
|
|
value val;
|
|
|
|
|
|
|
|
|
|
val = read_var_value (var, (FRAME) 0);
|
|
|
|
|
if (val == 0)
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
error ("Address of symbol \"%s\" is unknown.", SYMBOL_SOURCE_NAME (var));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a value which is an array, return a value which is
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
a pointer to its first (actually, zeroth) element.
|
|
|
|
|
FIXME, this should be subtracting the array's lower bound. */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_coerce_array (arg1)
|
|
|
|
|
value arg1;
|
|
|
|
|
{
|
|
|
|
|
register struct type *type;
|
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (arg1) != lval_memory)
|
|
|
|
|
error ("Attempt to take address of value not located in memory.");
|
|
|
|
|
|
|
|
|
|
/* Get type of elements. */
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_ARRAY)
|
|
|
|
|
type = TYPE_TARGET_TYPE (VALUE_TYPE (arg1));
|
|
|
|
|
else
|
|
|
|
|
/* A phony array made by value_repeat.
|
|
|
|
|
Its type is the type of the elements, not an array type. */
|
|
|
|
|
type = VALUE_TYPE (arg1);
|
|
|
|
|
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
return value_from_longest (lookup_pointer_type (type),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
(LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a value which is a function, return a value which is a pointer
|
|
|
|
|
to it. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_coerce_function (arg1)
|
|
|
|
|
value arg1;
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (arg1) != lval_memory)
|
|
|
|
|
error ("Attempt to take address of value not located in memory.");
|
|
|
|
|
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
return value_from_longest (lookup_pointer_type (VALUE_TYPE (arg1)),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
(LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a pointer value for the object for which ARG1 is the contents. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_addr (arg1)
|
|
|
|
|
value arg1;
|
|
|
|
|
{
|
1991-12-30 20:22:29 +01:00
|
|
|
|
struct type *type = VALUE_TYPE (arg1);
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_REF)
|
|
|
|
|
{
|
|
|
|
|
/* Copy the value, but change the type from (T&) to (T*).
|
|
|
|
|
We keep the same location information, which is efficient,
|
|
|
|
|
and allows &(&X) to get the location containing the reference. */
|
|
|
|
|
value arg2 = value_copy (arg1);
|
|
|
|
|
VALUE_TYPE (arg2) = lookup_pointer_type (TYPE_TARGET_TYPE (type));
|
|
|
|
|
return arg2;
|
|
|
|
|
}
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (VALUE_REPEATED (arg1)
|
1991-12-30 20:22:29 +01:00
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_ARRAY)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return value_coerce_array (arg1);
|
1991-12-30 20:22:29 +01:00
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FUNC)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return value_coerce_function (arg1);
|
|
|
|
|
|
|
|
|
|
if (VALUE_LVAL (arg1) != lval_memory)
|
|
|
|
|
error ("Attempt to take address of value not located in memory.");
|
|
|
|
|
|
1991-12-30 20:22:29 +01:00
|
|
|
|
return value_from_longest (lookup_pointer_type (type),
|
1991-03-28 17:26:26 +01:00
|
|
|
|
(LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a value of a pointer type, apply the C unary * operator to it. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_ind (arg1)
|
|
|
|
|
value arg1;
|
|
|
|
|
{
|
|
|
|
|
COERCE_ARRAY (arg1);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_MEMBER)
|
|
|
|
|
error ("not implemented: member types in value_ind");
|
|
|
|
|
|
|
|
|
|
/* Allow * on an integer so we can cast it to whatever we want.
|
|
|
|
|
This returns an int, which seems like the most C-like thing
|
|
|
|
|
to do. "long long" variables are rare enough that
|
|
|
|
|
BUILTIN_TYPE_LONGEST would seem to be a mistake. */
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT)
|
|
|
|
|
return value_at (builtin_type_int,
|
|
|
|
|
(CORE_ADDR) value_as_long (arg1));
|
|
|
|
|
else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
|
|
|
|
|
return value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
|
1991-05-30 10:52:52 +02:00
|
|
|
|
value_as_pointer (arg1));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
error ("Attempt to take contents of a non-pointer value.");
|
|
|
|
|
return 0; /* For lint -- never reached */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Pushing small parts of stack frames. */
|
|
|
|
|
|
|
|
|
|
/* Push one word (the size of object that a register holds). */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
push_word (sp, buffer)
|
|
|
|
|
CORE_ADDR sp;
|
|
|
|
|
REGISTER_TYPE buffer;
|
|
|
|
|
{
|
|
|
|
|
register int len = sizeof (REGISTER_TYPE);
|
|
|
|
|
|
1991-04-20 05:57:50 +02:00
|
|
|
|
SWAP_TARGET_AND_HOST (&buffer, len);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= len;
|
|
|
|
|
write_memory (sp, (char *)&buffer, len);
|
|
|
|
|
#else /* stack grows upward */
|
|
|
|
|
write_memory (sp, (char *)&buffer, len);
|
|
|
|
|
sp += len;
|
|
|
|
|
#endif /* stack grows upward */
|
|
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Push LEN bytes with data at BUFFER. */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
push_bytes (sp, buffer, len)
|
|
|
|
|
CORE_ADDR sp;
|
|
|
|
|
char *buffer;
|
|
|
|
|
int len;
|
|
|
|
|
{
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= len;
|
|
|
|
|
write_memory (sp, buffer, len);
|
|
|
|
|
#else /* stack grows upward */
|
|
|
|
|
write_memory (sp, buffer, len);
|
|
|
|
|
sp += len;
|
|
|
|
|
#endif /* stack grows upward */
|
|
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Push onto the stack the specified value VALUE. */
|
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
static CORE_ADDR
|
1991-03-28 17:26:26 +01:00
|
|
|
|
value_push (sp, arg)
|
|
|
|
|
register CORE_ADDR sp;
|
|
|
|
|
value arg;
|
|
|
|
|
{
|
|
|
|
|
register int len = TYPE_LENGTH (VALUE_TYPE (arg));
|
|
|
|
|
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= len;
|
|
|
|
|
write_memory (sp, VALUE_CONTENTS (arg), len);
|
|
|
|
|
#else /* stack grows upward */
|
|
|
|
|
write_memory (sp, VALUE_CONTENTS (arg), len);
|
|
|
|
|
sp += len;
|
|
|
|
|
#endif /* stack grows upward */
|
|
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Perform the standard coercions that are specified
|
|
|
|
|
for arguments to be passed to C functions. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_arg_coerce (arg)
|
|
|
|
|
value arg;
|
|
|
|
|
{
|
|
|
|
|
register struct type *type;
|
|
|
|
|
|
|
|
|
|
COERCE_ENUM (arg);
|
|
|
|
|
|
|
|
|
|
type = VALUE_TYPE (arg);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_INT
|
1991-12-05 12:56:20 +01:00
|
|
|
|
&& TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_int))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return value_cast (builtin_type_int, arg);
|
|
|
|
|
|
1991-12-05 12:56:20 +01:00
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
|
&& TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_double))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return value_cast (builtin_type_double, arg);
|
|
|
|
|
|
|
|
|
|
return arg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Push the value ARG, first coercing it as an argument
|
|
|
|
|
to a C function. */
|
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
static CORE_ADDR
|
1991-03-28 17:26:26 +01:00
|
|
|
|
value_arg_push (sp, arg)
|
|
|
|
|
register CORE_ADDR sp;
|
|
|
|
|
value arg;
|
|
|
|
|
{
|
|
|
|
|
return value_push (sp, value_arg_coerce (arg));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine a function's address and its return type from its value.
|
|
|
|
|
Calls error() if the function is not valid for calling. */
|
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
static CORE_ADDR
|
1991-03-28 17:26:26 +01:00
|
|
|
|
find_function_addr (function, retval_type)
|
|
|
|
|
value function;
|
|
|
|
|
struct type **retval_type;
|
|
|
|
|
{
|
|
|
|
|
register struct type *ftype = VALUE_TYPE (function);
|
|
|
|
|
register enum type_code code = TYPE_CODE (ftype);
|
|
|
|
|
struct type *value_type;
|
|
|
|
|
CORE_ADDR funaddr;
|
|
|
|
|
|
|
|
|
|
/* If it's a member function, just look at the function
|
|
|
|
|
part of it. */
|
|
|
|
|
|
|
|
|
|
/* Determine address to call. */
|
|
|
|
|
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
|
|
|
|
|
{
|
|
|
|
|
funaddr = VALUE_ADDRESS (function);
|
|
|
|
|
value_type = TYPE_TARGET_TYPE (ftype);
|
|
|
|
|
}
|
|
|
|
|
else if (code == TYPE_CODE_PTR)
|
|
|
|
|
{
|
1991-05-30 10:52:52 +02:00
|
|
|
|
funaddr = value_as_pointer (function);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (TYPE_CODE (TYPE_TARGET_TYPE (ftype)) == TYPE_CODE_FUNC
|
|
|
|
|
|| TYPE_CODE (TYPE_TARGET_TYPE (ftype)) == TYPE_CODE_METHOD)
|
|
|
|
|
value_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype));
|
|
|
|
|
else
|
|
|
|
|
value_type = builtin_type_int;
|
|
|
|
|
}
|
|
|
|
|
else if (code == TYPE_CODE_INT)
|
|
|
|
|
{
|
|
|
|
|
/* Handle the case of functions lacking debugging info.
|
|
|
|
|
Their values are characters since their addresses are char */
|
|
|
|
|
if (TYPE_LENGTH (ftype) == 1)
|
1991-05-30 10:52:52 +02:00
|
|
|
|
funaddr = value_as_pointer (value_addr (function));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
else
|
|
|
|
|
/* Handle integer used as address of a function. */
|
1991-05-30 10:52:52 +02:00
|
|
|
|
funaddr = (CORE_ADDR) value_as_long (function);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
value_type = builtin_type_int;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
error ("Invalid data type for function to be called.");
|
|
|
|
|
|
|
|
|
|
*retval_type = value_type;
|
|
|
|
|
return funaddr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined (CALL_DUMMY)
|
|
|
|
|
/* All this stuff with a dummy frame may seem unnecessarily complicated
|
|
|
|
|
(why not just save registers in GDB?). The purpose of pushing a dummy
|
|
|
|
|
frame which looks just like a real frame is so that if you call a
|
|
|
|
|
function and then hit a breakpoint (get a signal, etc), "backtrace"
|
|
|
|
|
will look right. Whether the backtrace needs to actually show the
|
|
|
|
|
stack at the time the inferior function was called is debatable, but
|
|
|
|
|
it certainly needs to not display garbage. So if you are contemplating
|
|
|
|
|
making dummy frames be different from normal frames, consider that. */
|
|
|
|
|
|
|
|
|
|
/* Perform a function call in the inferior.
|
|
|
|
|
ARGS is a vector of values of arguments (NARGS of them).
|
|
|
|
|
FUNCTION is a value, the function to be called.
|
|
|
|
|
Returns a value representing what the function returned.
|
|
|
|
|
May fail to return, if a breakpoint or signal is hit
|
|
|
|
|
during the execution of the function. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
call_function_by_hand (function, nargs, args)
|
|
|
|
|
value function;
|
|
|
|
|
int nargs;
|
|
|
|
|
value *args;
|
|
|
|
|
{
|
|
|
|
|
register CORE_ADDR sp;
|
|
|
|
|
register int i;
|
|
|
|
|
CORE_ADDR start_sp;
|
1991-04-20 05:57:50 +02:00
|
|
|
|
/* CALL_DUMMY is an array of words (REGISTER_TYPE), but each word
|
1991-10-25 07:29:23 +01:00
|
|
|
|
is in host byte order. It is switched to target byte order before calling
|
1991-04-20 05:57:50 +02:00
|
|
|
|
FIX_CALL_DUMMY. */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
static REGISTER_TYPE dummy[] = CALL_DUMMY;
|
|
|
|
|
REGISTER_TYPE dummy1[sizeof dummy / sizeof (REGISTER_TYPE)];
|
|
|
|
|
CORE_ADDR old_sp;
|
|
|
|
|
struct type *value_type;
|
|
|
|
|
unsigned char struct_return;
|
|
|
|
|
CORE_ADDR struct_addr;
|
|
|
|
|
struct inferior_status inf_status;
|
|
|
|
|
struct cleanup *old_chain;
|
|
|
|
|
CORE_ADDR funaddr;
|
|
|
|
|
int using_gcc;
|
* hppa-pinsn.c (print_insn): Improve handling of be and ble
branch targets to compute target address using const from previous
instruction if necessary.
* Add `Q' operator to print out bit position field various
instructions.
* hppah-nat.c: #include sys/param.h, and sys/user.h. General
cleanups, use new code from Utah.
* (store_inferior_registers): Update to new code from Utah.
* (initialize_kernel_u_addr): Re-enable decl of struct user u.
* (fetch_register): Clear out priv level when reading PCs.
* hppah-tdep.c: Get rid of gobs of KERNELDEBUG stuff.
* Remove decl of errno, #include wait.h and target.h.
* (frame_saved_pc): Check `flags' pseudo-register to see if we
were inside of a kernel call. If so, then PC is in a different
register. Also, mask out bottom two bits of all PCs so as not to
confuse higher level code.
* (push_dummy_frame): Create from #define in tm-hppa.h.
* (find_dummy_frame_regs): Update from Utah.
* (hp_pop_frame): Create from #define in tm-hppa.h.
* (hp_restore_pc_queue): New, from Utah.
* (hp_push_arguments): Big fixes from Utah.
* (pa_do_registers_info, pa_print_registers): Only print out fp
regs upon request.
* (skip_trampoline_code): New routine to deal with stubs that
live in nowhereland between callers and callees.
* i860-tdep.c: Remove decl of attach_flag.
* infrun.c (wait_for_inferior): Add new macro
INSTRUCTION_NULLIFIED, which can tell if the instruction pointed
at by PC will be nullified. If so, then step the target once more
so as to avoid confusing the user.
* (just before step_over_function:): Use stop_func_start, not
stop_pc when checking for the existance of line number info.
stop_func_start will reflect the proper address of the target
routine, not of the stub that we may be traversing to get there.
* tm-hppa.h: define SKIP_TRAMPOLINE_CODE and IN_SOLIB_TRAMPOLINE
to deal with the stubs that PA compilers sometimes stick between
callers and callees. Also, define FLAGS_REGNUM for access to the
`flags' pseudo-reg.
* (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use
memcpy, not bcopy.
* (CANNOT_STORE_REGISTER): New from Utah. Says that we can't
write gr0, PC regs, and PSW!
* (FRAME_FIND_SAVED_REGS): Bug fixes from Utah.
* (PUSH_DUMMY_FRAME, POP_FRAME): Make into real routines in
hppah-nat.c.
* (CALL_DUMMY, FIX_CALL_DUMMY): Fixes from Utah.
* Define struct unwind_table_entry.
* valops.c (call_function_by_hand): Add another arg to
FIX_CALL_DUMMY (under #ifdef GDB_TARGET_IS_HPPA). Why is this
necessary?
1992-12-22 04:18:46 +01:00
|
|
|
|
CORE_ADDR real_pc;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
if (!target_has_execution)
|
|
|
|
|
noprocess();
|
|
|
|
|
|
1991-03-28 17:26:26 +01:00
|
|
|
|
save_inferior_status (&inf_status, 1);
|
|
|
|
|
old_chain = make_cleanup (restore_inferior_status, &inf_status);
|
|
|
|
|
|
|
|
|
|
/* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
|
|
|
|
|
(and POP_FRAME for restoring them). (At least on most machines)
|
|
|
|
|
they are saved on the stack in the inferior. */
|
|
|
|
|
PUSH_DUMMY_FRAME;
|
|
|
|
|
|
|
|
|
|
old_sp = sp = read_register (SP_REGNUM);
|
|
|
|
|
|
|
|
|
|
#if 1 INNER_THAN 2 /* Stack grows down */
|
|
|
|
|
sp -= sizeof dummy;
|
|
|
|
|
start_sp = sp;
|
|
|
|
|
#else /* Stack grows up */
|
|
|
|
|
start_sp = sp;
|
|
|
|
|
sp += sizeof dummy;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
funaddr = find_function_addr (function, &value_type);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
struct block *b = block_for_pc (funaddr);
|
|
|
|
|
/* If compiled without -g, assume GCC. */
|
|
|
|
|
using_gcc = b == NULL || BLOCK_GCC_COMPILED (b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Are we returning a value using a structure return or a normal
|
|
|
|
|
value return? */
|
|
|
|
|
|
|
|
|
|
struct_return = using_struct_return (function, funaddr, value_type,
|
|
|
|
|
using_gcc);
|
|
|
|
|
|
|
|
|
|
/* Create a call sequence customized for this function
|
|
|
|
|
and the number of arguments for it. */
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 05:22:08 +02:00
|
|
|
|
memcpy (dummy1, dummy, sizeof dummy);
|
1991-04-20 05:57:50 +02:00
|
|
|
|
for (i = 0; i < sizeof dummy / sizeof (REGISTER_TYPE); i++)
|
|
|
|
|
SWAP_TARGET_AND_HOST (&dummy1[i], sizeof (REGISTER_TYPE));
|
* hppa-pinsn.c (print_insn): Improve handling of be and ble
branch targets to compute target address using const from previous
instruction if necessary.
* Add `Q' operator to print out bit position field various
instructions.
* hppah-nat.c: #include sys/param.h, and sys/user.h. General
cleanups, use new code from Utah.
* (store_inferior_registers): Update to new code from Utah.
* (initialize_kernel_u_addr): Re-enable decl of struct user u.
* (fetch_register): Clear out priv level when reading PCs.
* hppah-tdep.c: Get rid of gobs of KERNELDEBUG stuff.
* Remove decl of errno, #include wait.h and target.h.
* (frame_saved_pc): Check `flags' pseudo-register to see if we
were inside of a kernel call. If so, then PC is in a different
register. Also, mask out bottom two bits of all PCs so as not to
confuse higher level code.
* (push_dummy_frame): Create from #define in tm-hppa.h.
* (find_dummy_frame_regs): Update from Utah.
* (hp_pop_frame): Create from #define in tm-hppa.h.
* (hp_restore_pc_queue): New, from Utah.
* (hp_push_arguments): Big fixes from Utah.
* (pa_do_registers_info, pa_print_registers): Only print out fp
regs upon request.
* (skip_trampoline_code): New routine to deal with stubs that
live in nowhereland between callers and callees.
* i860-tdep.c: Remove decl of attach_flag.
* infrun.c (wait_for_inferior): Add new macro
INSTRUCTION_NULLIFIED, which can tell if the instruction pointed
at by PC will be nullified. If so, then step the target once more
so as to avoid confusing the user.
* (just before step_over_function:): Use stop_func_start, not
stop_pc when checking for the existance of line number info.
stop_func_start will reflect the proper address of the target
routine, not of the stub that we may be traversing to get there.
* tm-hppa.h: define SKIP_TRAMPOLINE_CODE and IN_SOLIB_TRAMPOLINE
to deal with the stubs that PA compilers sometimes stick between
callers and callees. Also, define FLAGS_REGNUM for access to the
`flags' pseudo-reg.
* (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use
memcpy, not bcopy.
* (CANNOT_STORE_REGISTER): New from Utah. Says that we can't
write gr0, PC regs, and PSW!
* (FRAME_FIND_SAVED_REGS): Bug fixes from Utah.
* (PUSH_DUMMY_FRAME, POP_FRAME): Make into real routines in
hppah-nat.c.
* (CALL_DUMMY, FIX_CALL_DUMMY): Fixes from Utah.
* Define struct unwind_table_entry.
* valops.c (call_function_by_hand): Add another arg to
FIX_CALL_DUMMY (under #ifdef GDB_TARGET_IS_HPPA). Why is this
necessary?
1992-12-22 04:18:46 +01:00
|
|
|
|
|
|
|
|
|
#ifdef GDB_TARGET_IS_HPPA
|
|
|
|
|
FIX_CALL_DUMMY (dummy1, start_sp, real_pc, funaddr, nargs, args,
|
|
|
|
|
value_type, using_gcc);
|
|
|
|
|
#else
|
1991-03-28 17:26:26 +01:00
|
|
|
|
FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
|
|
|
|
|
value_type, using_gcc);
|
* hppa-pinsn.c (print_insn): Improve handling of be and ble
branch targets to compute target address using const from previous
instruction if necessary.
* Add `Q' operator to print out bit position field various
instructions.
* hppah-nat.c: #include sys/param.h, and sys/user.h. General
cleanups, use new code from Utah.
* (store_inferior_registers): Update to new code from Utah.
* (initialize_kernel_u_addr): Re-enable decl of struct user u.
* (fetch_register): Clear out priv level when reading PCs.
* hppah-tdep.c: Get rid of gobs of KERNELDEBUG stuff.
* Remove decl of errno, #include wait.h and target.h.
* (frame_saved_pc): Check `flags' pseudo-register to see if we
were inside of a kernel call. If so, then PC is in a different
register. Also, mask out bottom two bits of all PCs so as not to
confuse higher level code.
* (push_dummy_frame): Create from #define in tm-hppa.h.
* (find_dummy_frame_regs): Update from Utah.
* (hp_pop_frame): Create from #define in tm-hppa.h.
* (hp_restore_pc_queue): New, from Utah.
* (hp_push_arguments): Big fixes from Utah.
* (pa_do_registers_info, pa_print_registers): Only print out fp
regs upon request.
* (skip_trampoline_code): New routine to deal with stubs that
live in nowhereland between callers and callees.
* i860-tdep.c: Remove decl of attach_flag.
* infrun.c (wait_for_inferior): Add new macro
INSTRUCTION_NULLIFIED, which can tell if the instruction pointed
at by PC will be nullified. If so, then step the target once more
so as to avoid confusing the user.
* (just before step_over_function:): Use stop_func_start, not
stop_pc when checking for the existance of line number info.
stop_func_start will reflect the proper address of the target
routine, not of the stub that we may be traversing to get there.
* tm-hppa.h: define SKIP_TRAMPOLINE_CODE and IN_SOLIB_TRAMPOLINE
to deal with the stubs that PA compilers sometimes stick between
callers and callees. Also, define FLAGS_REGNUM for access to the
`flags' pseudo-reg.
* (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use
memcpy, not bcopy.
* (CANNOT_STORE_REGISTER): New from Utah. Says that we can't
write gr0, PC regs, and PSW!
* (FRAME_FIND_SAVED_REGS): Bug fixes from Utah.
* (PUSH_DUMMY_FRAME, POP_FRAME): Make into real routines in
hppah-nat.c.
* (CALL_DUMMY, FIX_CALL_DUMMY): Fixes from Utah.
* Define struct unwind_table_entry.
* valops.c (call_function_by_hand): Add another arg to
FIX_CALL_DUMMY (under #ifdef GDB_TARGET_IS_HPPA). Why is this
necessary?
1992-12-22 04:18:46 +01:00
|
|
|
|
real_pc = start_sp;
|
|
|
|
|
#endif
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
#if CALL_DUMMY_LOCATION == ON_STACK
|
|
|
|
|
write_memory (start_sp, (char *)dummy1, sizeof dummy);
|
|
|
|
|
|
|
|
|
|
#else /* Not on stack. */
|
|
|
|
|
#if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
|
|
|
|
|
/* Convex Unix prohibits executing in the stack segment. */
|
|
|
|
|
/* Hope there is empty room at the top of the text segment. */
|
|
|
|
|
{
|
1991-10-25 07:29:23 +01:00
|
|
|
|
extern CORE_ADDR text_end;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
static checked = 0;
|
|
|
|
|
if (!checked)
|
|
|
|
|
for (start_sp = text_end - sizeof dummy; start_sp < text_end; ++start_sp)
|
|
|
|
|
if (read_memory_integer (start_sp, 1) != 0)
|
|
|
|
|
error ("text segment full -- no place to put call");
|
|
|
|
|
checked = 1;
|
|
|
|
|
sp = old_sp;
|
|
|
|
|
start_sp = text_end - sizeof dummy;
|
|
|
|
|
write_memory (start_sp, (char *)dummy1, sizeof dummy);
|
|
|
|
|
}
|
|
|
|
|
#else /* After text_end. */
|
|
|
|
|
{
|
1991-10-25 07:29:23 +01:00
|
|
|
|
extern CORE_ADDR text_end;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
int errcode;
|
|
|
|
|
sp = old_sp;
|
|
|
|
|
start_sp = text_end;
|
|
|
|
|
errcode = target_write_memory (start_sp, (char *)dummy1, sizeof dummy);
|
|
|
|
|
if (errcode != 0)
|
|
|
|
|
error ("Cannot write text segment -- call_function failed");
|
|
|
|
|
}
|
|
|
|
|
#endif /* After text_end. */
|
|
|
|
|
#endif /* Not on stack. */
|
|
|
|
|
|
|
|
|
|
#ifdef lint
|
|
|
|
|
sp = old_sp; /* It really is used, for some ifdef's... */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef STACK_ALIGN
|
|
|
|
|
/* If stack grows down, we must leave a hole at the top. */
|
|
|
|
|
{
|
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
|
|
/* Reserve space for the return structure to be written on the
|
|
|
|
|
stack, if necessary */
|
|
|
|
|
|
|
|
|
|
if (struct_return)
|
|
|
|
|
len += TYPE_LENGTH (value_type);
|
|
|
|
|
|
|
|
|
|
for (i = nargs - 1; i >= 0; i--)
|
|
|
|
|
len += TYPE_LENGTH (VALUE_TYPE (value_arg_coerce (args[i])));
|
|
|
|
|
#ifdef CALL_DUMMY_STACK_ADJUST
|
|
|
|
|
len += CALL_DUMMY_STACK_ADJUST;
|
|
|
|
|
#endif
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= STACK_ALIGN (len) - len;
|
|
|
|
|
#else
|
|
|
|
|
sp += STACK_ALIGN (len) - len;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif /* STACK_ALIGN */
|
|
|
|
|
|
|
|
|
|
/* Reserve space for the return structure to be written on the
|
|
|
|
|
stack, if necessary */
|
|
|
|
|
|
|
|
|
|
if (struct_return)
|
|
|
|
|
{
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= TYPE_LENGTH (value_type);
|
|
|
|
|
struct_addr = sp;
|
|
|
|
|
#else
|
|
|
|
|
struct_addr = sp;
|
|
|
|
|
sp += TYPE_LENGTH (value_type);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined (REG_STRUCT_HAS_ADDR)
|
|
|
|
|
{
|
|
|
|
|
/* This is a machine like the sparc, where we need to pass a pointer
|
|
|
|
|
to the structure, not the structure itself. */
|
|
|
|
|
if (REG_STRUCT_HAS_ADDR (using_gcc))
|
|
|
|
|
for (i = nargs - 1; i >= 0; i--)
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (args[i])) == TYPE_CODE_STRUCT)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
#if !(1 INNER_THAN 2)
|
|
|
|
|
/* The stack grows up, so the address of the thing we push
|
|
|
|
|
is the stack pointer before we push it. */
|
|
|
|
|
addr = sp;
|
|
|
|
|
#endif
|
|
|
|
|
/* Push the structure. */
|
|
|
|
|
sp = value_push (sp, args[i]);
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
/* The stack grows down, so the address of the thing we push
|
|
|
|
|
is the stack pointer after we push it. */
|
|
|
|
|
addr = sp;
|
|
|
|
|
#endif
|
|
|
|
|
/* The value we're going to pass is the address of the thing
|
|
|
|
|
we just pushed. */
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
args[i] = value_from_longest (lookup_pointer_type (value_type),
|
|
|
|
|
(LONGEST) addr);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* REG_STRUCT_HAS_ADDR. */
|
|
|
|
|
|
|
|
|
|
#ifdef PUSH_ARGUMENTS
|
|
|
|
|
PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr);
|
|
|
|
|
#else /* !PUSH_ARGUMENTS */
|
|
|
|
|
for (i = nargs - 1; i >= 0; i--)
|
|
|
|
|
sp = value_arg_push (sp, args[i]);
|
|
|
|
|
#endif /* !PUSH_ARGUMENTS */
|
|
|
|
|
|
|
|
|
|
#ifdef CALL_DUMMY_STACK_ADJUST
|
|
|
|
|
#if 1 INNER_THAN 2
|
|
|
|
|
sp -= CALL_DUMMY_STACK_ADJUST;
|
|
|
|
|
#else
|
|
|
|
|
sp += CALL_DUMMY_STACK_ADJUST;
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* CALL_DUMMY_STACK_ADJUST */
|
|
|
|
|
|
|
|
|
|
/* Store the address at which the structure is supposed to be
|
|
|
|
|
written. Note that this (and the code which reserved the space
|
|
|
|
|
above) assumes that gcc was used to compile this function. Since
|
|
|
|
|
it doesn't cost us anything but space and if the function is pcc
|
|
|
|
|
it will ignore this value, we will make that assumption.
|
|
|
|
|
|
|
|
|
|
Also note that on some machines (like the sparc) pcc uses a
|
|
|
|
|
convention like gcc's. */
|
|
|
|
|
|
|
|
|
|
if (struct_return)
|
|
|
|
|
STORE_STRUCT_RETURN (struct_addr, sp);
|
|
|
|
|
|
|
|
|
|
/* Write the stack pointer. This is here because the statements above
|
|
|
|
|
might fool with it. On SPARC, this write also stores the register
|
|
|
|
|
window into the right place in the new stack frame, which otherwise
|
|
|
|
|
wouldn't happen. (See write_inferior_registers in sparc-xdep.c.) */
|
|
|
|
|
write_register (SP_REGNUM, sp);
|
|
|
|
|
|
|
|
|
|
/* Figure out the value returned by the function. */
|
|
|
|
|
{
|
|
|
|
|
char retbuf[REGISTER_BYTES];
|
|
|
|
|
|
|
|
|
|
/* Execute the stack dummy routine, calling FUNCTION.
|
|
|
|
|
When it is done, discard the empty frame
|
|
|
|
|
after storing the contents of all regs into retbuf. */
|
* hppa-pinsn.c (print_insn): Improve handling of be and ble
branch targets to compute target address using const from previous
instruction if necessary.
* Add `Q' operator to print out bit position field various
instructions.
* hppah-nat.c: #include sys/param.h, and sys/user.h. General
cleanups, use new code from Utah.
* (store_inferior_registers): Update to new code from Utah.
* (initialize_kernel_u_addr): Re-enable decl of struct user u.
* (fetch_register): Clear out priv level when reading PCs.
* hppah-tdep.c: Get rid of gobs of KERNELDEBUG stuff.
* Remove decl of errno, #include wait.h and target.h.
* (frame_saved_pc): Check `flags' pseudo-register to see if we
were inside of a kernel call. If so, then PC is in a different
register. Also, mask out bottom two bits of all PCs so as not to
confuse higher level code.
* (push_dummy_frame): Create from #define in tm-hppa.h.
* (find_dummy_frame_regs): Update from Utah.
* (hp_pop_frame): Create from #define in tm-hppa.h.
* (hp_restore_pc_queue): New, from Utah.
* (hp_push_arguments): Big fixes from Utah.
* (pa_do_registers_info, pa_print_registers): Only print out fp
regs upon request.
* (skip_trampoline_code): New routine to deal with stubs that
live in nowhereland between callers and callees.
* i860-tdep.c: Remove decl of attach_flag.
* infrun.c (wait_for_inferior): Add new macro
INSTRUCTION_NULLIFIED, which can tell if the instruction pointed
at by PC will be nullified. If so, then step the target once more
so as to avoid confusing the user.
* (just before step_over_function:): Use stop_func_start, not
stop_pc when checking for the existance of line number info.
stop_func_start will reflect the proper address of the target
routine, not of the stub that we may be traversing to get there.
* tm-hppa.h: define SKIP_TRAMPOLINE_CODE and IN_SOLIB_TRAMPOLINE
to deal with the stubs that PA compilers sometimes stick between
callers and callees. Also, define FLAGS_REGNUM for access to the
`flags' pseudo-reg.
* (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use
memcpy, not bcopy.
* (CANNOT_STORE_REGISTER): New from Utah. Says that we can't
write gr0, PC regs, and PSW!
* (FRAME_FIND_SAVED_REGS): Bug fixes from Utah.
* (PUSH_DUMMY_FRAME, POP_FRAME): Make into real routines in
hppah-nat.c.
* (CALL_DUMMY, FIX_CALL_DUMMY): Fixes from Utah.
* Define struct unwind_table_entry.
* valops.c (call_function_by_hand): Add another arg to
FIX_CALL_DUMMY (under #ifdef GDB_TARGET_IS_HPPA). Why is this
necessary?
1992-12-22 04:18:46 +01:00
|
|
|
|
run_stack_dummy (real_pc + CALL_DUMMY_START_OFFSET, retbuf);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
|
|
|
|
|
return value_being_returned (value_type, retbuf, struct_return);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else /* no CALL_DUMMY. */
|
|
|
|
|
value
|
|
|
|
|
call_function_by_hand (function, nargs, args)
|
|
|
|
|
value function;
|
|
|
|
|
int nargs;
|
|
|
|
|
value *args;
|
|
|
|
|
{
|
|
|
|
|
error ("Cannot invoke functions on this machine.");
|
|
|
|
|
}
|
|
|
|
|
#endif /* no CALL_DUMMY. */
|
|
|
|
|
|
|
|
|
|
/* Create a value for a string constant:
|
|
|
|
|
Call the function malloc in the inferior to get space for it,
|
|
|
|
|
then copy the data into that space
|
|
|
|
|
and then return the address with type char *.
|
1992-11-24 04:02:10 +01:00
|
|
|
|
PTR points to the string constant data; LEN is number of characters.
|
|
|
|
|
Note that the string may contain embedded null bytes. */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_string (ptr, len)
|
|
|
|
|
char *ptr;
|
|
|
|
|
int len;
|
|
|
|
|
{
|
|
|
|
|
register value val;
|
|
|
|
|
register struct symbol *sym;
|
|
|
|
|
value blocklen;
|
|
|
|
|
|
|
|
|
|
/* Find the address of malloc in the inferior. */
|
|
|
|
|
|
|
|
|
|
sym = lookup_symbol ("malloc", 0, VAR_NAMESPACE, 0, NULL);
|
1992-11-24 04:02:10 +01:00
|
|
|
|
if (sym != NULL)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (SYMBOL_CLASS (sym) != LOC_BLOCK)
|
|
|
|
|
error ("\"malloc\" exists in this program but is not a function.");
|
|
|
|
|
val = value_of_variable (sym);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
struct minimal_symbol *msymbol;
|
|
|
|
|
msymbol = lookup_minimal_symbol ("malloc", (struct objfile *) NULL);
|
|
|
|
|
if (msymbol != NULL)
|
|
|
|
|
val =
|
|
|
|
|
value_from_longest (lookup_pointer_type (lookup_function_type (
|
|
|
|
|
lookup_pointer_type (builtin_type_char))),
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
(LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
else
|
|
|
|
|
error ("String constants require the program to have a function \"malloc\".");
|
|
|
|
|
}
|
|
|
|
|
|
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* value.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
* eval.c, findvar.c, printcmd.c, valarith.c, valops.c: Pass
the correct pointer type to value_from_long{est}.
* remote-vx.c: Remove obsolete code for calling functions via
vxworks kludge interface (it referenced value_from_long).
* valops.c (value_string): Find malloc with lookup_misc_func, not
raw search.
* breakpoint.c, remote-vx.c: Reword strings printed by
catch_errors callers.
1991-09-06 09:09:40 +02:00
|
|
|
|
blocklen = value_from_longest (builtin_type_int, (LONGEST) (len + 1));
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 02:34:46 +01:00
|
|
|
|
val = call_function_by_hand (val, 1, &blocklen);
|
1992-11-24 04:02:10 +01:00
|
|
|
|
if (value_logical_not (val))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
error ("No memory available for string constant.");
|
1992-11-24 04:02:10 +01:00
|
|
|
|
write_memory (value_as_pointer (val), ptr, len + 1);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
VALUE_TYPE (val) = lookup_pointer_type (builtin_type_char);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function used by value_struct_elt to recurse through baseclasses.
|
|
|
|
|
Look for a field NAME in ARG1. Adjust the address of ARG1 by OFFSET bytes,
|
1991-12-05 12:56:20 +01:00
|
|
|
|
and search in it assuming it has (class) type TYPE.
|
1991-04-27 01:02:15 +02:00
|
|
|
|
If found, return value, else return NULL.
|
|
|
|
|
|
|
|
|
|
If LOOKING_FOR_BASECLASS, then instead of looking for struct fields,
|
|
|
|
|
look for a baseclass named NAME. */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
static value
|
1991-04-27 01:02:15 +02:00
|
|
|
|
search_struct_field (name, arg1, offset, type, looking_for_baseclass)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
char *name;
|
|
|
|
|
register value arg1;
|
|
|
|
|
int offset;
|
|
|
|
|
register struct type *type;
|
1991-04-27 01:02:15 +02:00
|
|
|
|
int looking_for_baseclass;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
check_stub_type (type);
|
|
|
|
|
|
1991-04-27 01:02:15 +02:00
|
|
|
|
if (! looking_for_baseclass)
|
|
|
|
|
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
|
|
|
|
|
{
|
|
|
|
|
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
|
|
|
|
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (t_field_name && STREQ (t_field_name, name))
|
1991-04-27 01:02:15 +02:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
value v;
|
|
|
|
|
if (TYPE_FIELD_STATIC (type, i))
|
|
|
|
|
{
|
|
|
|
|
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, i);
|
|
|
|
|
struct symbol *sym =
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
|
|
|
|
if (sym == NULL)
|
|
|
|
|
error ("Internal error: could not find physical static variable named %s",
|
|
|
|
|
phys_name);
|
1992-03-20 22:57:17 +01:00
|
|
|
|
v = value_at (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
v = value_primitive_field (arg1, offset, i, type);
|
1991-04-27 01:02:15 +02:00
|
|
|
|
if (v == 0)
|
|
|
|
|
error("there is no field named %s", name);
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
}
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
value v;
|
|
|
|
|
/* If we are looking for baseclasses, this is what we get when we
|
|
|
|
|
hit them. */
|
1991-04-27 01:02:15 +02:00
|
|
|
|
int found_baseclass = (looking_for_baseclass
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
&& STREQ (name, TYPE_BASECLASS_NAME (type, i)));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
if (BASETYPE_VIA_VIRTUAL (type, i))
|
|
|
|
|
{
|
|
|
|
|
value v2;
|
1992-11-24 04:02:10 +01:00
|
|
|
|
/* Fix to use baseclass_offset instead. FIXME */
|
1991-05-30 10:52:52 +02:00
|
|
|
|
baseclass_addr (type, i, VALUE_CONTENTS (arg1) + offset,
|
|
|
|
|
&v2, (int *)NULL);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (v2 == 0)
|
|
|
|
|
error ("virtual baseclass botch");
|
|
|
|
|
if (found_baseclass)
|
|
|
|
|
return v2;
|
1991-04-27 01:02:15 +02:00
|
|
|
|
v = search_struct_field (name, v2, 0, TYPE_BASECLASS (type, i),
|
|
|
|
|
looking_for_baseclass);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
1992-03-20 22:57:17 +01:00
|
|
|
|
else if (found_baseclass)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
v = value_primitive_field (arg1, offset, i, type);
|
|
|
|
|
else
|
|
|
|
|
v = search_struct_field (name, arg1,
|
|
|
|
|
offset + TYPE_BASECLASS_BITPOS (type, i) / 8,
|
1991-04-27 01:02:15 +02:00
|
|
|
|
TYPE_BASECLASS (type, i),
|
|
|
|
|
looking_for_baseclass);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (v) return v;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function used by value_struct_elt to recurse through baseclasses.
|
|
|
|
|
Look for a field NAME in ARG1. Adjust the address of ARG1 by OFFSET bytes,
|
1991-12-05 12:56:20 +01:00
|
|
|
|
and search in it assuming it has (class) type TYPE.
|
1991-03-28 17:26:26 +01:00
|
|
|
|
If found, return value, else return NULL. */
|
|
|
|
|
|
|
|
|
|
static value
|
1992-11-24 04:02:10 +01:00
|
|
|
|
search_struct_method (name, arg1p, args, offset, static_memfuncp, type)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
char *name;
|
1992-11-24 04:02:10 +01:00
|
|
|
|
register value *arg1p, *args;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
int offset, *static_memfuncp;
|
|
|
|
|
register struct type *type;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
check_stub_type (type);
|
|
|
|
|
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (t_field_name && STREQ (t_field_name, name))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1991-04-27 01:02:15 +02:00
|
|
|
|
int j = TYPE_FN_FIELDLIST_LENGTH (type, i) - 1;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
|
|
|
|
|
1991-04-27 01:02:15 +02:00
|
|
|
|
if (j > 0 && args == 0)
|
|
|
|
|
error ("cannot resolve overloaded method `%s'", name);
|
|
|
|
|
while (j >= 0)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1991-12-30 20:22:29 +01:00
|
|
|
|
if (TYPE_FN_FIELD_STUB (f, j))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
check_stub_method (type, i, j);
|
|
|
|
|
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
|
|
|
|
|
TYPE_FN_FIELD_ARGS (f, j), args))
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
|
1992-11-24 04:02:10 +01:00
|
|
|
|
return (value)value_virtual_fn_field (arg1p, f, j, type, offset);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
|
|
|
|
|
*static_memfuncp = 1;
|
1992-11-24 04:02:10 +01:00
|
|
|
|
return (value)value_fn_field (arg1p, f, j, type, offset);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
1991-04-27 01:02:15 +02:00
|
|
|
|
j--;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-11-24 04:02:10 +01:00
|
|
|
|
value v;
|
1992-03-20 22:57:17 +01:00
|
|
|
|
int base_offset;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
if (BASETYPE_VIA_VIRTUAL (type, i))
|
|
|
|
|
{
|
* hppa-pinsn.c (print_insn): Improve handling of be and ble
branch targets to compute target address using const from previous
instruction if necessary.
* Add `Q' operator to print out bit position field various
instructions.
* hppah-nat.c: #include sys/param.h, and sys/user.h. General
cleanups, use new code from Utah.
* (store_inferior_registers): Update to new code from Utah.
* (initialize_kernel_u_addr): Re-enable decl of struct user u.
* (fetch_register): Clear out priv level when reading PCs.
* hppah-tdep.c: Get rid of gobs of KERNELDEBUG stuff.
* Remove decl of errno, #include wait.h and target.h.
* (frame_saved_pc): Check `flags' pseudo-register to see if we
were inside of a kernel call. If so, then PC is in a different
register. Also, mask out bottom two bits of all PCs so as not to
confuse higher level code.
* (push_dummy_frame): Create from #define in tm-hppa.h.
* (find_dummy_frame_regs): Update from Utah.
* (hp_pop_frame): Create from #define in tm-hppa.h.
* (hp_restore_pc_queue): New, from Utah.
* (hp_push_arguments): Big fixes from Utah.
* (pa_do_registers_info, pa_print_registers): Only print out fp
regs upon request.
* (skip_trampoline_code): New routine to deal with stubs that
live in nowhereland between callers and callees.
* i860-tdep.c: Remove decl of attach_flag.
* infrun.c (wait_for_inferior): Add new macro
INSTRUCTION_NULLIFIED, which can tell if the instruction pointed
at by PC will be nullified. If so, then step the target once more
so as to avoid confusing the user.
* (just before step_over_function:): Use stop_func_start, not
stop_pc when checking for the existance of line number info.
stop_func_start will reflect the proper address of the target
routine, not of the stub that we may be traversing to get there.
* tm-hppa.h: define SKIP_TRAMPOLINE_CODE and IN_SOLIB_TRAMPOLINE
to deal with the stubs that PA compilers sometimes stick between
callers and callees. Also, define FLAGS_REGNUM for access to the
`flags' pseudo-reg.
* (REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use
memcpy, not bcopy.
* (CANNOT_STORE_REGISTER): New from Utah. Says that we can't
write gr0, PC regs, and PSW!
* (FRAME_FIND_SAVED_REGS): Bug fixes from Utah.
* (PUSH_DUMMY_FRAME, POP_FRAME): Make into real routines in
hppah-nat.c.
* (CALL_DUMMY, FIX_CALL_DUMMY): Fixes from Utah.
* Define struct unwind_table_entry.
* valops.c (call_function_by_hand): Add another arg to
FIX_CALL_DUMMY (under #ifdef GDB_TARGET_IS_HPPA). Why is this
necessary?
1992-12-22 04:18:46 +01:00
|
|
|
|
base_offset = baseclass_offset (type, i, *arg1p, offset);
|
1992-11-24 04:02:10 +01:00
|
|
|
|
if (base_offset == -1)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
error ("virtual baseclass botch");
|
|
|
|
|
}
|
1992-03-20 22:57:17 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
base_offset = TYPE_BASECLASS_BITPOS (type, i) / 8;
|
|
|
|
|
}
|
1992-11-24 04:02:10 +01:00
|
|
|
|
v = search_struct_method (name, arg1p, args, base_offset + offset,
|
1991-03-28 17:26:26 +01:00
|
|
|
|
static_memfuncp, TYPE_BASECLASS (type, i));
|
1992-11-24 04:02:10 +01:00
|
|
|
|
if (v)
|
|
|
|
|
{
|
|
|
|
|
/* FIXME-bothner: Why is this commented out? Why is it here? */
|
|
|
|
|
/* *arg1p = arg1_tmp;*/
|
|
|
|
|
return v;
|
|
|
|
|
}
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given *ARGP, a value of type (pointer to a)* structure/union,
|
|
|
|
|
extract the component named NAME from the ultimate target structure/union
|
|
|
|
|
and return it as a value with its appropriate type.
|
|
|
|
|
ERR is used in the error message if *ARGP's type is wrong.
|
|
|
|
|
|
|
|
|
|
C++: ARGS is a list of argument types to aid in the selection of
|
|
|
|
|
an appropriate method. Also, handle derived types.
|
|
|
|
|
|
|
|
|
|
STATIC_MEMFUNCP, if non-NULL, points to a caller-supplied location
|
|
|
|
|
where the truthvalue of whether the function that was resolved was
|
|
|
|
|
a static member function or not is stored.
|
|
|
|
|
|
|
|
|
|
ERR is an error message to be printed in case the field is not found. */
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
value_struct_elt (argp, args, name, static_memfuncp, err)
|
|
|
|
|
register value *argp, *args;
|
|
|
|
|
char *name;
|
|
|
|
|
int *static_memfuncp;
|
|
|
|
|
char *err;
|
|
|
|
|
{
|
|
|
|
|
register struct type *t;
|
|
|
|
|
value v;
|
|
|
|
|
|
|
|
|
|
COERCE_ARRAY (*argp);
|
|
|
|
|
|
|
|
|
|
t = VALUE_TYPE (*argp);
|
|
|
|
|
|
|
|
|
|
/* Follow pointers until we get to a non-pointer. */
|
|
|
|
|
|
|
|
|
|
while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
|
|
|
|
|
{
|
|
|
|
|
*argp = value_ind (*argp);
|
1991-04-20 05:57:50 +02:00
|
|
|
|
/* Don't coerce fn pointer to fn and then back again! */
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC)
|
|
|
|
|
COERCE_ARRAY (*argp);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
t = VALUE_TYPE (*argp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (t) == TYPE_CODE_MEMBER)
|
|
|
|
|
error ("not implemented: member type in value_struct_elt");
|
|
|
|
|
|
1991-12-05 12:56:20 +01:00
|
|
|
|
if ( TYPE_CODE (t) != TYPE_CODE_STRUCT
|
1991-03-28 17:26:26 +01:00
|
|
|
|
&& TYPE_CODE (t) != TYPE_CODE_UNION)
|
|
|
|
|
error ("Attempt to extract a component of a value that is not a %s.", err);
|
|
|
|
|
|
|
|
|
|
/* Assume it's not, unless we see that it is. */
|
|
|
|
|
if (static_memfuncp)
|
|
|
|
|
*static_memfuncp =0;
|
|
|
|
|
|
|
|
|
|
if (!args)
|
|
|
|
|
{
|
|
|
|
|
/* if there are no arguments ...do this... */
|
|
|
|
|
|
1991-04-27 01:02:15 +02:00
|
|
|
|
/* Try as a field first, because if we succeed, there
|
1991-03-28 17:26:26 +01:00
|
|
|
|
is less work to be done. */
|
1991-04-27 01:02:15 +02:00
|
|
|
|
v = search_struct_field (name, *argp, 0, t, 0);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (v)
|
|
|
|
|
return v;
|
|
|
|
|
|
|
|
|
|
/* C++: If it was not found as a data field, then try to
|
|
|
|
|
return it as a pointer to a method. */
|
|
|
|
|
|
|
|
|
|
if (destructor_name_p (name, t))
|
|
|
|
|
error ("Cannot get value of destructor");
|
|
|
|
|
|
1992-11-24 04:02:10 +01:00
|
|
|
|
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
if (v == 0)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_NFN_FIELDS (t))
|
|
|
|
|
error ("There is no member or method named %s.", name);
|
|
|
|
|
else
|
|
|
|
|
error ("There is no member named %s.", name);
|
|
|
|
|
}
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (destructor_name_p (name, t))
|
|
|
|
|
{
|
|
|
|
|
if (!args[1])
|
|
|
|
|
{
|
|
|
|
|
/* destructors are a special case. */
|
1992-11-24 04:02:10 +01:00
|
|
|
|
return (value)value_fn_field (NULL, TYPE_FN_FIELDLIST1 (t, 0),
|
|
|
|
|
TYPE_FN_FIELDLIST_LENGTH (t, 0),
|
|
|
|
|
0, 0);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error ("destructor should not have any argument");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
1992-11-24 04:02:10 +01:00
|
|
|
|
v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
if (v == 0)
|
|
|
|
|
{
|
|
|
|
|
/* See if user tried to invoke data as function. If so,
|
|
|
|
|
hand it back. If it's not callable (i.e., a pointer to function),
|
|
|
|
|
gdb should give an error. */
|
1991-04-27 01:02:15 +02:00
|
|
|
|
v = search_struct_field (name, *argp, 0, t, 0);
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
|
error ("Structure has no component named %s.", name);
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* C++: return 1 is NAME is a legitimate name for the destructor
|
|
|
|
|
of type TYPE. If TYPE does not have a destructor, or
|
|
|
|
|
if NAME is inappropriate for TYPE, an error is signaled. */
|
|
|
|
|
int
|
|
|
|
|
destructor_name_p (name, type)
|
* tm-sparc.h, tm-sysv4.h, solib.h: Move shared lib definitions
into solib.h.
* sparc-pinsn.c, sparc-tdep.c, standalonec, sun3-xdep.c,
sun386-xdep.c, symm-xdep.c, target.c, ultra3-xdep.c, utils.c,
value.h: Prototypes for static functions; lint.
* gdbtypes.h: Empty file to ease transition.
1992-02-21 04:35:37 +01:00
|
|
|
|
const char *name;
|
|
|
|
|
const struct type *type;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* destructors are a special case. */
|
|
|
|
|
|
|
|
|
|
if (name[0] == '~')
|
|
|
|
|
{
|
|
|
|
|
char *dname = type_name_no_tag (type);
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (!STREQ (dname, name+1))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
error ("name of destructor must equal name of class");
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function for check_field: Given TYPE, a structure/union,
|
|
|
|
|
return 1 if the component named NAME from the ultimate
|
|
|
|
|
target structure/union is defined, otherwise, return 0. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
check_field_in (type, name)
|
|
|
|
|
register struct type *type;
|
1992-03-20 22:57:17 +01:00
|
|
|
|
const char *name;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
|
|
|
|
|
{
|
|
|
|
|
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (t_field_name && STREQ (t_field_name, name))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* C++: If it was not found as a data field, then try to
|
|
|
|
|
return it as a pointer to a method. */
|
|
|
|
|
|
|
|
|
|
/* Destructors are a special case. */
|
|
|
|
|
if (destructor_name_p (name, type))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
|
|
|
|
|
{
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (STREQ (TYPE_FN_FIELDLIST_NAME (type, i), name))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
|
|
|
|
|
if (check_field_in (TYPE_BASECLASS (type, i), name))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* C++: Given ARG1, a value of type (pointer to a)* structure/union,
|
|
|
|
|
return 1 if the component named NAME from the ultimate
|
|
|
|
|
target structure/union is defined, otherwise, return 0. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
check_field (arg1, name)
|
1992-03-20 22:57:17 +01:00
|
|
|
|
register value arg1;
|
* tm-sparc.h, tm-sysv4.h, solib.h: Move shared lib definitions
into solib.h.
* sparc-pinsn.c, sparc-tdep.c, standalonec, sun3-xdep.c,
sun386-xdep.c, symm-xdep.c, target.c, ultra3-xdep.c, utils.c,
value.h: Prototypes for static functions; lint.
* gdbtypes.h: Empty file to ease transition.
1992-02-21 04:35:37 +01:00
|
|
|
|
const char *name;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
|
|
|
|
register struct type *t;
|
|
|
|
|
|
|
|
|
|
COERCE_ARRAY (arg1);
|
|
|
|
|
|
|
|
|
|
t = VALUE_TYPE (arg1);
|
|
|
|
|
|
|
|
|
|
/* Follow pointers until we get to a non-pointer. */
|
|
|
|
|
|
|
|
|
|
while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
|
|
|
|
|
t = TYPE_TARGET_TYPE (t);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (t) == TYPE_CODE_MEMBER)
|
|
|
|
|
error ("not implemented: member type in check_field");
|
|
|
|
|
|
1991-12-05 12:56:20 +01:00
|
|
|
|
if ( TYPE_CODE (t) != TYPE_CODE_STRUCT
|
1991-03-28 17:26:26 +01:00
|
|
|
|
&& TYPE_CODE (t) != TYPE_CODE_UNION)
|
|
|
|
|
error ("Internal error: `this' is not an aggregate");
|
|
|
|
|
|
|
|
|
|
return check_field_in (t, name);
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
/* C++: Given an aggregate type CURTYPE, and a member name NAME,
|
1991-12-05 12:56:20 +01:00
|
|
|
|
return the address of this member as a "pointer to member"
|
1991-03-28 17:26:26 +01:00
|
|
|
|
type. If INTYPE is non-null, then it will be the type
|
|
|
|
|
of the member we are looking for. This will help us resolve
|
1992-03-20 22:57:17 +01:00
|
|
|
|
"pointers to member functions". This function is used
|
|
|
|
|
to resolve user expressions of the form "DOMAIN::NAME". */
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
|
|
|
|
value
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
value_struct_elt_for_reference (domain, offset, curtype, name, intype)
|
1992-03-20 22:57:17 +01:00
|
|
|
|
struct type *domain, *curtype, *intype;
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
int offset;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
char *name;
|
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
register struct type *t = curtype;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
register int i;
|
|
|
|
|
value v;
|
|
|
|
|
|
1991-12-05 12:56:20 +01:00
|
|
|
|
if ( TYPE_CODE (t) != TYPE_CODE_STRUCT
|
1991-03-28 17:26:26 +01:00
|
|
|
|
&& TYPE_CODE (t) != TYPE_CODE_UNION)
|
1992-03-20 22:57:17 +01:00
|
|
|
|
error ("Internal error: non-aggregate type to value_struct_elt_for_reference");
|
1991-03-28 17:26:26 +01:00
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); i--)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
char *t_field_name = TYPE_FIELD_NAME (t, i);
|
|
|
|
|
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (t_field_name && STREQ (t_field_name, name))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
if (TYPE_FIELD_STATIC (t, i))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (t, i);
|
|
|
|
|
struct symbol *sym =
|
|
|
|
|
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (sym == NULL)
|
|
|
|
|
error ("Internal error: could not find physical static variable named %s",
|
1992-03-20 22:57:17 +01:00
|
|
|
|
phys_name);
|
|
|
|
|
return value_at (SYMBOL_TYPE (sym),
|
|
|
|
|
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
1992-03-20 22:57:17 +01:00
|
|
|
|
if (TYPE_FIELD_PACKED (t, i))
|
|
|
|
|
error ("pointers to bitfield members not allowed");
|
|
|
|
|
|
|
|
|
|
return value_from_longest
|
|
|
|
|
(lookup_reference_type (lookup_member_type (TYPE_FIELD_TYPE (t, i),
|
|
|
|
|
domain)),
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* C++: If it was not found as a data field, then try to
|
|
|
|
|
return it as a pointer to a method. */
|
|
|
|
|
|
|
|
|
|
/* Destructors are a special case. */
|
|
|
|
|
if (destructor_name_p (name, t))
|
|
|
|
|
{
|
1991-12-05 12:56:20 +01:00
|
|
|
|
error ("member pointers to destructors not implemented yet");
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Perform all necessary dereferencing. */
|
|
|
|
|
while (intype && TYPE_CODE (intype) == TYPE_CODE_PTR)
|
|
|
|
|
intype = TYPE_TARGET_TYPE (intype);
|
|
|
|
|
|
1992-03-20 22:57:17 +01:00
|
|
|
|
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 07:34:57 +01:00
|
|
|
|
if (STREQ (TYPE_FN_FIELDLIST_NAME (t, i), name))
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
|
|
|
|
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
|
|
|
|
|
|
|
|
|
|
if (intype == 0 && j > 1)
|
|
|
|
|
error ("non-unique member `%s' requires type instantiation", name);
|
|
|
|
|
if (intype)
|
1991-03-28 17:26:26 +01:00
|
|
|
|
{
|
1992-03-20 22:57:17 +01:00
|
|
|
|
while (j--)
|
|
|
|
|
if (TYPE_FN_FIELD_TYPE (f, j) == intype)
|
|
|
|
|
break;
|
|
|
|
|
if (j < 0)
|
|
|
|
|
error ("no member function matches that type instantiation");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
if (TYPE_FN_FIELD_STUB (f, j))
|
|
|
|
|
check_stub_method (t, i, j);
|
|
|
|
|
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
|
|
|
|
|
{
|
|
|
|
|
return value_from_longest
|
|
|
|
|
(lookup_reference_type
|
|
|
|
|
(lookup_member_type (TYPE_FN_FIELD_TYPE (f, j),
|
|
|
|
|
domain)),
|
1992-11-24 04:02:10 +01:00
|
|
|
|
(LONGEST) METHOD_PTR_FROM_VOFFSET
|
|
|
|
|
(TYPE_FN_FIELD_VOFFSET (f, j)));
|
1992-03-20 22:57:17 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct symbol *s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
|
|
|
|
|
0, VAR_NAMESPACE, 0, NULL);
|
1992-09-04 09:37:18 +02:00
|
|
|
|
if (s == NULL)
|
|
|
|
|
{
|
|
|
|
|
v = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
v = read_var_value (s, 0);
|
1992-03-20 22:57:17 +01:00
|
|
|
|
#if 0
|
1992-09-04 09:37:18 +02:00
|
|
|
|
VALUE_TYPE (v) = lookup_reference_type
|
|
|
|
|
(lookup_member_type (TYPE_FN_FIELD_TYPE (f, j),
|
|
|
|
|
domain));
|
1992-03-20 22:57:17 +01:00
|
|
|
|
#endif
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
1992-09-04 09:37:18 +02:00
|
|
|
|
return v;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1992-09-04 09:37:18 +02:00
|
|
|
|
}
|
1992-03-20 22:57:17 +01:00
|
|
|
|
for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--)
|
|
|
|
|
{
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
value v;
|
|
|
|
|
int base_offset;
|
|
|
|
|
|
|
|
|
|
if (BASETYPE_VIA_VIRTUAL (t, i))
|
|
|
|
|
base_offset = 0;
|
|
|
|
|
else
|
|
|
|
|
base_offset = TYPE_BASECLASS_BITPOS (t, i) / 8;
|
1992-03-20 22:57:17 +01:00
|
|
|
|
v = value_struct_elt_for_reference (domain,
|
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
1992-06-30 01:34:38 +02:00
|
|
|
|
offset + base_offset,
|
1992-03-20 22:57:17 +01:00
|
|
|
|
TYPE_BASECLASS (t, i),
|
|
|
|
|
name,
|
|
|
|
|
intype);
|
|
|
|
|
if (v)
|
|
|
|
|
return v;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compare two argument lists and return the position in which they differ,
|
|
|
|
|
or zero if equal.
|
|
|
|
|
|
|
|
|
|
STATICP is nonzero if the T1 argument list came from a
|
|
|
|
|
static member function.
|
|
|
|
|
|
|
|
|
|
For non-static member functions, we ignore the first argument,
|
|
|
|
|
which is the type of the instance variable. This is because we want
|
|
|
|
|
to handle calls with objects from derived classes. This is not
|
|
|
|
|
entirely correct: we should actually check to make sure that a
|
|
|
|
|
requested operation is type secure, shouldn't we? FIXME. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
typecmp (staticp, t1, t2)
|
|
|
|
|
int staticp;
|
|
|
|
|
struct type *t1[];
|
|
|
|
|
value t2[];
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
1991-04-27 01:02:15 +02:00
|
|
|
|
if (t2 == 0)
|
|
|
|
|
return 1;
|
1991-03-28 17:26:26 +01:00
|
|
|
|
if (staticp && t1 == 0)
|
|
|
|
|
return t2[1] != 0;
|
|
|
|
|
if (t1 == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
if (t1[0]->code == TYPE_CODE_VOID) return 0;
|
|
|
|
|
if (t1[!staticp] == 0) return 0;
|
|
|
|
|
for (i = !staticp; t1[i] && t1[i]->code != TYPE_CODE_VOID; i++)
|
|
|
|
|
{
|
|
|
|
|
if (! t2[i]
|
|
|
|
|
|| t1[i]->code != t2[i]->type->code
|
|
|
|
|
/* Too pessimistic: || t1[i]->target_type != t2[i]->type->target_type */
|
|
|
|
|
)
|
|
|
|
|
return i+1;
|
|
|
|
|
}
|
|
|
|
|
if (!t1[i]) return 0;
|
|
|
|
|
return t2[i] ? i+1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* C++: return the value of the class instance variable, if one exists.
|
|
|
|
|
Flag COMPLAIN signals an error if the request is made in an
|
|
|
|
|
inappropriate context. */
|
|
|
|
|
value
|
|
|
|
|
value_of_this (complain)
|
|
|
|
|
int complain;
|
|
|
|
|
{
|
|
|
|
|
extern FRAME selected_frame;
|
|
|
|
|
struct symbol *func, *sym;
|
|
|
|
|
struct block *b;
|
|
|
|
|
int i;
|
|
|
|
|
static const char funny_this[] = "this";
|
|
|
|
|
value this;
|
|
|
|
|
|
|
|
|
|
if (selected_frame == 0)
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("no frame selected");
|
|
|
|
|
else return 0;
|
|
|
|
|
|
|
|
|
|
func = get_frame_function (selected_frame);
|
|
|
|
|
if (!func)
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("no `this' in nameless context");
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = SYMBOL_BLOCK_VALUE (func);
|
|
|
|
|
i = BLOCK_NSYMS (b);
|
|
|
|
|
if (i <= 0)
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("no args, no `this'");
|
|
|
|
|
else return 0;
|
|
|
|
|
|
|
|
|
|
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
|
|
|
|
|
symbol instead of the LOC_ARG one (if both exist). */
|
|
|
|
|
sym = lookup_block_symbol (b, funny_this, VAR_NAMESPACE);
|
|
|
|
|
if (sym == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("current stack frame not in method");
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this = read_var_value (sym, selected_frame);
|
|
|
|
|
if (this == 0 && complain)
|
|
|
|
|
error ("`this' argument at unknown address");
|
|
|
|
|
return this;
|
|
|
|
|
}
|