mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-12-01 07:50:49 +00:00
* symtab.c (_initialize_symtab): Remove builtin type
definition and initialization to *-exp.y. (lookup_primitive_typename): Use language-dependent vector. (lookup_typename): Fix bug, make it work if primitive typename. (lookup_unsigned_typename): Call above. (create_array_type): Set up range type for array index. (list_symbols): Call typedef_print to print typedefs. (Currently #ifndef FIXME'd out awaiting integration.)
This commit is contained in:
parent
ec99961f8a
commit
997a978c5d
288
gdb/symtab.c
288
gdb/symtab.c
@ -1,21 +1,21 @@
|
|||||||
/* Symbol table lookup for the GNU debugger, GDB.
|
/* Symbol table lookup for the GNU debugger, GDB.
|
||||||
Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
|
Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
GDB is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 1, or (at your option)
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
GDB is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with GDB; see the file COPYING. If not, write to
|
along with this program; if not, write to the Free Software
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
@ -28,6 +28,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
|
#include "language.h"
|
||||||
|
|
||||||
#include <obstack.h>
|
#include <obstack.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -51,22 +52,7 @@ static struct partial_symbol *lookup_partial_symbol ();
|
|||||||
static struct partial_symbol *lookup_demangled_partial_symbol ();
|
static struct partial_symbol *lookup_demangled_partial_symbol ();
|
||||||
static struct symbol *lookup_demangled_block_symbol ();
|
static struct symbol *lookup_demangled_block_symbol ();
|
||||||
|
|
||||||
/* These variables point to the objects
|
/* The single non-language-specific builtin type */
|
||||||
representing the predefined C data types. */
|
|
||||||
|
|
||||||
struct type *builtin_type_void;
|
|
||||||
struct type *builtin_type_char;
|
|
||||||
struct type *builtin_type_short;
|
|
||||||
struct type *builtin_type_int;
|
|
||||||
struct type *builtin_type_long;
|
|
||||||
struct type *builtin_type_long_long;
|
|
||||||
struct type *builtin_type_unsigned_char;
|
|
||||||
struct type *builtin_type_unsigned_short;
|
|
||||||
struct type *builtin_type_unsigned_int;
|
|
||||||
struct type *builtin_type_unsigned_long;
|
|
||||||
struct type *builtin_type_unsigned_long_long;
|
|
||||||
struct type *builtin_type_float;
|
|
||||||
struct type *builtin_type_double;
|
|
||||||
struct type *builtin_type_error;
|
struct type *builtin_type_error;
|
||||||
|
|
||||||
/* Block in which the most recently searched-for symbol was found.
|
/* Block in which the most recently searched-for symbol was found.
|
||||||
@ -271,21 +257,12 @@ struct type *
|
|||||||
lookup_primitive_typename (name)
|
lookup_primitive_typename (name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
if (!strcmp (name, "int"))
|
struct type ***p;
|
||||||
return builtin_type_int;
|
|
||||||
if (!strcmp (name, "long"))
|
for (p = current_language->la_builtin_type_vector; *p; p++)
|
||||||
return builtin_type_long;
|
if(!strcmp((**p)->name, name))
|
||||||
if (!strcmp (name, "short"))
|
return **p;
|
||||||
return builtin_type_short;
|
return 0;
|
||||||
if (!strcmp (name, "char"))
|
|
||||||
return builtin_type_char;
|
|
||||||
if (!strcmp (name, "float"))
|
|
||||||
return builtin_type_float;
|
|
||||||
if (!strcmp (name, "double"))
|
|
||||||
return builtin_type_double;
|
|
||||||
if (!strcmp (name, "void"))
|
|
||||||
return builtin_type_void;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup a typedef or primitive type named NAME,
|
/* Lookup a typedef or primitive type named NAME,
|
||||||
@ -304,9 +281,12 @@ lookup_typename (name, block, noerr)
|
|||||||
{
|
{
|
||||||
struct type *tmp;
|
struct type *tmp;
|
||||||
tmp = lookup_primitive_typename (name);
|
tmp = lookup_primitive_typename (name);
|
||||||
if (!tmp && noerr)
|
if(tmp)
|
||||||
|
return tmp;
|
||||||
|
else if (!tmp && noerr)
|
||||||
return 0;
|
return 0;
|
||||||
error ("No type named %s.", name);
|
else
|
||||||
|
error ("No type named %s.", name);
|
||||||
}
|
}
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
}
|
}
|
||||||
@ -315,16 +295,11 @@ struct type *
|
|||||||
lookup_unsigned_typename (name)
|
lookup_unsigned_typename (name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
if (!strcmp (name, "int"))
|
char *uns = alloca (strlen(name) + 10);
|
||||||
return builtin_type_unsigned_int;
|
|
||||||
if (!strcmp (name, "long"))
|
strcpy (uns, "unsigned ");
|
||||||
return builtin_type_unsigned_long;
|
strcpy (uns+9, name);
|
||||||
if (!strcmp (name, "short"))
|
return lookup_typename (uns, (struct block *)0, 0);
|
||||||
return builtin_type_unsigned_short;
|
|
||||||
if (!strcmp (name, "char"))
|
|
||||||
return builtin_type_unsigned_char;
|
|
||||||
error ("No type named unsigned %s.", name);
|
|
||||||
return (struct type *)-1; /* for lint */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup a structure type named "struct NAME",
|
/* Lookup a structure type named "struct NAME",
|
||||||
@ -752,6 +727,7 @@ create_array_type (element_type, number)
|
|||||||
{
|
{
|
||||||
struct type *result_type = (struct type *)
|
struct type *result_type = (struct type *)
|
||||||
obstack_alloc (symbol_obstack, sizeof (struct type));
|
obstack_alloc (symbol_obstack, sizeof (struct type));
|
||||||
|
struct type *range_type;
|
||||||
|
|
||||||
bzero (result_type, sizeof (struct type));
|
bzero (result_type, sizeof (struct type));
|
||||||
|
|
||||||
@ -761,7 +737,27 @@ create_array_type (element_type, number)
|
|||||||
TYPE_NFIELDS (result_type) = 1;
|
TYPE_NFIELDS (result_type) = 1;
|
||||||
TYPE_FIELDS (result_type) =
|
TYPE_FIELDS (result_type) =
|
||||||
(struct field *) obstack_alloc (symbol_obstack, sizeof (struct field));
|
(struct field *) obstack_alloc (symbol_obstack, sizeof (struct field));
|
||||||
TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int;
|
|
||||||
|
{
|
||||||
|
/* Create range type. */
|
||||||
|
range_type = (struct type *) obstack_alloc (symbol_obstack,
|
||||||
|
sizeof (struct type));
|
||||||
|
TYPE_CODE (range_type) = TYPE_CODE_RANGE;
|
||||||
|
TYPE_TARGET_TYPE (range_type) = builtin_type_int; /* FIXME */
|
||||||
|
|
||||||
|
/* This should never be needed. */
|
||||||
|
TYPE_LENGTH (range_type) = sizeof (int);
|
||||||
|
|
||||||
|
TYPE_NFIELDS (range_type) = 2;
|
||||||
|
TYPE_FIELDS (range_type) =
|
||||||
|
(struct field *) obstack_alloc (symbol_obstack,
|
||||||
|
2 * sizeof (struct field));
|
||||||
|
TYPE_FIELD_BITPOS (range_type, 0) = 0; /* FIXME */
|
||||||
|
TYPE_FIELD_BITPOS (range_type, 1) = number-1; /* FIXME */
|
||||||
|
TYPE_FIELD_TYPE (range_type, 0) = builtin_type_int; /* FIXME */
|
||||||
|
TYPE_FIELD_TYPE (range_type, 1) = builtin_type_int; /* FIXME */
|
||||||
|
}
|
||||||
|
TYPE_FIELD_TYPE(result_type,0)=range_type;
|
||||||
TYPE_VPTR_FIELDNO (result_type) = -1;
|
TYPE_VPTR_FIELDNO (result_type) = -1;
|
||||||
|
|
||||||
return result_type;
|
return result_type;
|
||||||
@ -1004,6 +1000,8 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
|
|||||||
if (ind != -1)
|
if (ind != -1)
|
||||||
{
|
{
|
||||||
s = find_pc_symtab (misc_function_vector[ind].address);
|
s = find_pc_symtab (misc_function_vector[ind].address);
|
||||||
|
/* If S is zero, there are no debug symbols for this file.
|
||||||
|
Skip this stuff and check for matching static symbols below. */
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
bv = BLOCKVECTOR (s);
|
bv = BLOCKVECTOR (s);
|
||||||
@ -1381,7 +1379,8 @@ find_pc_symtab (pc)
|
|||||||
{
|
{
|
||||||
ps = find_pc_psymtab (pc);
|
ps = find_pc_psymtab (pc);
|
||||||
if (ps && ps->readin)
|
if (ps && ps->readin)
|
||||||
fatal ("Internal error: pc in read in psymtab, but not in symtab.");
|
printf_filtered (
|
||||||
|
"(Internal error: pc in read in psymtab, but not in symtab.)\n");
|
||||||
|
|
||||||
if (ps)
|
if (ps)
|
||||||
s = PSYMTAB_TO_SYMTAB (ps);
|
s = PSYMTAB_TO_SYMTAB (ps);
|
||||||
@ -2081,8 +2080,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
|
|
||||||
if (s == 0 && default_symtab == 0)
|
if (s == 0 && default_symtab == 0)
|
||||||
{
|
{
|
||||||
if (symtab_list == 0 && partial_symtab_list == 0)
|
|
||||||
error (no_symtab_msg);
|
|
||||||
select_source_symtab (0);
|
select_source_symtab (0);
|
||||||
default_symtab = current_source_symtab;
|
default_symtab = current_source_symtab;
|
||||||
default_line = current_source_line;
|
default_line = current_source_line;
|
||||||
@ -2188,9 +2185,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
error ("Line number not known for symbol \"%s\"", copy);
|
error ("Line number not known for symbol \"%s\"", copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symtab_list == 0 && partial_symtab_list == 0)
|
|
||||||
error (no_symtab_msg);
|
|
||||||
|
|
||||||
if ((i = lookup_misc_func (copy)) >= 0)
|
if ((i = lookup_misc_func (copy)) >= 0)
|
||||||
{
|
{
|
||||||
val.symtab = 0;
|
val.symtab = 0;
|
||||||
@ -2204,6 +2198,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (symtab_list == 0 && partial_symtab_list == 0 && misc_function_count == 0)
|
||||||
|
error (no_symtab_msg);
|
||||||
|
|
||||||
error ("Function %s not defined.", copy);
|
error ("Function %s not defined.", copy);
|
||||||
return values; /* for lint */
|
return values; /* for lint */
|
||||||
}
|
}
|
||||||
@ -2439,6 +2436,7 @@ sources_info ()
|
|||||||
If CLASS is zero, list all symbols except functions and type names.
|
If CLASS is zero, list all symbols except functions and type names.
|
||||||
If CLASS is 1, list only functions.
|
If CLASS is 1, list only functions.
|
||||||
If CLASS is 2, list only type names.
|
If CLASS is 2, list only type names.
|
||||||
|
If CLASS is 3, list only method names.
|
||||||
|
|
||||||
BPT is non-zero if we should set a breakpoint at the functions
|
BPT is non-zero if we should set a breakpoint at the functions
|
||||||
we find. */
|
we find. */
|
||||||
@ -2461,6 +2459,13 @@ list_symbols (regexp, class, bpt)
|
|||||||
static char *classnames[]
|
static char *classnames[]
|
||||||
= {"variable", "function", "type", "method"};
|
= {"variable", "function", "type", "method"};
|
||||||
int found_in_file = 0;
|
int found_in_file = 0;
|
||||||
|
int found_misc = 0;
|
||||||
|
static enum misc_function_type types[]
|
||||||
|
= {mf_data, mf_text, mf_abs, mf_unknown};
|
||||||
|
static enum misc_function_type types2[]
|
||||||
|
= {mf_bss, mf_text, mf_abs, mf_unknown};
|
||||||
|
enum misc_function_type ourtype = types[class];
|
||||||
|
enum misc_function_type ourtype2 = types2[class];
|
||||||
|
|
||||||
if (regexp)
|
if (regexp)
|
||||||
if (0 != (val = re_comp (regexp)))
|
if (0 != (val = re_comp (regexp)))
|
||||||
@ -2504,7 +2509,7 @@ list_symbols (regexp, class, bpt)
|
|||||||
load the file and go on to the next one */
|
load the file and go on to the next one */
|
||||||
if ((regexp == 0 || re_exec (SYMBOL_NAME (psym)))
|
if ((regexp == 0 || re_exec (SYMBOL_NAME (psym)))
|
||||||
&& ((class == 0 && SYMBOL_CLASS (psym) != LOC_TYPEDEF
|
&& ((class == 0 && SYMBOL_CLASS (psym) != LOC_TYPEDEF
|
||||||
&& SYMBOL_CLASS (psym) != LOC_BLOCK)
|
&& SYMBOL_CLASS (psym) != LOC_BLOCK)
|
||||||
|| (class == 1 && SYMBOL_CLASS (psym) == LOC_BLOCK)
|
|| (class == 1 && SYMBOL_CLASS (psym) == LOC_BLOCK)
|
||||||
|| (class == 2 && SYMBOL_CLASS (psym) == LOC_TYPEDEF)
|
|| (class == 2 && SYMBOL_CLASS (psym) == LOC_TYPEDEF)
|
||||||
|| (class == 3 && SYMBOL_CLASS (psym) == LOC_BLOCK)))
|
|| (class == 3 && SYMBOL_CLASS (psym) == LOC_BLOCK)))
|
||||||
@ -2517,20 +2522,23 @@ list_symbols (regexp, class, bpt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here, *if* the class is correct (function only, right now), we
|
/* Here, we search through the misc function vector for functions that
|
||||||
search through the misc function vector for symbols that
|
|
||||||
match, and call find_pc_symtab on them to force their symbols to
|
match, and call find_pc_symtab on them to force their symbols to
|
||||||
be read. The symbol will then be found during the scan of symtabs
|
be read. The symbol will then be found during the scan of symtabs
|
||||||
below. */
|
below. If find_pc_symtab fails, set found_misc so that we will
|
||||||
|
rescan to print any matching symbols without debug info. */
|
||||||
|
|
||||||
if (class == 1)
|
if (class == 1) {
|
||||||
{
|
for (i = 0; i < misc_function_count; i++) {
|
||||||
for (i = 0; i < misc_function_count; i++)
|
if (misc_function_vector[i].type != ourtype
|
||||||
if (regexp == 0 || re_exec (misc_function_vector[i].name))
|
&& misc_function_vector[i].type != ourtype2)
|
||||||
{
|
continue;
|
||||||
(void) find_pc_symtab (misc_function_vector[i].address);
|
if (regexp == 0 || re_exec (misc_function_vector[i].name)) {
|
||||||
}
|
if (0 == find_pc_symtab (misc_function_vector[i].address))
|
||||||
|
found_misc = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Printout here so as to get after the "Reading in symbols"
|
/* Printout here so as to get after the "Reading in symbols"
|
||||||
messages which will be generated above. */
|
messages which will be generated above. */
|
||||||
@ -2563,7 +2571,7 @@ list_symbols (regexp, class, bpt)
|
|||||||
sym = BLOCK_SYM (b, j);
|
sym = BLOCK_SYM (b, j);
|
||||||
if ((regexp == 0 || re_exec (SYMBOL_NAME (sym)))
|
if ((regexp == 0 || re_exec (SYMBOL_NAME (sym)))
|
||||||
&& ((class == 0 && SYMBOL_CLASS (sym) != LOC_TYPEDEF
|
&& ((class == 0 && SYMBOL_CLASS (sym) != LOC_TYPEDEF
|
||||||
&& SYMBOL_CLASS (sym) != LOC_BLOCK)
|
&& SYMBOL_CLASS (sym) != LOC_BLOCK)
|
||||||
|| (class == 1 && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
|| (class == 1 && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
|| (class == 2 && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
|| (class == 2 && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||||
|| (class == 3 && SYMBOL_CLASS (sym) == LOC_BLOCK)))
|
|| (class == 3 && SYMBOL_CLASS (sym) == LOC_BLOCK)))
|
||||||
@ -2584,28 +2592,27 @@ list_symbols (regexp, class, bpt)
|
|||||||
|
|
||||||
if (class != 2 && i == STATIC_BLOCK)
|
if (class != 2 && i == STATIC_BLOCK)
|
||||||
printf_filtered ("static ");
|
printf_filtered ("static ");
|
||||||
|
|
||||||
|
/* Typedef that is not a C++ class */
|
||||||
if (class == 2
|
if (class == 2
|
||||||
&& SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
|
&& SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
|
||||||
printf_filtered ("typedef ");
|
#ifndef FIXME
|
||||||
|
/* We haven't integrated this from A. Beers yet */
|
||||||
if (class < 3)
|
error ("typedef_print(SYMBOL_TYPE(sym),sym,stdout);");
|
||||||
|
#else
|
||||||
|
typedef_print(SYMBOL_TYPE(sym),sym,stdout);
|
||||||
|
#endif
|
||||||
|
/* variable, func, or typedef-that-is-c++-class */
|
||||||
|
else if (class < 2 ||
|
||||||
|
(class == 2 &&
|
||||||
|
SYMBOL_NAMESPACE(sym) == STRUCT_NAMESPACE))
|
||||||
{
|
{
|
||||||
type_print (SYMBOL_TYPE (sym),
|
type_print (SYMBOL_TYPE (sym),
|
||||||
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
||||||
? "" : SYMBOL_NAME (sym)),
|
? "" : SYMBOL_NAME (sym)),
|
||||||
stdout, 0);
|
stdout, 0);
|
||||||
|
|
||||||
if (class == 2
|
printf_filtered (";\n");
|
||||||
&& SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE
|
|
||||||
&& (TYPE_NAME ((SYMBOL_TYPE (sym))) == 0
|
|
||||||
|| 0 != strcmp (TYPE_NAME ((SYMBOL_TYPE (sym))),
|
|
||||||
SYMBOL_NAME (sym))))
|
|
||||||
{
|
|
||||||
fputs_filtered (" ", stdout);
|
|
||||||
fprint_symbol (stdout, SYMBOL_NAME (sym));
|
|
||||||
}
|
|
||||||
|
|
||||||
printf_filtered (";\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2622,6 +2629,36 @@ list_symbols (regexp, class, bpt)
|
|||||||
}
|
}
|
||||||
prev_bv = bv;
|
prev_bv = bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* If there are no eyes, avoid all contact. I mean, if there are
|
||||||
|
no debug symbols, then print directly from the misc_function_vector. */
|
||||||
|
|
||||||
|
if (found_misc || class != 1) {
|
||||||
|
found_in_file = 0;
|
||||||
|
for (i = 0; i < misc_function_count; i++) {
|
||||||
|
if (misc_function_vector[i].type != ourtype
|
||||||
|
&& misc_function_vector[i].type != ourtype2)
|
||||||
|
continue;
|
||||||
|
if (regexp == 0 || re_exec (misc_function_vector[i].name)) {
|
||||||
|
/* Functions: Look up by address. */
|
||||||
|
if (class == 1)
|
||||||
|
if (0 != find_pc_symtab (misc_function_vector[i].address))
|
||||||
|
continue;
|
||||||
|
/* Variables/Absolutes: Look up by name */
|
||||||
|
if (0 != lookup_symbol (misc_function_vector[i].name,
|
||||||
|
(struct block *)0, VAR_NAMESPACE, 0, (struct symtab **)0))
|
||||||
|
continue;
|
||||||
|
if (!found_in_file) {
|
||||||
|
printf_filtered ("\nNon-debugging symbols:\n");
|
||||||
|
found_in_file = 1;
|
||||||
|
}
|
||||||
|
printf_filtered (" %08x %s\n",
|
||||||
|
misc_function_vector[i].address,
|
||||||
|
misc_function_vector[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2663,9 +2700,8 @@ rbreak_command (regexp)
|
|||||||
list_symbols (regexp, 1, 1);
|
list_symbols (regexp, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the standard C scalar types. */
|
/* Helper function to initialize the standard scalar types. */
|
||||||
|
|
||||||
static
|
|
||||||
struct type *
|
struct type *
|
||||||
init_type (code, length, uns, name)
|
init_type (code, length, uns, name)
|
||||||
enum type_code code;
|
enum type_code code;
|
||||||
@ -2849,6 +2885,51 @@ make_symbol_completion_list (text)
|
|||||||
return (return_val);
|
return (return_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Add the type of the symbol sym to the type of the current
|
||||||
|
function whose block we are in (assumed). The type of
|
||||||
|
this current function is contained in *TYPE.
|
||||||
|
|
||||||
|
This basically works as follows: When we find a function
|
||||||
|
symbol (N_FUNC with a 'f' or 'F' in the symbol name), we record
|
||||||
|
a pointer to its type in the global in_function_type. Every
|
||||||
|
time we come across a parameter symbol ('p' in its name), then
|
||||||
|
this procedure adds the name and type of that parameter
|
||||||
|
to the function type pointed to by *TYPE. (Which should correspond
|
||||||
|
to in_function_type if it was called correctly).
|
||||||
|
|
||||||
|
Note that since we are modifying a type, the result of
|
||||||
|
lookup_function_type() should be bcopy()ed before calling
|
||||||
|
this. When not in strict typing mode, the expression
|
||||||
|
evaluator can choose to ignore this.
|
||||||
|
|
||||||
|
Assumption: All of a function's parameter symbols will
|
||||||
|
appear before another function symbol is found. The parameters
|
||||||
|
appear in the same order in the argument list as they do in the
|
||||||
|
symbol table. */
|
||||||
|
|
||||||
|
void
|
||||||
|
add_param_to_type (type,sym)
|
||||||
|
struct type **type;
|
||||||
|
struct symbol *sym;
|
||||||
|
{
|
||||||
|
int num = ++(TYPE_NFIELDS(*type));
|
||||||
|
|
||||||
|
if(TYPE_NFIELDS(*type)-1)
|
||||||
|
TYPE_FIELDS(*type) =
|
||||||
|
(struct field *)xrealloc((char *)(TYPE_FIELDS(*type)),
|
||||||
|
num*sizeof(struct field));
|
||||||
|
else
|
||||||
|
TYPE_FIELDS(*type) =
|
||||||
|
(struct field *)xmalloc(num*sizeof(struct field));
|
||||||
|
|
||||||
|
TYPE_FIELD_BITPOS(*type,num-1) = num-1;
|
||||||
|
TYPE_FIELD_BITSIZE(*type,num-1) = 0;
|
||||||
|
TYPE_FIELD_TYPE(*type,num-1) = SYMBOL_TYPE(sym);
|
||||||
|
TYPE_FIELD_NAME(*type,num-1) = SYMBOL_NAME(sym);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_symtab ()
|
_initialize_symtab ()
|
||||||
{
|
{
|
||||||
@ -2881,31 +2962,6 @@ are listed.");
|
|||||||
add_com ("rbreak", no_class, rbreak_command,
|
add_com ("rbreak", no_class, rbreak_command,
|
||||||
"Set a breakpoint for all functions matching REGEXP.");
|
"Set a breakpoint for all functions matching REGEXP.");
|
||||||
|
|
||||||
/* FIXME: The code below assumes that the sizes of the basic data
|
/* Initialize the one built-in type that isn't language dependent... */
|
||||||
types are the same on the host and target machines!!! */
|
|
||||||
|
|
||||||
builtin_type_void = init_type (TYPE_CODE_VOID, 1, 0, "void");
|
|
||||||
|
|
||||||
builtin_type_float = init_type (TYPE_CODE_FLT, sizeof (float), 0, "float");
|
|
||||||
builtin_type_double = init_type (TYPE_CODE_FLT, sizeof (double), 0, "double");
|
|
||||||
|
|
||||||
builtin_type_char = init_type (TYPE_CODE_INT, sizeof (char), 0, "char");
|
|
||||||
builtin_type_short = init_type (TYPE_CODE_INT, sizeof (short), 0, "short");
|
|
||||||
builtin_type_long = init_type (TYPE_CODE_INT, sizeof (long), 0, "long");
|
|
||||||
builtin_type_int = init_type (TYPE_CODE_INT, sizeof (int), 0, "int");
|
|
||||||
|
|
||||||
builtin_type_unsigned_char = init_type (TYPE_CODE_INT, sizeof (char), 1, "unsigned char");
|
|
||||||
builtin_type_unsigned_short = init_type (TYPE_CODE_INT, sizeof (short), 1, "unsigned short");
|
|
||||||
builtin_type_unsigned_long = init_type (TYPE_CODE_INT, sizeof (long), 1, "unsigned long");
|
|
||||||
builtin_type_unsigned_int = init_type (TYPE_CODE_INT, sizeof (int), 1, "unsigned int");
|
|
||||||
|
|
||||||
builtin_type_long_long =
|
|
||||||
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
|
||||||
0, "long long");
|
|
||||||
builtin_type_unsigned_long_long =
|
|
||||||
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
|
||||||
1, "unsigned long long");
|
|
||||||
|
|
||||||
builtin_type_error = init_type (TYPE_CODE_ERROR, 0, 0, "<unknown type>");
|
builtin_type_error = init_type (TYPE_CODE_ERROR, 0, 0, "<unknown type>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user