GDB (xrefs)
Loading...
Searching...
No Matches
language.c
Go to the documentation of this file.
1/* Multiple source language support for GDB.
2
3 Copyright (C) 1991-2023 Free Software Foundation, Inc.
4
5 Contributed by the Department of Computer Science at the State University
6 of New York at Buffalo.
7
8 This file is part of GDB.
9
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.
14
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.
19
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/>. */
22
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. */
26
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. */
30
31#include "defs.h"
32#include <ctype.h>
33#include "symtab.h"
34#include "gdbtypes.h"
35#include "value.h"
36#include "gdbcmd.h"
37#include "expression.h"
38#include "language.h"
39#include "varobj.h"
40#include "target.h"
41#include "parser-defs.h"
42#include "demangle.h"
43#include "symfile.h"
44#include "cp-support.h"
45#include "frame.h"
46#include "c-lang.h"
47#include <algorithm>
48#include "gdbarch.h"
49
50static void set_range_case (void);
51
52/* range_mode ==
53 range_mode_auto: range_check set automatically to default of language.
54 range_mode_manual: range_check set manually by user. */
55
60
61/* case_mode ==
62 case_mode_auto: case_sensitivity set upon selection of scope.
63 case_mode_manual: case_sensitivity set only by user. */
64
69
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. */
74
79
80/* The current language and language_mode (see language.h). */
81
82const struct language_defn *current_language = nullptr;
84
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). */
87
89
90/* Define the array containing all languages. */
91
93
94/* The current values of the "set language/range/case-sensitive" enum
95 commands. */
96static const char *range;
97static const char *case_sensitive;
98
99/* See language.h. */
101N_("Warning: the current language does not match this frame.");
102
103/* This page contains the functions corresponding to GDB commands
104 and their helpers. */
105
106/* Show command. Display a warning if the language set
107 does not match the frame. */
108static void
109show_language_command (struct ui_file *file, int from_tty,
110 struct cmd_list_element *c, const char *value)
111{
112 enum language flang; /* The language of the frame. */
113
115 gdb_printf (file,
116 _("The current source language is "
117 "\"auto; currently %s\".\n"),
119 else
120 gdb_printf (file,
121 _("The current source language is \"%s\".\n"),
123
124 if (has_stack_frames ())
125 {
126 frame_info_ptr frame;
127
128 frame = get_selected_frame (NULL);
129 flang = get_frame_language (frame);
130 if (flang != language_unknown
132 && current_language->la_language != flang)
133 gdb_printf (file, "%s\n", _(lang_frame_mismatch_warn));
134 }
135}
136
137/* Set callback for the "set/show language" setting. */
138
139static void
141{
142 enum language flang = language_unknown;
143
144 /* "local" is a synonym of "auto". */
145 if (strcmp (language, "auto") == 0
146 || strcmp (language, "local") == 0)
147 {
148 /* Enter auto mode. Set to the current frame's language, if
149 known, or fallback to the initial language. */
151 try
152 {
153 frame_info_ptr frame;
154
155 frame = get_selected_frame (NULL);
156 flang = get_frame_language (frame);
157 }
158 catch (const gdb_exception_error &ex)
159 {
160 flang = language_unknown;
161 }
162
163 if (flang != language_unknown)
164 set_language (flang);
165 else
167
169 return;
170 }
171
172 /* Search the list of languages for a match. */
173 for (const auto &lang : language_defn::languages)
174 {
175 if (strcmp (lang->name (), language) != 0)
176 continue;
177
178 /* Found it! Go into manual mode, and use this language. */
180 current_language = lang;
183 return;
184 }
185
186 internal_error ("Couldn't find language `%s' in known languages list.",
187 language);
188}
189
190/* Get callback for the "set/show language" setting. */
191
192static const char *
194{
196 return "auto";
197
198 return current_language->name ();
199}
200
201/* Show command. Display a warning if the range setting does
202 not match the current language. */
203static void
204show_range_command (struct ui_file *file, int from_tty,
205 struct cmd_list_element *c, const char *value)
206{
208 {
209 const char *tmp;
210
211 switch (range_check)
212 {
213 case range_check_on:
214 tmp = "on";
215 break;
216 case range_check_off:
217 tmp = "off";
218 break;
219 case range_check_warn:
220 tmp = "warn";
221 break;
222 default:
223 internal_error ("Unrecognized range check setting.");
224 }
225
226 gdb_printf (file,
227 _("Range checking is \"auto; currently %s\".\n"),
228 tmp);
229 }
230 else
231 gdb_printf (file, _("Range checking is \"%s\".\n"),
232 value);
233
237 warning (_("the current range check setting "
238 "does not match the language."));
239}
240
241/* Set command. Change the setting for range checking. */
242static void
243set_range_command (const char *ignore,
244 int from_tty, struct cmd_list_element *c)
245{
246 if (strcmp (range, "on") == 0)
247 {
250 }
251 else if (strcmp (range, "warn") == 0)
252 {
255 }
256 else if (strcmp (range, "off") == 0)
257 {
260 }
261 else if (strcmp (range, "auto") == 0)
262 {
265 return;
266 }
267 else
268 {
269 internal_error (_("Unrecognized range check setting: \"%s\""), range);
270 }
274 warning (_("the current range check setting "
275 "does not match the language."));
276}
277
278/* Show command. Display a warning if the case sensitivity setting does
279 not match the current language. */
280static void
281show_case_command (struct ui_file *file, int from_tty,
282 struct cmd_list_element *c, const char *value)
283{
285 {
286 const char *tmp = NULL;
287
288 switch (case_sensitivity)
289 {
291 tmp = "on";
292 break;
294 tmp = "off";
295 break;
296 default:
297 internal_error ("Unrecognized case-sensitive setting.");
298 }
299
300 gdb_printf (file,
301 _("Case sensitivity in "
302 "name search is \"auto; currently %s\".\n"),
303 tmp);
304 }
305 else
306 gdb_printf (file,
307 _("Case sensitivity in name search is \"%s\".\n"),
308 value);
309
311 warning (_("the current case sensitivity setting does not match "
312 "the language."));
313}
314
315/* Set command. Change the setting for case sensitivity. */
316
317static void
318set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
319{
320 if (strcmp (case_sensitive, "on") == 0)
321 {
324 }
325 else if (strcmp (case_sensitive, "off") == 0)
326 {
329 }
330 else if (strcmp (case_sensitive, "auto") == 0)
331 {
334 return;
335 }
336 else
337 {
338 internal_error ("Unrecognized case-sensitive setting: \"%s\"",
340 }
341
343 warning (_("the current case sensitivity setting does not match "
344 "the language."));
345}
346
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. */
351static void
361
362/* See language.h. */
363
364void
366{
369}
370
371
372/* See language.h. */
373
374void
376{
378 return;
379
381 gdb_printf (_("Current language: %s\n"), get_language ());
382 show_language_command (gdb_stdout, 1, NULL, NULL);
383}
384
385/* This page contains functions for the printing out of
386 error messages that occur during type- and range-
387 checking. */
388
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. */
394
395void
396range_error (const char *string,...)
397{
398 va_list args;
399
400 va_start (args, string);
401 switch (range_check)
402 {
403 case range_check_warn:
404 vwarning (string, args);
405 break;
406 case range_check_on:
407 verror (string, args);
408 break;
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");
414 break;
415 default:
416 internal_error (_("bad switch"));
417 }
418 va_end (args);
419}
420
421
422/* This page contains miscellaneous functions. */
423
424/* Return the language enum for a given language string. */
425
426enum language
427language_enum (const char *str)
428{
429 for (const auto &lang : language_defn::languages)
430 if (strcmp (lang->name (), str) == 0)
431 return lang->la_language;
432
433 return language_unknown;
434}
435
436/* Return the language struct for a given language enum. */
437
438const struct language_defn *
440{
441 const struct language_defn *l = language_defn::languages[lang];
442 gdb_assert (l != nullptr);
443 return l;
444}
445
446/* Return the language as a string. */
447
448const char *
450{
451 return language_def (lang)->name ();
452}
453
454
455
456/* Build and install the "set language LANG" command. */
457
458static void
460{
461 static const char **language_names;
462
463 /* Build the language names array, to be used as enumeration in the
464 "set language" enum command. +3 for "auto", "local" and NULL
465 termination. */
466 language_names = new const char *[ARRAY_SIZE (language_defn::languages) + 3];
467
468 /* Display "auto", "local" and "unknown" first, and then the rest,
469 alpha sorted. */
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)
476 {
477 /* Already handled above. */
478 if (lang->la_language == language_unknown)
479 continue;
480 *language_names_p++ = lang->name ();
481 }
482 *language_names_p = NULL;
483 std::sort (sort_begin, language_names_p, compare_cstrings);
484
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);
489
490 /* Build the "help set language" docs. */
491 string_file doc;
492
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"));
496
497 for (const auto &lang : language_defn::languages)
498 {
499 /* Already dealt with these above. */
500 if (lang->la_language == language_unknown)
501 continue;
502
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",
506 lang->name (),
507 lang->natural_name ());
508 }
509
511 language_names,
512 doc.c_str (),
513 _("Show the current source language."),
514 NULL,
518 &setlist, &showlist);
519}
520
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
524 `fail'. */
525CORE_ADDR
526skip_language_trampoline (const frame_info_ptr &frame, CORE_ADDR pc)
527{
528 for (const auto &lang : language_defn::languages)
529 {
530 CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
531
532 if (real_pc != 0)
533 return real_pc;
534 }
535
536 return 0;
537}
538
539/* Return information about whether TYPE should be passed
540 (and returned) by reference at the language level. */
541
547
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. */
551
552const char *
554{
555 return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
556}
557
558/* See language.h. */
559
560void
561language_defn::print_array_index (struct type *index_type, LONGEST index,
562 struct ui_file *stream,
563 const value_print_options *options) const
564{
565 struct value *index_value = value_from_longest (index_type, index);
566
567 gdb_printf (stream, "[");
568 value_print (index_value, stream, options);
569 gdb_printf (stream, "] = ");
570}
571
572/* See language.h. */
573
574gdb::unique_xmalloc_ptr<char>
576 CORE_ADDR addr) const
577{
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));
582}
583
584/* See language.h. */
585
586void
587language_defn::value_print (struct value *val, struct ui_file *stream,
588 const struct value_print_options *options) const
589{
590 return c_value_print (val, stream, options);
591}
592
593/* See language.h. */
594
595int
597{
598 return c_parse (ps);
599}
600
601/* See language.h. */
602
603void
605 (struct value *val, struct ui_file *stream, int recurse,
606 const struct value_print_options *options) const
607{
608 return c_value_print_inner (val, stream, recurse, options);
609}
610
611/* See language.h. */
612
613void
615 struct ui_file *stream) const
616{
618}
619
620/* See language.h. */
621
622bool
624{
625 return c_is_string_type_p (type);
626}
627
628/* See language.h. */
629
630std::unique_ptr<compile_instance>
632{
633 return {};
634}
635
636/* The default implementation of the get_symbol_name_matcher_inner method
637 from the language_defn class. Matches with strncmp_iw. */
638
639static bool
640default_symbol_name_matcher (const char *symbol_search_name,
641 const lookup_name_info &lookup_name,
642 completion_match_result *comp_match_res)
643{
644 gdb::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 ()
650
651 if (strncmp_iw_with_mode (symbol_search_name, name.data (), name.size (),
652 mode, language_minimal, match_for_lcd) == 0)
653 {
654 if (comp_match_res != NULL)
655 comp_match_res->set_match (symbol_search_name);
656 return true;
657 }
658 else
659 return false;
660}
661
662/* See language.h. */
663
666 (const lookup_name_info &lookup_name) const
667{
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. */
672 && lookup_name.ada ().verbatim_p ())
674
675 return this->get_symbol_name_matcher_inner (lookup_name);
676}
677
678/* See language.h. */
679
686
687/* See language.h. */
688
689const struct lang_varobj_ops *
691{
692 /* The ops for the C language are suitable for the vast majority of the
693 supported languages. */
694 return &c_varobj_ops;
695}
696
697/* Class representing the "unknown" language. */
698
700{
701public:
703 { /* Nothing. */ }
704
705 /* See language.h. */
707 struct language_arch_info *lai) const override
708 {
709 lai->set_string_char_type (builtin_type (gdbarch)->builtin_char);
710 lai->set_bool_type (builtin_type (gdbarch)->builtin_int);
711 }
712
713 /* See language.h. */
714
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
718 {
719 error (_("type printing not implemented for language \"%s\""),
720 natural_name ());
721 }
722
723 /* See language.h. */
724
725 gdb::unique_xmalloc_ptr<char> demangle_symbol (const char *mangled,
726 int options) const override
727 {
728 /* The auto language just uses the C++ demangler. */
729 return gdb_demangle (mangled, options);
730 }
731
732 /* See language.h. */
733
734 void value_print (struct value *val, struct ui_file *stream,
735 const struct value_print_options *options) const override
736 {
737 error (_("value printing not implemented for language \"%s\""),
738 natural_name ());
739 }
740
741 /* See language.h. */
742
744 (struct value *val, struct ui_file *stream, int recurse,
745 const struct value_print_options *options) const override
746 {
747 error (_("inner value printing not implemented for language \"%s\""),
748 natural_name ());
749 }
750
751 /* See language.h. */
752
753 int parser (struct parser_state *ps) const override
754 {
755 error (_("expression parsing not implemented for language \"%s\""),
756 natural_name ());
757 }
758
759 /* See language.h. */
760
761 void emitchar (int ch, struct type *chtype,
762 struct ui_file *stream, int quoter) const override
763 {
764 error (_("emit character not implemented for language \"%s\""),
765 natural_name ());
766 }
767
768 /* See language.h. */
769
770 void printchar (int ch, struct type *chtype,
771 struct ui_file *stream) const override
772 {
773 error (_("print character not implemented for language \"%s\""),
774 natural_name ());
775 }
776
777 /* See language.h. */
778
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
783 {
784 error (_("print string not implemented for language \"%s\""),
785 natural_name ());
786 }
787
788 /* See language.h. */
789
790 void print_typedef (struct type *type, struct symbol *new_symbol,
791 struct ui_file *stream) const override
792 {
793 error (_("print typedef not implemented for language \"%s\""),
794 natural_name ());
795 }
796
797 /* See language.h. */
798
799 bool is_string_type_p (struct type *type) const override
800 {
802 while (type->code () == TYPE_CODE_REF)
803 {
804 type = type->target_type ();
806 }
807 return (type->code () == TYPE_CODE_STRING);
808 }
809
810 /* See language.h. */
811
812 const char *name_of_this () const override
813 { return "this"; }
814
815 /* See language.h. */
816
817 const char *name () const override
818 { return "unknown"; }
819
820 /* See language.h. */
821
822 const char *natural_name () const override
823 { return "Unknown"; }
824
825 /* See language.h. */
826
828 { return true; }
829};
830
831/* Single instance of the unknown language class. */
832
834
835
836/* Per-architecture language information. */
837
839{
840 /* A vector of per-language per-architecture info. Indexed by "enum
841 language". */
843};
844
846
847static language_gdbarch *
849{
851 if (l == nullptr)
852 {
853 l = new struct language_gdbarch;
854 for (const auto &lang : language_defn::languages)
855 {
856 gdb_assert (lang != nullptr);
857 lang->language_arch_info (gdbarch, &l->arch_info[lang->la_language]);
858 }
860 }
861
862 return l;
863}
864
865/* See language.h. */
866
867struct type *
869 struct gdbarch *gdbarch)
870{
872 return ld->arch_info[la->la_language].string_char_type ();
873}
874
875/* See language.h. */
876
877struct value *
879 const char *ptr, ssize_t len) const
880{
881 struct type *type = language_string_char_type (this, gdbarch);
882 return value_cstring (ptr, len, type);
883}
884
885/* See language.h. */
886
887struct type *
889 struct gdbarch *gdbarch)
890{
892 return ld->arch_info[la->la_language].bool_type ();
893}
894
895/* See language.h. */
896
897struct type *
899{
900 if (m_bool_type_name != nullptr)
901 {
902 struct symbol *sym;
903
904 sym = lookup_symbol (m_bool_type_name, NULL, VAR_DOMAIN, NULL).symbol;
905 if (sym != nullptr)
906 {
907 struct type *type = sym->type ();
908 if (type != nullptr && type->code () == TYPE_CODE_BOOL)
909 return type;
910 }
911 }
912
913 return m_bool_type_default;
914}
915
916/* See language.h. */
917
918struct symbol *
920 (enum language lang, struct type *type)
921{
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);
935 return symbol;
936}
937
938/* See language.h. */
939
942{
944 {
945 if (strcmp (tas.type ()->name (), name) == 0)
946 return &tas;
947 }
948
949 return nullptr;
950}
951
952/* See language.h. */
953
954struct type *
956{
958 if (tas != nullptr)
959 return tas->type ();
960 return nullptr;
961}
962
963/* See language.h. */
964
965struct type *
967 (gdb::function_view<bool (struct type *)> filter)
968{
970 {
971 if (filter (tas.type ()))
972 return tas.type ();
973 }
974
975 return nullptr;
976}
977
978/* See language.h. */
979
980struct symbol *
982 enum language lang)
983{
985 if (tas != nullptr)
986 return tas->symbol (lang);
987 return nullptr;
988}
989
990/* Helper for the language_lookup_primitive_type overloads to forward
991 to the corresponding language's lookup_primitive_type overload. */
992
993template<typename T>
994static struct type *
996 struct gdbarch *gdbarch,
997 T arg)
998{
1000 return ld->arch_info[la->la_language].lookup_primitive_type (arg);
1001}
1002
1003/* See language.h. */
1004
1005struct type *
1007 struct gdbarch *gdbarch,
1008 const char *name)
1009{
1011}
1012
1013/* See language.h. */
1014
1015struct type *
1017 struct gdbarch *gdbarch,
1018 gdb::function_view<bool (struct type *)> filter)
1019{
1020 return language_lookup_primitive_type_1 (la, gdbarch, filter);
1021}
1022
1023/* See language.h. */
1024
1025struct symbol *
1027 struct gdbarch *gdbarch,
1028 const char *name)
1029{
1031 struct language_arch_info *lai = &ld->arch_info[la->la_language];
1032
1034 ("language = \"%s\", gdbarch @ %s, type = \"%s\")",
1035 la->name (), host_address_to_string (gdbarch), name);
1036
1037 struct symbol *sym
1039
1040 symbol_lookup_debug_printf ("found symbol @ %s",
1041 host_address_to_string (sym));
1042
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. */
1047
1048 return sym;
1049}
1050
1051/* Initialize the language routines. */
1052
1053void _initialize_language ();
1054void
1056{
1057 static const char *const type_or_range_names[]
1058 = { "on", "off", "warn", "auto", NULL };
1059
1060 static const char *const case_sensitive_names[]
1061 = { "on", "off", "auto", NULL };
1062
1063 /* GDB commands for language specific stuff. */
1064
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."),
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);
1075
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,
1079 &range,
1080 _("Set range checking (on/warn/off/auto)."),
1081 _("Show range checking (on/warn/off/auto)."),
1082 NULL, set_range_command,
1085
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, _("\
1090Set case sensitivity in name search (on/off/auto)."), _("\
1091Show case sensitivity in name search (on/off/auto)."), _("\
1092For Fortran the default is off; for other languages the default is on."),
1095 &setlist, &showlist);
1096
1098}
const char *const name
obstack * gdbarch_obstack(gdbarch *arch)
int c_parse(struct parser_state *par_state)
Definition c-exp.c:6061
bool c_is_string_type_p(struct type *type)
Definition c-lang.c:689
void c_print_typedef(struct type *, struct symbol *, struct ui_file *)
void c_value_print_inner(struct value *, struct ui_file *, int, const struct value_print_options *)
Definition c-valprint.c:422
void c_value_print(struct value *, struct ui_file *, const struct value_print_options *)
Definition c-valprint.c:472
const struct lang_varobj_ops c_varobj_ops
Definition c-varobj.c:533
bool verbatim_p() const
Definition symtab.h:124
const ada_lookup_name_info & ada() const
Definition symtab.h:315
gdb::string_view name() const
Definition symtab.h:241
bool completion_mode() const
Definition symtab.h:240
void set(unsigned key, void *datum)
Definition registry.h:204
void * get(unsigned key)
Definition registry.h:211
const char * c_str() const
Definition ui-file.h:222
void printf(const char *,...) ATTRIBUTE_PRINTF(2
Definition ui-file.c:40
const char * name() const override
Definition language.c:817
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options) const override
Definition language.c:734
const char * natural_name() const override
Definition language.c:822
void language_arch_info(struct gdbarch *gdbarch, struct language_arch_info *lai) const override
Definition language.c:706
void value_print_inner(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) const override
Definition language.c:744
int parser(struct parser_state *ps) const override
Definition language.c:753
bool is_string_type_p(struct type *type) const override
Definition language.c:799
void print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override
Definition language.c:715
bool store_sym_names_in_linkage_form_p() const override
Definition language.c:827
gdb::unique_xmalloc_ptr< char > demangle_symbol(const char *mangled, int options) const override
Definition language.c:725
void printstr(struct ui_file *stream, struct type *elttype, const gdb_byte *string, unsigned int length, const char *encoding, int force_ellipses, const struct value_print_options *options) const override
Definition language.c:779
void emitchar(int ch, struct type *chtype, struct ui_file *stream, int quoter) const override
Definition language.c:761
void printchar(int ch, struct type *chtype, struct ui_file *stream) const override
Definition language.c:770
const char * name_of_this() const override
Definition language.c:812
void print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream) const override
Definition language.c:790
struct cmd_list_element * showlist
Definition cli-cmds.c:127
struct cmd_list_element * setchecklist
Definition cli-cmds.c:169
struct cmd_list_element * setlist
Definition cli-cmds.c:119
struct cmd_list_element * showchecklist
Definition cli-cmds.c:171
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
Definition cli-decode.c:294
set_show_commands add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
Definition cli-decode.c:688
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
Definition cli-decode.c:428
@ class_support
Definition command.h:58
@ no_class
Definition command.h:53
gdb::unique_xmalloc_ptr< char > gdb_demangle(const char *name, int options)
language
Definition defs.h:211
@ language_ada
Definition defs.h:225
@ language_unknown
Definition defs.h:212
@ language_minimal
Definition defs.h:224
@ nr_languages
Definition defs.h:226
bool has_stack_frames()
Definition frame.c:1859
frame_info_ptr get_selected_frame(const char *message)
Definition frame.c:1888
enum language get_frame_language(frame_info_ptr frame)
Definition frame.c:3074
struct type * check_typedef(struct type *type)
Definition gdbtypes.c:2966
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
initialize_file_ftype _initialize_language
Definition language.c:1055
enum language language_enum(const char *str)
Definition language.c:427
const char lang_frame_mismatch_warn[]
Definition language.c:100
static void set_language(const char *language)
Definition language.c:140
static void set_range_command(const char *ignore, int from_tty, struct cmd_list_element *c)
Definition language.c:243
case_mode
Definition language.c:66
@ case_mode_auto
Definition language.c:67
@ case_mode_manual
Definition language.c:67
const char * language_str(enum language lang)
Definition language.c:449
static const char * case_sensitive
Definition language.c:97
static const char * get_language()
Definition language.c:193
static struct type * language_lookup_primitive_type_1(const struct language_defn *la, struct gdbarch *gdbarch, T arg)
Definition language.c:995
const struct language_defn * language_def(enum language lang)
Definition language.c:439
void range_error(const char *string,...)
Definition language.c:396
static void set_range_case(void)
Definition language.c:352
const struct language_defn * current_language
Definition language.c:82
static void show_range_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition language.c:204
range_mode
Definition language.c:57
@ range_mode_auto
Definition language.c:58
@ range_mode_manual
Definition language.c:58
static language_gdbarch * get_language_gdbarch(struct gdbarch *gdbarch)
Definition language.c:848
static void show_case_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition language.c:281
static unknown_language unknown_language_defn
Definition language.c:833
struct language_pass_by_ref_info language_pass_by_reference(struct type *type)
Definition language.c:543
static void show_language_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition language.c:109
void language_info()
Definition language.c:375
struct type * language_bool_type(const struct language_defn *la, struct gdbarch *gdbarch)
Definition language.c:888
struct type * language_string_char_type(const struct language_defn *la, struct gdbarch *gdbarch)
Definition language.c:868
CORE_ADDR skip_language_trampoline(const frame_info_ptr &frame, CORE_ADDR pc)
Definition language.c:526
static const char * range
Definition language.c:96
const struct language_defn * expected_language
Definition language.c:88
static void set_case_command(const char *ignore, int from_tty, struct cmd_list_element *c)
Definition language.c:318
static void add_set_language_command()
Definition language.c:459
static const registry< gdbarch >::key< language_gdbarch > language_gdbarch_data
Definition language.c:845
static bool default_symbol_name_matcher(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
Definition language.c:640
const char * default_word_break_characters(void)
Definition language.c:553
const struct language_defn * current_language
Definition language.c:82
range_check
Definition language.h:51
@ range_check_warn
Definition language.h:52
@ range_check_on
Definition language.h:52
@ range_check_off
Definition language.h:52
struct type * language_lookup_primitive_type(const struct language_defn *l, struct gdbarch *gdbarch, const char *name)
Definition language.c:1006
case_sensitivity
Definition language.h:72
@ case_sensitive_on
Definition language.h:73
@ case_sensitive_off
Definition language.h:73
language_mode
Definition language.h:717
@ language_mode_auto
Definition language.h:718
@ language_mode_manual
Definition language.h:718
struct type * language_string_char_type(const struct language_defn *l, struct gdbarch *gdbarch)
Definition language.c:868
struct symbol * language_lookup_primitive_type_as_symbol(const struct language_defn *l, struct gdbarch *gdbarch, const char *name)
Definition language.c:1026
static struct symbol * new_symbol(struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *=NULL)
Definition read.c:18978
enum var_types type
Definition scm-param.c:142
Definition 1.cc:26
struct symbol * symbol
Definition symtab.h:1533
void set_match(const char *m, const char *m_for_lcd=NULL)
Definition completer.h:233
completion_match_for_lcd match_for_lcd
Definition completer.h:229
void set_section_index(short idx)
Definition symtab.h:614
void set_language(enum language language, struct obstack *obstack)
Definition symtab.c:803
const char * m_name
Definition symtab.h:545
struct type * type() const
Definition language.h:167
static struct symbol * alloc_type_symbol(enum language lang, struct type *type)
Definition language.c:920
struct symbol * symbol(enum language lang)
Definition language.h:171
struct type * m_bool_type_default
Definition language.h:214
struct type * bool_type() const
Definition language.c:898
void set_string_char_type(struct type *type)
Definition language.h:114
struct symbol * lookup_primitive_type_as_symbol(const char *name, enum language lang)
Definition language.c:981
std::vector< type_and_symbol > primitive_types_and_symbols
Definition language.h:205
const char * m_bool_type_name
Definition language.h:211
void set_bool_type(struct type *type, const char *name=nullptr)
Definition language.h:102
type_and_symbol * lookup_primitive_type_and_symbol(const char *name)
Definition language.c:941
struct type * lookup_primitive_type(const char *name)
Definition language.c:955
struct type * string_char_type() const
Definition language.h:122
virtual bool is_string_type_p(struct type *type) const
Definition language.c:623
virtual symbol_name_matcher_ftype * get_symbol_name_matcher_inner(const lookup_name_info &lookup_name) const
Definition language.c:682
virtual const struct lang_varobj_ops * varobj_ops() const
Definition language.c:690
virtual struct language_pass_by_ref_info pass_by_reference_info(struct type *type) const
Definition language.h:332
enum language la_language
Definition language.h:275
virtual gdb::unique_xmalloc_ptr< char > watch_location_expression(struct type *type, CORE_ADDR addr) const
Definition language.c:575
virtual const char * name() const =0
virtual void print_array_index(struct type *index_type, LONGEST index_value, struct ui_file *stream, const value_print_options *options) const
Definition language.c:561
symbol_name_matcher_ftype * get_symbol_name_matcher(const lookup_name_info &lookup_name) const
Definition language.c:666
virtual void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options) const
Definition language.c:587
static const struct language_defn * languages[nr_languages]
Definition language.h:525
virtual struct value * value_string(struct gdbarch *gdbarch, const char *ptr, ssize_t len) const
Definition language.c:878
virtual bool range_checking_on_by_default() const
Definition language.h:647
virtual int parser(struct parser_state *ps) const
Definition language.c:596
virtual enum case_sensitivity case_sensitivity() const
Definition language.h:654
virtual void print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream) const
Definition language.c:614
virtual void value_print_inner(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) const
Definition language.c:605
virtual std::unique_ptr< compile_instance > get_compile_instance() const
Definition language.c:631
struct language_arch_info arch_info[nr_languages]
Definition language.c:842
Definition value.h:90
cmd_list_element * set
Definition command.h:422
cmd_list_element * show
Definition command.h:422
struct type * type() const
Definition symtab.h:1331
void set_aclass_index(unsigned int aclass_index)
Definition symtab.h:1264
void set_type(struct type *type)
Definition symtab.h:1336
union symbol::@184 owner
struct gdbarch * arch
Definition symtab.h:1460
void set_is_objfile_owned(bool is_objfile_owned)
Definition symtab.h:1301
void set_domain(domain_enum domain)
Definition symtab.h:1291
struct type * target_type() const
Definition gdbtypes.h:1037
type_code code() const
Definition gdbtypes.h:956
gdbarch * arch_owner() const
Definition gdbtypes.h:1390
const char * name() const
Definition gdbtypes.h:968
bool is_objfile_owned() const
Definition gdbtypes.h:1353
Definition value.h:130
void add_filename_language(const char *ext, enum language lang)
Definition symfile.c:2715
void set_initial_language(void)
Definition symfile.c:1690
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
Definition symtab.c:1964
@ LOC_TYPEDEF
Definition symtab.h:1018
#define symbol_lookup_debug_printf(fmt,...)
Definition symtab.h:2712
bool symbol_name_matcher_ftype(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
Definition symtab.h:399
@ VAR_DOMAIN
Definition symtab.h:910
std::string type_to_string(struct type *type)
Definition typeprint.c:399
void verror(const char *string, va_list args)
Definition utils.c:164
void gdb_vprintf(struct ui_file *stream, const char *format, va_list args)
Definition utils.c:1874
int strncmp_iw_with_mode(const char *string1, const char *string2, size_t string2_len, strncmp_iw_mode mode, enum language language, completion_match_for_lcd *match_for_lcd, bool ignore_template_params)
Definition utils.c:2150
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1886
void vwarning(const char *string, va_list args)
Definition utils.c:140
strncmp_iw_mode
Definition utils.h:37
#define gdb_stderr
Definition utils.h:187
#define gdb_stdout
Definition utils.h:182
struct value * value_cstring(const gdb_byte *ptr, ssize_t count, struct type *char_type)
Definition valops.c:1738
struct value * value_from_longest(struct type *type, LONGEST num)
Definition value.c:3438