* c-exp.y: Fix problems with parsing "'foo.bar'::func". Some languages

allow symbols with dots.

	* gdbtypes.c (check_stub_method):  Cosmetic.  Use more descriptive
	names for parameters.

start-sanitize-java
	* jv-exp.y:  Parser now accepts primitive types.
	* (parse_number):  Use correct ifdef for scanf long double support.
	* jv-lang.c (java_array_type):  Initial cut at array support.
end-sanitize-java

	* language.c language.h (set_language):  Now returns previous language.

	* symtab.c (find_methods):  Make static.  Cosmetic changes, including
	indentation, and adding descriptive comments.  Move local variable defs
	into the block they are used in.
	* Don't call check_stub_method any more.  Use gdb_mangle_name to
	generate the full method name.  find_method doesn't need all the other
	goobldegook that check_stub_method does.
	* (gdb_mangle_name):  Use more descriptive names for parameters.  Fix
	comment.
start-sanitize-java
	* (lookup_partial_symbol lookup_block_symbol):  Check for java to
	ensure we can find mangled names.
end-sanitize-java
	* (decode_line_1):  Move local variable defs into the block they are
	used in.  (Improves code readability.)
This commit is contained in:
Stu Grossman 1998-06-10 23:29:59 +00:00
parent a27a2a8de4
commit f6d23b6f3b
7 changed files with 104 additions and 40 deletions

View File

@ -1,3 +1,34 @@
Wed Jun 10 15:39:14 1998 Stu Grossman <grossman@babylon-5.cygnus.com>
* c-exp.y: Fix problems with parsing "'foo.bar'::func". Some languages
allow symbols with dots.
* gdbtypes.c (check_stub_method): Cosmetic. Use more descriptive
names for parameters.
start-sanitize-java
* jv-exp.y: Parser now accepts primitive types.
* (parse_number): Use correct ifdef for scanf long double support.
* jv-lang.c (java_array_type): Initial cut at array support.
end-sanitize-java
* language.c language.h (set_language): Now returns previous language.
* symtab.c (find_methods): Make static. Cosmetic changes, including
indentation, and adding descriptive comments. Move local variable defs
into the block they are used in.
* Don't call check_stub_method any more. Use gdb_mangle_name to
generate the full method name. find_method doesn't need all the other
goobldegook that check_stub_method does.
* (gdb_mangle_name): Use more descriptive names for parameters. Fix
comment.
start-sanitize-java
* (lookup_partial_symbol lookup_block_symbol): Check for java to
ensure we can find mangled names.
end-sanitize-java
* (decode_line_1): Move local variable defs into the block they are
used in. (Improves code readability.)
Wed Jun 10 14:06:05 1998 Jason Molenda (crash@bugshack.cygnus.com)
* configure.in: Add some tests for gnu-regex.c's benefit.

View File

@ -214,6 +214,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
%right UNARY INCREMENT DECREMENT
%right ARROW '.' '[' '('
%token <ssym> BLOCKNAME
%token <bval> FILENAME
%type <bval> block
%left COLONCOLON
@ -531,18 +532,15 @@ exp : THIS
block : BLOCKNAME
{
if ($1.sym != 0)
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
if ($1.sym)
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
else
{
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
$$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
}
error ("No file or function \"%s\".",
copy_name ($1.stoken));
}
| FILENAME
{
$$ = $1;
}
;
@ -1526,13 +1524,25 @@ yylex ()
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
lookup_symtab (tmp))
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
{
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
return BLOCKNAME;
}
else if (!sym)
{ /* See if it's a file name. */
struct symtab *symtab;
symtab = lookup_symtab (tmp);
if (symtab)
{
yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
return FILENAME;
}
}
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
#if 1

View File

