aboutsummaryrefslogtreecommitdiff
path: root/gdb/language.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:11:40 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:11:40 +0000
commitfbb06eb1ba120adde645d64133f5a9bbf2d62ec7 (patch)
tree2dc42cd0011089aeca55de8bb8dfa2da1ff77dca /gdb/language.c
parentde7b6b470188ff9f2b8fcfd831d98f8807fdf6c8 (diff)
downloadgdb-fbb06eb1ba120adde645d64133f5a9bbf2d62ec7.zip
gdb-fbb06eb1ba120adde645d64133f5a9bbf2d62ec7.tar.gz
gdb-fbb06eb1ba120adde645d64133f5a9bbf2d62ec7.tar.bz2
* language.h (struct language_arch_info): New members
bool_type_default and bool_type_symbol. (lang_bool_type): Remove prototype. (LA_BOOL_TYPE): Remove macro. (language_bool_type): Add prototype. * language.c (lang_bool_type): Remove. (language_bool_type): New function. * value.h (value_in): Change return value to int. * value.c (value_in): Return int instead of struct value *. * eval.c (evaluate_subexp_standard): Call language_bool_type instead of using LA_BOOL_TYPE. Update call to value_in. * ada-lang.c (ada_evaluate_subexp): Call language_bool_type instead of using LA_BOOL_TYPE or builtin_type_int for boolean values. * language.c (unknown_language_arch_info): Set bool_type_default member of struct language_arch_info. * ada-lang.c (ada_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * c-lang.c (c_language_arch_info): Set bool_type_default member of struct language_arch_info. (cplus_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * f-lang.c (f_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * jv-lang.c (java_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * m2-lang.c (m2_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * p-lang.c (p_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info.
Diffstat (limited to 'gdb/language.c')
-rw-r--r--gdb/language.c69
1 files changed, 24 insertions, 45 deletions
diff --git a/gdb/language.c b/gdb/language.c
index 66e5542..7b0b44a 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -787,51 +787,6 @@ structured_type (struct type *type)
}
#endif
-struct type *
-lang_bool_type (void)
-{
- struct symbol *sym;
- struct type *type;
- switch (current_language->la_language)
- {
- case language_fortran:
- sym = lookup_symbol ("logical", NULL, VAR_DOMAIN, NULL);
- if (sym)
- {
- type = SYMBOL_TYPE (sym);
- if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
- return type;
- }
- return builtin_type_f_logical_s2;
- case language_cplus:
- case language_pascal:
- case language_ada:
- if (current_language->la_language==language_cplus)
- {sym = lookup_symbol ("bool", NULL, VAR_DOMAIN, NULL);}
- else
- {sym = lookup_symbol ("boolean", NULL, VAR_DOMAIN, NULL);}
- if (sym)
- {
- type = SYMBOL_TYPE (sym);
- if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
- return type;
- }
- return builtin_type_bool;
- case language_java:
- sym = lookup_symbol ("boolean", NULL, VAR_DOMAIN, NULL);
- if (sym)
- {
- type = SYMBOL_TYPE (sym);
- if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
- return type;
- }
- return java_boolean_type;
-
- default:
- return builtin_type_int;
- }
-}
-
/* This page contains functions that return info about
(struct value) values used in GDB. */
@@ -1169,6 +1124,7 @@ unknown_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
lai->string_char_type = builtin_type (gdbarch)->builtin_char;
+ lai->bool_type_default = builtin_type (gdbarch)->builtin_int;
lai->primitive_type_vector = GDBARCH_OBSTACK_CALLOC (gdbarch, 1,
struct type *);
}
@@ -1317,6 +1273,29 @@ language_string_char_type (const struct language_defn *la,
}
struct type *
+language_bool_type (const struct language_defn *la,
+ struct gdbarch *gdbarch)
+{
+ struct language_gdbarch *ld = gdbarch_data (gdbarch,
+ language_gdbarch_data);
+
+ if (ld->arch_info[la->la_language].bool_type_symbol)
+ {
+ struct symbol *sym;
+ sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
+ NULL, VAR_DOMAIN, NULL);
+ if (sym)
+ {
+ struct type *type = SYMBOL_TYPE (sym);
+ if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
+ return type;
+ }
+ }
+
+ return ld->arch_info[la->la_language].bool_type_default;
+}
+
+struct type *
language_lookup_primitive_type_by_name (const struct language_defn *la,
struct gdbarch *gdbarch,
const char *name)