1 /* Multiple source language support for GDB.
3 Copyright (C) 1991-2023 Free Software Foundation, Inc.
5 Contributed by the Department of Computer Science at the State University
6 of New York at Buffalo.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* This file contains functions that return things that are specific
24 to languages. Each function should examine current_language if necessary,
25 and return the appropriate result. */
27 /* FIXME: Most of these would be better organized as macros which
28 return data out of a "language-specific" struct pointer that is set
29 whenever the working language changes. That would be a lot faster. */
37 #include "expression.h"
41 #include "parser-defs.h"
44 #include "cp-support.h"
50 static void set_range_case (void);
53 range_mode_auto: range_check set automatically to default of language.
54 range_mode_manual: range_check set manually by user. */
58 range_mode_auto
, range_mode_manual
62 case_mode_auto: case_sensitivity set upon selection of scope.
63 case_mode_manual: case_sensitivity set only by user. */
67 case_mode_auto
, case_mode_manual
70 /* The current (default at startup) state of type and range checking.
71 (If the modes are set to "auto", though, these are changed based
72 on the default language at startup, and then again based on the
73 language of the first source file. */
75 static enum range_mode range_mode
= range_mode_auto
;
76 enum range_check range_check
= range_check_off
;
77 static enum case_mode case_mode
= case_mode_auto
;
78 enum case_sensitivity case_sensitivity
= case_sensitive_on
;
80 /* The current language and language_mode (see language.h). */
82 const struct language_defn
*current_language
= nullptr;
83 enum language_mode language_mode
= language_mode_auto
;
85 /* The language that the user expects to be typing in (the language
86 of main(), or the last language we notified them about, or C). */
88 const struct language_defn
*expected_language
;
90 /* Define the array containing all languages. */
92 const struct language_defn
*language_defn::languages
[nr_languages
];
94 /* The current values of the "set language/range/case-sensitive" enum
96 static const char *range
;
97 static const char *case_sensitive
;
100 const char lang_frame_mismatch_warn
[] =
101 N_("Warning: the current language does not match this frame.");
103 /* This page contains the functions corresponding to GDB commands
104 and their helpers. */
106 /* Show command. Display a warning if the language set
107 does not match the frame. */
109 show_language_command (struct ui_file
*file
, int from_tty
,
110 struct cmd_list_element
*c
, const char *value
)
112 enum language flang
; /* The language of the frame. */
114 if (language_mode
== language_mode_auto
)
116 _("The current source language is "
117 "\"auto; currently %s\".\n"),
118 current_language
->name ());
121 _("The current source language is \"%s\".\n"),
122 current_language
->name ());
124 if (has_stack_frames ())
126 frame_info_ptr frame
;
128 frame
= get_selected_frame (NULL
);
129 flang
= get_frame_language (frame
);
130 if (flang
!= language_unknown
131 && language_mode
== language_mode_manual
132 && current_language
->la_language
!= flang
)
133 gdb_printf (file
, "%s\n", _(lang_frame_mismatch_warn
));
137 /* Set callback for the "set/show language" setting. */
140 set_language (const char *language
)
142 enum language flang
= language_unknown
;
144 /* "local" is a synonym of "auto". */
145 if (strcmp (language
, "auto") == 0
146 || strcmp (language
, "local") == 0)
148 /* Enter auto mode. Set to the current frame's language, if
149 known, or fallback to the initial language. */
150 language_mode
= language_mode_auto
;
153 frame_info_ptr frame
;
155 frame
= get_selected_frame (NULL
);
156 flang
= get_frame_language (frame
);
158 catch (const gdb_exception_error
&ex
)
160 flang
= language_unknown
;
163 if (flang
!= language_unknown
)
164 set_language (flang
);
166 set_initial_language ();
168 expected_language
= current_language
;
172 /* Search the list of languages for a match. */
173 for (const auto &lang
: language_defn::languages
)
175 if (strcmp (lang
->name (), language
) != 0)
178 /* Found it! Go into manual mode, and use this language. */
179 language_mode
= language_mode_manual
;
180 current_language
= lang
;
182 expected_language
= current_language
;
186 internal_error ("Couldn't find language `%s' in known languages list.",
190 /* Get callback for the "set/show language" setting. */
195 if (language_mode
== language_mode_auto
)
198 return current_language
->name ();
201 /* Show command. Display a warning if the range setting does
202 not match the current language. */
204 show_range_command (struct ui_file
*file
, int from_tty
,
205 struct cmd_list_element
*c
, const char *value
)
207 if (range_mode
== range_mode_auto
)
216 case range_check_off
:
219 case range_check_warn
:
223 internal_error ("Unrecognized range check setting.");
227 _("Range checking is \"auto; currently %s\".\n"),
231 gdb_printf (file
, _("Range checking is \"%s\".\n"),
234 if (range_check
== range_check_warn
235 || ((range_check
== range_check_on
)
236 != current_language
->range_checking_on_by_default ()))
237 warning (_("the current range check setting "
238 "does not match the language."));
241 /* Set command. Change the setting for range checking. */
243 set_range_command (const char *ignore
,
244 int from_tty
, struct cmd_list_element
*c
)
246 if (strcmp (range
, "on") == 0)
248 range_check
= range_check_on
;
249 range_mode
= range_mode_manual
;
251 else if (strcmp (range
, "warn") == 0)
253 range_check
= range_check_warn
;
254 range_mode
= range_mode_manual
;
256 else if (strcmp (range
, "off") == 0)
258 range_check
= range_check_off
;
259 range_mode
= range_mode_manual
;
261 else if (strcmp (range
, "auto") == 0)
263 range_mode
= range_mode_auto
;
269 internal_error (_("Unrecognized range check setting: \"%s\""), range
);
271 if (range_check
== range_check_warn
272 || ((range_check
== range_check_on
)
273 != current_language
->range_checking_on_by_default ()))
274 warning (_("the current range check setting "
275 "does not match the language."));
278 /* Show command. Display a warning if the case sensitivity setting does
279 not match the current language. */
281 show_case_command (struct ui_file
*file
, int from_tty
,
282 struct cmd_list_element
*c
, const char *value
)
284 if (case_mode
== case_mode_auto
)
286 const char *tmp
= NULL
;
288 switch (case_sensitivity
)
290 case case_sensitive_on
:
293 case case_sensitive_off
:
297 internal_error ("Unrecognized case-sensitive setting.");
301 _("Case sensitivity in "
302 "name search is \"auto; currently %s\".\n"),
307 _("Case sensitivity in name search is \"%s\".\n"),
310 if (case_sensitivity
!= current_language
->case_sensitivity ())
311 warning (_("the current case sensitivity setting does not match "
315 /* Set command. Change the setting for case sensitivity. */
318 set_case_command (const char *ignore
, int from_tty
, struct cmd_list_element
*c
)
320 if (strcmp (case_sensitive
, "on") == 0)
322 case_sensitivity
= case_sensitive_on
;
323 case_mode
= case_mode_manual
;
325 else if (strcmp (case_sensitive
, "off") == 0)
327 case_sensitivity
= case_sensitive_off
;
328 case_mode
= case_mode_manual
;
330 else if (strcmp (case_sensitive
, "auto") == 0)
332 case_mode
= case_mode_auto
;
338 internal_error ("Unrecognized case-sensitive setting: \"%s\"",
342 if (case_sensitivity
!= current_language
->case_sensitivity ())
343 warning (_("the current case sensitivity setting does not match "
347 /* Set the status of range and type checking and case sensitivity based on
348 the current modes and the current language.
349 If SHOW is non-zero, then print out the current language,
350 type and range checking status. */
352 set_range_case (void)
354 if (range_mode
== range_mode_auto
)
355 range_check
= (current_language
->range_checking_on_by_default ()
356 ? range_check_on
: range_check_off
);
358 if (case_mode
== case_mode_auto
)
359 case_sensitivity
= current_language
->case_sensitivity ();
362 /* See language.h. */
365 set_language (enum language lang
)
367 current_language
= language_def (lang
);
372 /* See language.h. */
377 if (expected_language
== current_language
)
380 expected_language
= current_language
;
381 gdb_printf (_("Current language: %s\n"), get_language ());
382 show_language_command (gdb_stdout
, 1, NULL
, NULL
);
385 /* This page contains functions for the printing out of
386 error messages that occur during type- and range-
389 /* This is called when a language fails a range-check. The
390 first argument should be a printf()-style format string, and the
391 rest of the arguments should be its arguments. If range_check is
392 range_check_on, an error is printed; if range_check_warn, a warning;
393 otherwise just the message. */
396 range_error (const char *string
,...)
400 va_start (args
, string
);
403 case range_check_warn
:
404 vwarning (string
, args
);
407 verror (string
, args
);
409 case range_check_off
:
410 /* FIXME: cagney/2002-01-30: Should this function print anything
411 when range error is off? */
412 gdb_vprintf (gdb_stderr
, string
, args
);
413 gdb_printf (gdb_stderr
, "\n");
416 internal_error (_("bad switch"));
422 /* This page contains miscellaneous functions. */
424 /* Return the language enum for a given language string. */
427 language_enum (const char *str
)
429 for (const auto &lang
: language_defn::languages
)
430 if (strcmp (lang
->name (), str
) == 0)
431 return lang
->la_language
;
433 return language_unknown
;
436 /* Return the language struct for a given language enum. */
438 const struct language_defn
*
439 language_def (enum language lang
)
441 const struct language_defn
*l
= language_defn::languages
[lang
];
442 gdb_assert (l
!= nullptr);
446 /* Return the language as a string. */
449 language_str (enum language lang
)
451 return language_def (lang
)->name ();
456 /* Build and install the "set language LANG" command. */
459 add_set_language_command ()
461 static const char **language_names
;
463 /* Build the language names array, to be used as enumeration in the
464 "set language" enum command. +3 for "auto", "local" and NULL
466 language_names
= new const char *[ARRAY_SIZE (language_defn::languages
) + 3];
468 /* Display "auto", "local" and "unknown" first, and then the rest,
470 const char **language_names_p
= language_names
;
471 *language_names_p
++ = "auto";
472 *language_names_p
++ = "local";
473 *language_names_p
++ = language_def (language_unknown
)->name ();
474 const char **sort_begin
= language_names_p
;
475 for (const auto &lang
: language_defn::languages
)
477 /* Already handled above. */
478 if (lang
->la_language
== language_unknown
)
480 *language_names_p
++ = lang
->name ();
482 *language_names_p
= NULL
;
483 std::sort (sort_begin
, language_names_p
, compare_cstrings
);
485 /* Add the filename extensions. */
486 for (const auto &lang
: language_defn::languages
)
487 for (const char * const &ext
: lang
->filename_extensions ())
488 add_filename_language (ext
, lang
->la_language
);
490 /* Build the "help set language" docs. */
493 doc
.printf (_("Set the current source language.\n"
494 "The currently understood settings are:\n\nlocal or "
495 "auto Automatic setting based on source file"));
497 for (const auto &lang
: language_defn::languages
)
499 /* Already dealt with these above. */
500 if (lang
->la_language
== language_unknown
)
503 /* Note that we add the newline at the front, so we don't wind
504 up with a trailing newline. */
505 doc
.printf ("\n%-16s Use the %s language",
507 lang
->natural_name ());
510 add_setshow_enum_cmd ("language", class_support
,
513 _("Show the current source language."),
517 show_language_command
,
518 &setlist
, &showlist
);
521 /* Iterate through all registered languages looking for and calling
522 any non-NULL struct language_defn.skip_trampoline() functions.
523 Return the result from the first that returns non-zero, or 0 if all
526 skip_language_trampoline (const frame_info_ptr
&frame
, CORE_ADDR pc
)
528 for (const auto &lang
: language_defn::languages
)
530 CORE_ADDR real_pc
= lang
->skip_trampoline (frame
, pc
);
539 /* Return information about whether TYPE should be passed
540 (and returned) by reference at the language level. */
542 struct language_pass_by_ref_info
543 language_pass_by_reference (struct type
*type
)
545 return current_language
->pass_by_reference_info (type
);
548 /* Return the default string containing the list of characters
549 delimiting words. This is a reasonable default value that
550 most languages should be able to use. */
553 default_word_break_characters (void)
555 return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
558 /* See language.h. */
561 language_defn::print_array_index (struct type
*index_type
, LONGEST index
,
562 struct ui_file
*stream
,
563 const value_print_options
*options
) const
565 struct value
*index_value
= value_from_longest (index_type
, index
);
567 gdb_printf (stream
, "[");
568 value_print (index_value
, stream
, options
);
569 gdb_printf (stream
, "] = ");
572 /* See language.h. */
574 gdb::unique_xmalloc_ptr
<char>
575 language_defn::watch_location_expression (struct type
*type
,
576 CORE_ADDR addr
) const
578 /* Generates an expression that assumes a C like syntax is valid. */
579 type
= check_typedef (check_typedef (type
)->target_type ());
580 std::string name
= type_to_string (type
);
581 return xstrprintf ("* (%s *) %s", name
.c_str (), core_addr_to_string (addr
));
584 /* See language.h. */
587 language_defn::value_print (struct value
*val
, struct ui_file
*stream
,
588 const struct value_print_options
*options
) const
590 return c_value_print (val
, stream
, options
);
593 /* See language.h. */
596 language_defn::parser (struct parser_state
*ps
) const
601 /* See language.h. */
604 language_defn::value_print_inner
605 (struct value
*val
, struct ui_file
*stream
, int recurse
,
606 const struct value_print_options
*options
) const
608 return c_value_print_inner (val
, stream
, recurse
, options
);
611 /* See language.h. */
614 language_defn::print_typedef (struct type
*type
, struct symbol
*new_symbol
,
615 struct ui_file
*stream
) const
617 c_print_typedef (type
, new_symbol
, stream
);
620 /* See language.h. */
623 language_defn::is_string_type_p (struct type
*type
) const
625 return c_is_string_type_p (type
);
628 /* See language.h. */
630 std::unique_ptr
<compile_instance
>
631 language_defn::get_compile_instance () const
636 /* The default implementation of the get_symbol_name_matcher_inner method
637 from the language_defn class. Matches with strncmp_iw. */
640 default_symbol_name_matcher (const char *symbol_search_name
,
641 const lookup_name_info
&lookup_name
,
642 completion_match_result
*comp_match_res
)
644 std::string_view name
= lookup_name
.name ();
645 completion_match_for_lcd
*match_for_lcd
646 = (comp_match_res
!= NULL
? &comp_match_res
->match_for_lcd
: NULL
);
647 strncmp_iw_mode mode
= (lookup_name
.completion_mode ()
648 ? strncmp_iw_mode::NORMAL
649 : strncmp_iw_mode::MATCH_PARAMS
);
651 if (strncmp_iw_with_mode (symbol_search_name
, name
.data (), name
.size (),
652 mode
, language_minimal
, match_for_lcd
) == 0)
654 if (comp_match_res
!= NULL
)
655 comp_match_res
->set_match (symbol_search_name
);
662 /* See language.h. */
664 symbol_name_matcher_ftype
*
665 language_defn::get_symbol_name_matcher
666 (const lookup_name_info
&lookup_name
) const
668 /* If currently in Ada mode, and the lookup name is wrapped in
669 '<...>', hijack all symbol name comparisons using the Ada
670 matcher, which handles the verbatim matching. */
671 if (current_language
->la_language
== language_ada
672 && lookup_name
.ada ().verbatim_p ())
673 return current_language
->get_symbol_name_matcher_inner (lookup_name
);
675 return this->get_symbol_name_matcher_inner (lookup_name
);
678 /* See language.h. */
680 symbol_name_matcher_ftype
*
681 language_defn::get_symbol_name_matcher_inner
682 (const lookup_name_info
&lookup_name
) const
684 return default_symbol_name_matcher
;
687 /* See language.h. */
689 const struct lang_varobj_ops
*
690 language_defn::varobj_ops () const
692 /* The ops for the C language are suitable for the vast majority of the
693 supported languages. */
694 return &c_varobj_ops
;
697 /* Class representing the "unknown" language. */
699 class unknown_language
: public language_defn
702 unknown_language () : language_defn (language_unknown
)
705 /* See language.h. */
706 void language_arch_info (struct gdbarch
*gdbarch
,
707 struct language_arch_info
*lai
) const override
709 lai
->set_string_char_type (builtin_type (gdbarch
)->builtin_char
);
710 lai
->set_bool_type (builtin_type (gdbarch
)->builtin_int
);
713 /* See language.h. */
715 void print_type (struct type
*type
, const char *varstring
,
716 struct ui_file
*stream
, int show
, int level
,
717 const struct type_print_options
*flags
) const override
719 error (_("type printing not implemented for language \"%s\""),
723 /* See language.h. */
725 gdb::unique_xmalloc_ptr
<char> demangle_symbol (const char *mangled
,
726 int options
) const override
728 /* The auto language just uses the C++ demangler. */
729 return gdb_demangle (mangled
, options
);
732 /* See language.h. */
734 void value_print (struct value
*val
, struct ui_file
*stream
,
735 const struct value_print_options
*options
) const override
737 error (_("value printing not implemented for language \"%s\""),
741 /* See language.h. */
743 void value_print_inner
744 (struct value
*val
, struct ui_file
*stream
, int recurse
,
745 const struct value_print_options
*options
) const override
747 error (_("inner value printing not implemented for language \"%s\""),
751 /* See language.h. */
753 int parser (struct parser_state
*ps
) const override
755 error (_("expression parsing not implemented for language \"%s\""),
759 /* See language.h. */
761 void emitchar (int ch
, struct type
*chtype
,
762 struct ui_file
*stream
, int quoter
) const override
764 error (_("emit character not implemented for language \"%s\""),
768 /* See language.h. */
770 void printchar (int ch
, struct type
*chtype
,
771 struct ui_file
*stream
) const override
773 error (_("print character not implemented for language \"%s\""),
777 /* See language.h. */
779 void printstr (struct ui_file
*stream
, struct type
*elttype
,
780 const gdb_byte
*string
, unsigned int length
,
781 const char *encoding
, int force_ellipses
,
782 const struct value_print_options
*options
) const override
784 error (_("print string not implemented for language \"%s\""),
788 /* See language.h. */
790 void print_typedef (struct type
*type
, struct symbol
*new_symbol
,
791 struct ui_file
*stream
) const override
793 error (_("print typedef not implemented for language \"%s\""),
797 /* See language.h. */
799 bool is_string_type_p (struct type
*type
) const override
801 type
= check_typedef (type
);
802 while (type
->code () == TYPE_CODE_REF
)
804 type
= type
->target_type ();
805 type
= check_typedef (type
);
807 return (type
->code () == TYPE_CODE_STRING
);
810 /* See language.h. */
812 const char *name_of_this () const override
815 /* See language.h. */
817 const char *name () const override
818 { return "unknown"; }
820 /* See language.h. */
822 const char *natural_name () const override
823 { return "Unknown"; }
825 /* See language.h. */
827 bool store_sym_names_in_linkage_form_p () const override
831 /* Single instance of the unknown language class. */
833 static unknown_language unknown_language_defn
;
836 /* Per-architecture language information. */
838 struct language_gdbarch
840 /* A vector of per-language per-architecture info. Indexed by "enum
842 struct language_arch_info arch_info
[nr_languages
];
845 static const registry
<gdbarch
>::key
<language_gdbarch
> language_gdbarch_data
;
847 static language_gdbarch
*
848 get_language_gdbarch (struct gdbarch
*gdbarch
)
850 struct language_gdbarch
*l
= language_gdbarch_data
.get (gdbarch
);
853 l
= new struct language_gdbarch
;
854 for (const auto &lang
: language_defn::languages
)
856 gdb_assert (lang
!= nullptr);
857 lang
->language_arch_info (gdbarch
, &l
->arch_info
[lang
->la_language
]);
859 language_gdbarch_data
.set (gdbarch
, l
);
865 /* See language.h. */
868 language_string_char_type (const struct language_defn
*la
,
869 struct gdbarch
*gdbarch
)
871 struct language_gdbarch
*ld
= get_language_gdbarch (gdbarch
);
872 return ld
->arch_info
[la
->la_language
].string_char_type ();
875 /* See language.h. */
878 language_defn::value_string (struct gdbarch
*gdbarch
,
879 const char *ptr
, ssize_t len
) const
881 struct type
*type
= language_string_char_type (this, gdbarch
);
882 return value_cstring (ptr
, len
, type
);
885 /* See language.h. */
888 language_bool_type (const struct language_defn
*la
,
889 struct gdbarch
*gdbarch
)
891 struct language_gdbarch
*ld
= get_language_gdbarch (gdbarch
);
892 return ld
->arch_info
[la
->la_language
].bool_type ();
895 /* See language.h. */
898 language_arch_info::bool_type () const
900 if (m_bool_type_name
!= nullptr)
904 sym
= lookup_symbol (m_bool_type_name
, NULL
, VAR_DOMAIN
, NULL
).symbol
;
907 struct type
*type
= sym
->type ();
908 if (type
!= nullptr && type
->code () == TYPE_CODE_BOOL
)
913 return m_bool_type_default
;
916 /* See language.h. */
919 language_arch_info::type_and_symbol::alloc_type_symbol
920 (enum language lang
, struct type
*type
)
922 struct symbol
*symbol
;
923 struct gdbarch
*gdbarch
;
924 gdb_assert (!type
->is_objfile_owned ());
925 gdbarch
= type
->arch_owner ();
926 symbol
= new (gdbarch_obstack (gdbarch
)) struct symbol ();
927 symbol
->m_name
= type
->name ();
928 symbol
->set_language (lang
, nullptr);
929 symbol
->owner
.arch
= gdbarch
;
930 symbol
->set_is_objfile_owned (0);
931 symbol
->set_section_index (0);
932 symbol
->set_type (type
);
933 symbol
->set_domain (VAR_DOMAIN
);
934 symbol
->set_aclass_index (LOC_TYPEDEF
);
938 /* See language.h. */
940 language_arch_info::type_and_symbol
*
941 language_arch_info::lookup_primitive_type_and_symbol (const char *name
)
943 for (struct type_and_symbol
&tas
: primitive_types_and_symbols
)
945 if (strcmp (tas
.type ()->name (), name
) == 0)
952 /* See language.h. */
955 language_arch_info::lookup_primitive_type (const char *name
)
957 type_and_symbol
*tas
= lookup_primitive_type_and_symbol (name
);
963 /* See language.h. */
966 language_arch_info::lookup_primitive_type
967 (gdb::function_view
<bool (struct type
*)> filter
)
969 for (struct type_and_symbol
&tas
: primitive_types_and_symbols
)
971 if (filter (tas
.type ()))
978 /* See language.h. */
981 language_arch_info::lookup_primitive_type_as_symbol (const char *name
,
984 type_and_symbol
*tas
= lookup_primitive_type_and_symbol (name
);
986 return tas
->symbol (lang
);
990 /* Helper for the language_lookup_primitive_type overloads to forward
991 to the corresponding language's lookup_primitive_type overload. */
995 language_lookup_primitive_type_1 (const struct language_defn
*la
,
996 struct gdbarch
*gdbarch
,
999 struct language_gdbarch
*ld
= get_language_gdbarch (gdbarch
);
1000 return ld
->arch_info
[la
->la_language
].lookup_primitive_type (arg
);
1003 /* See language.h. */
1006 language_lookup_primitive_type (const struct language_defn
*la
,
1007 struct gdbarch
*gdbarch
,
1010 return language_lookup_primitive_type_1 (la
, gdbarch
, name
);
1013 /* See language.h. */
1016 language_lookup_primitive_type (const struct language_defn
*la
,
1017 struct gdbarch
*gdbarch
,
1018 gdb::function_view
<bool (struct type
*)> filter
)
1020 return language_lookup_primitive_type_1 (la
, gdbarch
, filter
);
1023 /* See language.h. */
1026 language_lookup_primitive_type_as_symbol (const struct language_defn
*la
,
1027 struct gdbarch
*gdbarch
,
1030 struct language_gdbarch
*ld
= get_language_gdbarch (gdbarch
);
1031 struct language_arch_info
*lai
= &ld
->arch_info
[la
->la_language
];
1033 symbol_lookup_debug_printf
1034 ("language = \"%s\", gdbarch @ %s, type = \"%s\")",
1035 la
->name (), host_address_to_string (gdbarch
), name
);
1038 = lai
->lookup_primitive_type_as_symbol (name
, la
->la_language
);
1040 symbol_lookup_debug_printf ("found symbol @ %s",
1041 host_address_to_string (sym
));
1043 /* Note: The result of symbol lookup is normally a symbol *and* the block
1044 it was found in. Builtin types don't live in blocks. We *could* give
1045 them one, but there is no current need so to keep things simple symbol
1046 lookup is extended to allow for BLOCK_FOUND to be NULL. */
1051 /* Initialize the language routines. */
1053 void _initialize_language ();
1055 _initialize_language ()
1057 static const char *const type_or_range_names
[]
1058 = { "on", "off", "warn", "auto", NULL
};
1060 static const char *const case_sensitive_names
[]
1061 = { "on", "off", "auto", NULL
};
1063 /* GDB commands for language specific stuff. */
1065 set_show_commands setshow_check_cmds
1066 = add_setshow_prefix_cmd ("check", no_class
,
1067 _("Set the status of the type/range checker."),
1068 _("Show the status of the type/range checker."),
1069 &setchecklist
, &showchecklist
,
1070 &setlist
, &showlist
);
1071 add_alias_cmd ("c", setshow_check_cmds
.set
, no_class
, 1, &setlist
);
1072 add_alias_cmd ("ch", setshow_check_cmds
.set
, no_class
, 1, &setlist
);
1073 add_alias_cmd ("c", setshow_check_cmds
.show
, no_class
, 1, &showlist
);
1074 add_alias_cmd ("ch", setshow_check_cmds
.show
, no_class
, 1, &showlist
);
1076 range
= type_or_range_names
[3];
1077 gdb_assert (strcmp (range
, "auto") == 0);
1078 add_setshow_enum_cmd ("range", class_support
, type_or_range_names
,
1080 _("Set range checking (on/warn/off/auto)."),
1081 _("Show range checking (on/warn/off/auto)."),
1082 NULL
, set_range_command
,
1084 &setchecklist
, &showchecklist
);
1086 case_sensitive
= case_sensitive_names
[2];
1087 gdb_assert (strcmp (case_sensitive
, "auto") == 0);
1088 add_setshow_enum_cmd ("case-sensitive", class_support
, case_sensitive_names
,
1089 &case_sensitive
, _("\
1090 Set case sensitivity in name search (on/off/auto)."), _("\
1091 Show case sensitivity in name search (on/off/auto)."), _("\
1092 For Fortran the default is off; for other languages the default is on."),
1095 &setlist
, &showlist
);
1097 add_set_language_command ();