@ -1238,13 +1238,13 @@ cfront_mangle_name(type, i, j)
the space required for them. */
void
check_stub_method (type, i, j)
check_stub_method (type, method_id, signature_id)
struct type *type;
int i;
int j;
int method_id;
int signature_id;
{
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, i, j);
char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
char *demangled_name = cplus_demangle (mangled_name,
DMGL_PARAMS | DMGL_ANSI);
char *argtypetext, *p;
@ -1331,16 +1331,16 @@ check_stub_method (type, i, j)
free (demangled_name);
f = TYPE_FN_FIELDLIST1 (type, i);
f = TYPE_FN_FIELDLIST1 (type, method_id);
TYPE_FN_FIELD_PHYSNAME (f, j) = mangled_name;
TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name;
/* Now update the old "stub" type into a real type. */
mtype = TYPE_FN_FIELD_TYPE (f, j);
mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
TYPE_DOMAIN_TYPE (mtype) = type;
TYPE_ARG_TYPES (mtype) = argtypes;
TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
TYPE_FN_FIELD_STUB (f, j) = 0;
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
}
const struct cplus_struct_type cplus_struct_default;

View File

@ -151,7 +151,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
%type <lval> rcurly Dims Dims_opt
%type <tval> ClassOrInterfaceType ClassType /* ReferenceType Type ArrayType */
%type <tval> IntegralType FloatingPointType NumericType PrimitiveType
%type <tval> IntegralType FloatingPointType NumericType PrimitiveType ArrayType PrimitiveOrArrayType
%token <typed_val_int> INTEGER_LITERAL
%token <typed_val_float> FLOATING_POINT_LITERAL
@ -201,7 +201,20 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
%%
start : exp1
/* | type_exp FIXME */
| type_exp
;
type_exp: PrimitiveOrArrayType
{
write_exp_elt_opcode(OP_TYPE);
write_exp_elt_type($1);
write_exp_elt_opcode(OP_TYPE);
}
;
PrimitiveOrArrayType:
PrimitiveType
| ArrayType
;
StringLiteral:
@ -294,14 +307,12 @@ ClassType:
ClassOrInterfaceType
;
/* UNUSED:
ArrayType:
PrimitiveType Dims
{ $$ = java_array_type ($1, $2); }
| Name Dims
{ $$ = java_array_type (java_type_from_name ($1), $2); }
;
*/
Name:
IDENTIFIER
@ -697,7 +708,7 @@ parse_number (p, len, parsed_float, putithere)
num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
else
{
#ifdef PRINTF_HAS_LONG_DOUBLE
#ifdef SCANF_HAS_LONG_DOUBLE
num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
#else
/* Scan it into a double, then assign it to the long double.
@ -723,7 +734,7 @@ parse_number (p, len, parsed_float, putithere)
return ERROR;
return FLOATING_POINT_LITERAL;
}
}
/* Handle base-switching prefixes 0x, 0t, 0d, 0 */
if (p[0] == '0')
@ -1080,13 +1091,13 @@ yylex ()
(c == '_' || c == '$' || (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
{
if (c == '<')
{
int i = namelen;
while (tokstart[++i] && tokstart[i] != '>');
if (tokstart[i] == '>')
namelen = i;
}
if (c == '<')
{
int i = namelen;
while (tokstart[++i] && tokstart[i] != '>');
if (tokstart[i] == '>')
namelen = i;
}
c = tokstart[++namelen];
}

View File

@ -681,9 +681,16 @@ java_array_type (type, dims)
struct type *type;
int dims;
{
if (dims == 0)
return type;
error ("array types not implemented");
struct type *range_type;
while (dims-- > 0)
{
range_type = create_range_type (NULL, builtin_type_int, 0, 0);
type = create_array_type (NULL, type, range_type);
}
return type;
}
/* Create a Java string in the inferior from a (Utf8) literal. */

View File

@ -345,13 +345,16 @@ set_type_range()
set_range_str();
}
/* Set current language to (enum language) LANG. */
/* Set current language to (enum language) LANG. Returns previous language. */
void
enum language
set_language(lang)
enum language lang;
{
int i;
enum language prev_language;
prev_language = current_language->la_language;
for (i = 0; i < languages_size; i++) {
if (languages[i]->la_language == lang) {
@ -361,6 +364,8 @@ set_language(lang)
break;
}
}
return prev_language;
}
/* This page contains functions that update the global vars

View File

@ -245,7 +245,7 @@ extern enum language_mode
extern void
language_info PARAMS ((int));
extern void
extern enum language
set_language PARAMS ((enum language));