GDB (xrefs)

/tmp/gdb-8.1/gdb/language.c
Go to the documentation of this file.
1 /* Multiple source language support for GDB.
2
3 Copyright (C) 1991-2018 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
49 static void unk_lang_error (const char *);
50
51 static int unk_lang_parser (struct parser_state *);
52
53 static void set_range_case (void);
54
55 static void unk_lang_emit_char (int c, struct type *type,
56 struct ui_file *stream, int quoter);
57
58 static void unk_lang_printchar (int c, struct type *type,
59 struct ui_file *stream);
60
61 static void unk_lang_value_print (struct value *, struct ui_file *,
62 const struct value_print_options *);
63
64 static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc);
65
66 /* Forward declaration */
67 extern const struct language_defn unknown_language_defn;
68
69 /* The current (default at startup) state of type and range checking.
70 (If the modes are set to "auto", though, these are changed based
71 on the default language at startup, and then again based on the
72 language of the first source file. */
73
74 enum range_mode range_mode = range_mode_auto;
75 enum range_check range_check = range_check_off;
76 enum case_mode case_mode = case_mode_auto;
77 enum case_sensitivity case_sensitivity = case_sensitive_on;
78
79 /* The current language and language_mode (see language.h). */
80
81 const struct language_defn *current_language = &unknown_language_defn;
82 enum language_mode language_mode = language_mode_auto;
83
84 /* The language that the user expects to be typing in (the language
85 of main(), or the last language we notified them about, or C). */
86
87 const struct language_defn *expected_language;
88
89 /* The list of supported languages. Keep this in the same order as
90 the 'enum language' values. */
91
92 static const struct language_defn *languages[] = {
93 &unknown_language_defn,
94 &auto_language_defn,
95 &c_language_defn,
96 &objc_language_defn,
97 &cplus_language_defn,
98 &d_language_defn,
99 &go_language_defn,
100 &f_language_defn,
101 &m2_language_defn,
102 &asm_language_defn,
103 &pascal_language_defn,
104 &opencl_language_defn,
105 &rust_language_defn,
106 &minimal_language_defn,
107 &ada_language_defn,
108 };
109
110 /* The current values of the "set language/type/range" enum
111 commands. */
112 static const char *language;
113 static const char *type;
114 static const char *range;
115 static const char *case_sensitive;
116
117 /* Warning issued when current_language and the language of the current
118 frame do not match. */
119 char lang_frame_mismatch_warn[] =
120 "Warning: the current language does not match this frame.";
121
122 /* This page contains the functions corresponding to GDB commands
123 and their helpers. */
124
125 /* Show command. Display a warning if the language set
126 does not match the frame. */
127 static void
128 show_language_command (struct ui_file *file, int from_tty,
129 struct cmd_list_element *c, const char *value)
130 {
131 enum language flang; /* The language of the frame. */
132
133 if (language_mode == language_mode_auto)
134 fprintf_filtered (gdb_stdout,
135 _("The current source language is "
136 "\"auto; currently %s\".\n"),
137 current_language->la_name);
138 else
139 fprintf_filtered (gdb_stdout,
140 _("The current source language is \"%s\".\n"),
141 current_language->la_name);
142
143 if (has_stack_frames ())
144 {
145 struct frame_info *frame;
146
147 frame = get_selected_frame (NULL);
148 flang = get_frame_language (frame);
149 if (flang != language_unknown
150 && language_mode == language_mode_manual
151 && current_language->la_language != flang)
152 printf_filtered ("%s\n", lang_frame_mismatch_warn);
153 }
154 }
155
156 /* Set command. Change the current working language. */
157 static void
158 set_language_command (const char *ignore,
159 int from_tty, struct cmd_list_element *c)
160 {
161 enum language flang = language_unknown;
162
163 /* "local" is a synonym of "auto". */
164 if (strcmp (language, "local") == 0)
165 language = "auto";
166
167 /* Search the list of languages for a match. */
168 for (const auto &lang : languages)
169 {
170 if (strcmp (lang->la_name, language) == 0)
171 {
172 /* Found it! Go into manual mode, and use this language. */
173 if (lang->la_language == language_auto)
174 {
175 /* Enter auto mode. Set to the current frame's language, if
176 known, or fallback to the initial language. */
177 language_mode = language_mode_auto;
178 TRY
179 {
180 struct frame_info *frame;
181
182 frame = get_selected_frame (NULL);
183 flang = get_frame_language (frame);
184 }
185 CATCH (ex, RETURN_MASK_ERROR)
186 {
187 flang = language_unknown;
188 }
189 END_CATCH
190
191 if (flang != language_unknown)
192 set_language (flang);
193 else
194 set_initial_language ();
195 expected_language = current_language;
196 return;
197 }
198 else
199 {
200 /* Enter manual mode. Set the specified language. */
201 language_mode = language_mode_manual;
202 current_language = lang;
203 set_range_case ();
204 expected_language = current_language;
205 return;
206 }
207 }
208 }
209
210 internal_error (__FILE__, __LINE__,
211 "Couldn't find language `%s' in known languages list.",
212 language);
213 }
214
215 /* Show command. Display a warning if the range setting does
216 not match the current language. */
217 static void
218 show_range_command (struct ui_file *file, int from_tty,
219 struct cmd_list_element *c, const char *value)
220 {
221 if (range_mode == range_mode_auto)
222 {
223 const char *tmp;
224
225 switch (range_check)
226 {
227 case range_check_on:
228 tmp = "on";
229 break;
230 case range_check_off:
231 tmp = "off";
232 break;
233 case range_check_warn:
234 tmp = "warn";
235 break;
236 default:
237 internal_error (__FILE__, __LINE__,
238 "Unrecognized range check setting.");
239 }
240
241 fprintf_filtered (gdb_stdout,
242 _("Range checking is \"auto; currently %s\".\n"),
243 tmp);
244 }
245 else
246 fprintf_filtered (gdb_stdout, _("Range checking is \"%s\".\n"),
247 value);
248
249 if (range_check != current_language->la_range_check)
250 warning (_("the current range check setting "
251 "does not match the language.\n"));
252 }
253
254 /* Set command. Change the setting for range checking. */
255 static void
256 set_range_command (const char *ignore,
257 int from_tty, struct cmd_list_element *c)
258 {
259 if (strcmp (range, "on") == 0)
260 {
261 range_check = range_check_on;
262 range_mode = range_mode_manual;
263 }
264 else if (strcmp (range, "warn") == 0)
265 {
266 range_check = range_check_warn;
267 range_mode = range_mode_manual;
268 }
269 else if (strcmp (range, "off") == 0)
270 {
271 range_check = range_check_off;
272 range_mode = range_mode_manual;
273 }
274 else if (strcmp (range, "auto") == 0)
275 {
276 range_mode = range_mode_auto;
277 set_range_case ();
278 return;
279 }
280 else
281 {
282 internal_error (__FILE__, __LINE__,
283 _("Unrecognized range check setting: \"%s\""), range);
284 }
285 if (range_check != current_language->la_range_check)
286 warning (_("the current range check setting "
287 "does not match the language.\n"));
288 }
289
290 /* Show command. Display a warning if the case sensitivity setting does
291 not match the current language. */
292 static void
293 show_case_command (struct ui_file *file, int from_tty,
294 struct cmd_list_element *c, const char *value)
295 {
296 if (case_mode == case_mode_auto)
297 {
298 const char *tmp = NULL;
299
300 switch (case_sensitivity)
301 {
302 case case_sensitive_on:
303 tmp = "on";
304 break;
305 case case_sensitive_off:
306 tmp = "off";
307 break;
308 default:
309 internal_error (__FILE__, __LINE__,
310 "Unrecognized case-sensitive setting.");
311 }
312
313 fprintf_filtered (gdb_stdout,
314 _("Case sensitivity in "
315 "name search is \"auto; currently %s\".\n"),
316 tmp);
317 }
318 else
319 fprintf_filtered (gdb_stdout,
320 _("Case sensitivity in name search is \"%s\".\n"),
321 value);
322
323 if (case_sensitivity != current_language->la_case_sensitivity)
324 warning (_("the current case sensitivity setting does not match "
325 "the language.\n"));
326 }
327
328 /* Set command. Change the setting for case sensitivity. */
329
330 static void
331 set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
332 {
333 if (strcmp (case_sensitive, "on") == 0)
334 {
335 case_sensitivity = case_sensitive_on;
336 case_mode = case_mode_manual;
337 }
338 else if (strcmp (case_sensitive, "off") == 0)
339 {
340 case_sensitivity = case_sensitive_off;
341 case_mode = case_mode_manual;
342 }
343 else if (strcmp (case_sensitive, "auto") == 0)
344 {
345 case_mode = case_mode_auto;
346 set_range_case ();
347 return;
348 }
349 else
350 {
351 internal_error (__FILE__, __LINE__,
352 "Unrecognized case-sensitive setting: \"%s\"",
353 case_sensitive);
354 }
355
356 if (case_sensitivity != current_language->la_case_sensitivity)
357 warning (_("the current case sensitivity setting does not match "
358 "the language.\n"));
359 }
360
361 /* Set the status of range and type checking and case sensitivity based on
362 the current modes and the current language.
363 If SHOW is non-zero, then print out the current language,
364 type and range checking status. */
365 static void
366 set_range_case (void)
367 {
368 if (range_mode == range_mode_auto)
369 range_check = current_language->la_range_check;
370
371 if (case_mode == case_mode_auto)
372 case_sensitivity = current_language->la_case_sensitivity;
373 }
374
375 /* Set current language to (enum language) LANG. Returns previous
376 language. */
377
378 enum language
379 set_language (enum language lang)
380 {
381 enum language prev_language;
382
383 prev_language = current_language->la_language;
384 current_language = languages[lang];
385 set_range_case ();
386 return prev_language;
387 }
388
389
390 /* Print out the current language settings: language, range and
391 type checking. If QUIETLY, print only what has changed. */
392
393 void
394 language_info (int quietly)
395 {
396 if (quietly && expected_language == current_language)
397 return;
398
399 expected_language = current_language;
400 printf_unfiltered (_("Current language: %s\n"), language);
401 show_language_command (NULL, 1, NULL, NULL);
402
403 if (!quietly)
404 {
405 printf_unfiltered (_("Range checking: %s\n"), range);
406 show_range_command (NULL, 1, NULL, NULL);
407 printf_unfiltered (_("Case sensitivity: %s\n"), case_sensitive);
408 show_case_command (NULL, 1, NULL, NULL);
409 }
410 }
411
412
413 /* Returns non-zero if the value is a pointer type. */
414 int
415 pointer_type (struct type *type)
416 {
417 return TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
418 }
419
420
421 /* This page contains functions that return info about
422 (struct value) values used in GDB. */
423
424 /* Returns non-zero if the value VAL represents a true value. */
425 int
426 value_true (struct value *val)
427 {
428 /* It is possible that we should have some sort of error if a non-boolean
429 value is used in this context. Possibly dependent on some kind of
430 "boolean-checking" option like range checking. But it should probably
431 not depend on the language except insofar as is necessary to identify
432 a "boolean" value (i.e. in C using a float, pointer, etc., as a boolean
433 should be an error, probably). */
434 return !value_logical_not (val);
435 }
436
437 /* This page contains functions for the printing out of
438 error messages that occur during type- and range-
439 checking. */
440
441 /* This is called when a language fails a range-check. The
442 first argument should be a printf()-style format string, and the
443 rest of the arguments should be its arguments. If range_check is
444 range_check_on, an error is printed; if range_check_warn, a warning;
445 otherwise just the message. */
446
447 void
448 range_error (const char *string,...)
449 {
450 va_list args;
451
452 va_start (args, string);
453 switch (range_check)
454 {
455 case range_check_warn:
456 vwarning (string, args);
457 break;
458 case range_check_on:
459 verror (string, args);
460 break;
461 case range_check_off:
462 /* FIXME: cagney/2002-01-30: Should this function print anything
463 when range error is off? */
464 vfprintf_filtered (gdb_stderr, string, args);
465 fprintf_filtered (gdb_stderr, "\n");
466 break;
467 default:
468 internal_error (__FILE__, __LINE__, _("bad switch"));
469 }
470 va_end (args);
471 }
472
473
474 /* This page contains miscellaneous functions. */
475
476 /* Return the language enum for a given language string. */
477
478 enum language
479 language_enum (const char *str)
480 {
481 for (const auto &lang : languages)
482 if (strcmp (lang->la_name, str) == 0)
483 return lang->la_language;
484
485 if (strcmp (str, "local") == 0)
486 return language_auto;
487
488 return language_unknown;
489 }
490
491 /* Return the language struct for a given language enum. */
492
493 const struct language_defn *
494 language_def (enum language lang)
495 {
496 return languages[lang];
497 }
498
499 /* Return the language as a string. */
500
501 const char *
502 language_str (enum language lang)
503 {
504 return languages[lang]->la_name;
505 }
506
507 static void
508 set_check (const char *ignore, int from_tty)
509 {
510 printf_unfiltered (
511 "\"set check\" must be followed by the name of a check subcommand.\n");
512 help_list (setchecklist, "set check ", all_commands, gdb_stdout);
513 }
514
515 static void
516 show_check (const char *ignore, int from_tty)
517 {
518 cmd_show_list (showchecklist, from_tty, "");
519 }
520
521
522 /* Build and install the "set language LANG" command. */
523
524 static void
525 add_set_language_command ()
526 {
527 static const char **language_names;
528
529 /* Build the language names array, to be used as enumeration in the
530 "set language" enum command. +1 for "local" and +1 for NULL
531 termination. */
532 language_names = new const char *[ARRAY_SIZE (languages) + 2];
533
534 /* Display "auto", "local" and "unknown" first, and then the rest,
535 alpha sorted. */
536 const char **language_names_p = language_names;
537 *language_names_p++ = auto_language_defn.la_name;
538 *language_names_p++ = "local";
539 *language_names_p++ = unknown_language_defn.la_name;
540 const char **sort_begin = language_names_p;
541 for (const auto &lang : languages)
542 {
543 /* Already handled above. */
544 if (lang->la_language == language_auto
545 || lang->la_language == language_unknown)
546 continue;
547 *language_names_p++ = lang->la_name;
548 }
549 *language_names_p = NULL;
550 std::sort (sort_begin, language_names_p, compare_cstrings);
551
552 /* Add the filename extensions. */
553 for (const auto &lang : languages)
554 if (lang->la_filename_extensions != NULL)
555 {
556 for (size_t i = 0; lang->la_filename_extensions[i] != NULL; ++i)
557 add_filename_language (lang->la_filename_extensions[i],
558 lang->la_language);
559 }
560
561 /* Build the "help set language" docs. */
562 string_file doc;
563
564 doc.printf (_("Set the current source language.\n"
565 "The currently understood settings are:\n\nlocal or "
566 "auto Automatic setting based on source file\n"));
567
568 for (const auto &lang : languages)
569 {
570 /* Already dealt with these above. */
571 if (lang->la_language == language_unknown
572 || lang->la_language == language_auto)
573 continue;
574
575 /* FIXME: i18n: for now assume that the human-readable name is
576 just a capitalization of the internal name. */
577 doc.printf ("%-16s Use the %c%s language\n",
578 lang->la_name,
579 /* Capitalize first letter of language name. */
580 toupper (lang->la_name[0]),
581 lang->la_name + 1);
582 }
583
584 add_setshow_enum_cmd ("language", class_support,
585 language_names,
586 &language,
587 doc.c_str (),
588 _("Show the current source language."),
589 NULL, set_language_command,
590 show_language_command,
591 &setlist, &showlist);
592 }
593
594 /* Iterate through all registered languages looking for and calling
595 any non-NULL struct language_defn.skip_trampoline() functions.
596 Return the result from the first that returns non-zero, or 0 if all
597 `fail'. */
598 CORE_ADDR
599 skip_language_trampoline (struct frame_info *frame, CORE_ADDR pc)
600 {
601 for (const auto &lang : languages)
602 {
603 if (lang->skip_trampoline != NULL)
604 {
605 CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
606
607 if (real_pc)
608 return real_pc;
609 }
610 }
611
612 return 0;
613 }
614
615 /* Return demangled language symbol, or NULL.
616 FIXME: Options are only useful for certain languages and ignored
617 by others, so it would be better to remove them here and have a
618 more flexible demangler for the languages that need it.
619 FIXME: Sometimes the demangler is invoked when we don't know the
620 language, so we can't use this everywhere. */
621 char *
622 language_demangle (const struct language_defn *current_language,
623 const char *mangled, int options)
624 {
625 if (current_language != NULL && current_language->la_demangle)
626 return current_language->la_demangle (mangled, options);
627 return NULL;
628 }
629
630 /* See langauge.h. */
631
632 int
633 language_sniff_from_mangled_name (const struct language_defn *lang,
634 const char *mangled, char **demangled)
635 {
636 gdb_assert (lang != NULL);
637
638 if (lang->la_sniff_from_mangled_name == NULL)
639 {
640 *demangled = NULL;
641 return 0;
642 }
643
644 return lang->la_sniff_from_mangled_name (mangled, demangled);
645 }
646
647 /* Return class name from physname or NULL. */
648 char *
649 language_class_name_from_physname (const struct language_defn *lang,
650 const char *physname)
651 {
652 if (lang != NULL && lang->la_class_name_from_physname)
653 return lang->la_class_name_from_physname (physname);
654 return NULL;
655 }
656
657 /* Return non-zero if TYPE should be passed (and returned) by
658 reference at the language level. */
659 int
660 language_pass_by_reference (struct type *type)
661 {
662 return current_language->la_pass_by_reference (type);
663 }
664
665 /* Return zero; by default, types are passed by value at the language
666 level. The target ABI may pass or return some structs by reference
667 independent of this. */
668 int
669 default_pass_by_reference (struct type *type)
670 {
671 return 0;
672 }
673
674 /* Return the default string containing the list of characters
675 delimiting words. This is a reasonable default value that
676 most languages should be able to use. */
677
678 const char *
679 default_word_break_characters (void)
680 {
681 return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
682 }
683
684 /* Print the index of array elements using the C99 syntax. */
685
686 void
687 default_print_array_index (struct value *index_value, struct ui_file *stream,
688 const struct value_print_options *options)
689 {
690 fprintf_filtered (stream, "[");
691 LA_VALUE_PRINT (index_value, stream, options);
692 fprintf_filtered (stream, "] = ");
693 }
694
695 void
696 default_get_string (struct value *value, gdb_byte **buffer, int *length,
697 struct type **char_type, const char **charset)
698 {
699 error (_("Getting a string is unsupported in this language."));
700 }
701
702 /* See language.h. */
703
704 bool
705 default_symbol_name_matcher (const char *symbol_search_name,
706 const lookup_name_info &lookup_name,
707 completion_match_result *comp_match_res)
708 {
709 const std::string &name = lookup_name.name ();
710 completion_match_for_lcd *match_for_lcd
711 = (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
712 strncmp_iw_mode mode = (lookup_name.completion_mode ()
713 ? strncmp_iw_mode::NORMAL
714 : strncmp_iw_mode::MATCH_PARAMS);
715
716 if (strncmp_iw_with_mode (symbol_search_name, name.c_str (), name.size (),
717 mode, language_minimal, match_for_lcd) == 0)
718 {
719 if (comp_match_res != NULL)
720 comp_match_res->set_match (symbol_search_name);
721 return true;
722 }
723 else
724 return false;
725 }
726
727 /* See language.h. */
728
729 symbol_name_matcher_ftype *
730 get_symbol_name_matcher (const language_defn *lang,
731 const lookup_name_info &lookup_name)
732 {
733 /* If currently in Ada mode, and the lookup name is wrapped in
734 '<...>', hijack all symbol name comparisons using the Ada
735 matcher, which handles the verbatim matching. */
736 if (current_language->la_language == language_ada
737 && lookup_name.ada ().verbatim_p ())
738 return current_language->la_get_symbol_name_matcher (lookup_name);
739
740 if (lang->la_get_symbol_name_matcher != nullptr)
741 return lang->la_get_symbol_name_matcher (lookup_name);
742 return default_symbol_name_matcher;
743 }
744
745 /* Define the language that is no language. */
746
747 static int
748 unk_lang_parser (struct parser_state *ps)
749 {
750 return 1;
751 }
752
753 static void
754 unk_lang_error (const char *msg)
755 {
756 error (_("Attempted to parse an expression with unknown language"));
757 }
758
759 static void
760 unk_lang_emit_char (int c, struct type *type, struct ui_file *stream,
761 int quoter)
762 {
763 error (_("internal error - unimplemented "
764 "function unk_lang_emit_char called."));
765 }
766
767 static void
768 unk_lang_printchar (int c, struct type *type, struct ui_file *stream)
769 {
770 error (_("internal error - unimplemented "
771 "function unk_lang_printchar called."));
772 }
773
774 static void
775 unk_lang_printstr (struct ui_file *stream, struct type *type,
776 const gdb_byte *string, unsigned int length,
777 const char *encoding, int force_ellipses,
778 const struct value_print_options *options)
779 {
780 error (_("internal error - unimplemented "
781 "function unk_lang_printstr called."));
782 }
783
784 static void
785 unk_lang_print_type (struct type *type, const char *varstring,
786 struct ui_file *stream, int show, int level,
787 const struct type_print_options *flags)
788 {
789 error (_("internal error - unimplemented "
790 "function unk_lang_print_type called."));
791 }
792
793 static void
794 unk_lang_val_print (struct type *type,
795 int embedded_offset, CORE_ADDR address,
796 struct ui_file *stream, int recurse,
797 struct value *val,
798 const struct value_print_options *options)
799 {
800 error (_("internal error - unimplemented "
801 "function unk_lang_val_print called."));
802 }
803
804 static void
805 unk_lang_value_print (struct value *val, struct ui_file *stream,
806 const struct value_print_options *options)
807 {
808 error (_("internal error - unimplemented "
809 "function unk_lang_value_print called."));
810 }
811
812 static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc)
813 {
814 return 0;
815 }
816
817 /* Unknown languages just use the cplus demangler. */
818 static char *unk_lang_demangle (const char *mangled, int options)
819 {
820 return gdb_demangle (mangled, options);
821 }
822
823 static char *unk_lang_class_name (const char *mangled)
824 {
825 return NULL;
826 }
827
828 static const struct op_print unk_op_print_tab[] =
829 {
830 {NULL, OP_NULL, PREC_NULL, 0}
831 };
832
833 static void
834 unknown_language_arch_info (struct gdbarch *gdbarch,
835 struct language_arch_info *lai)
836 {
837 lai->string_char_type = builtin_type (gdbarch)->builtin_char;
838 lai->bool_type_default = builtin_type (gdbarch)->builtin_int;
839 lai->primitive_type_vector = GDBARCH_OBSTACK_CALLOC (gdbarch, 1,
840 struct type *);
841 }
842
843 const struct language_defn unknown_language_defn =
844 {
845 "unknown",
846 "Unknown",
847 language_unknown,
848 range_check_off,
849 case_sensitive_on,
850 array_row_major,
851 macro_expansion_no,
852 NULL,
853 &exp_descriptor_standard,
854 unk_lang_parser,
855 unk_lang_error,
856 null_post_parser,
857 unk_lang_printchar, /* Print character constant */
858 unk_lang_printstr,
859 unk_lang_emit_char,
860 unk_lang_print_type, /* Print a type using appropriate syntax */
861 default_print_typedef, /* Print a typedef using appropriate syntax */
862 unk_lang_val_print, /* Print a value using appropriate syntax */
863 unk_lang_value_print, /* Print a top-level value */
864 default_read_var_value, /* la_read_var_value */
865 unk_lang_trampoline, /* Language specific skip_trampoline */
866 "this", /* name_of_this */
867 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
868 basic_lookup_transparent_type,/* lookup_transparent_type */
869 unk_lang_demangle, /* Language specific symbol demangler */
870 NULL,
871 unk_lang_class_name, /* Language specific
872 class_name_from_physname */
873 unk_op_print_tab, /* expression operators for printing */
874 1, /* c-style arrays */
875 0, /* String lower bound */
876 default_word_break_characters,
877 default_collect_symbol_completion_matches,
878 unknown_language_arch_info, /* la_language_arch_info. */
879 default_print_array_index,
880 default_pass_by_reference,
881 default_get_string,
882 c_watch_location_expression,
883 NULL, /* la_get_symbol_name_matcher */
884 iterate_over_symbols,
885 default_search_name_hash,
886 &default_varobj_ops,
887 NULL,
888 NULL,
889 LANG_MAGIC
890 };
891
892 /* These two structs define fake entries for the "local" and "auto"
893 options. */
894 const struct language_defn auto_language_defn =
895 {
896 "auto",
897 "Auto",
898 language_auto,
899 range_check_off,
900 case_sensitive_on,
901 array_row_major,
902 macro_expansion_no,
903 NULL,
904 &exp_descriptor_standard,
905 unk_lang_parser,
906 unk_lang_error,
907 null_post_parser,
908 unk_lang_printchar, /* Print character constant */
909 unk_lang_printstr,
910 unk_lang_emit_char,
911 unk_lang_print_type, /* Print a type using appropriate syntax */
912 default_print_typedef, /* Print a typedef using appropriate syntax */
913 unk_lang_val_print, /* Print a value using appropriate syntax */
914 unk_lang_value_print, /* Print a top-level value */
915 default_read_var_value, /* la_read_var_value */
916 unk_lang_trampoline, /* Language specific skip_trampoline */
917 "this", /* name_of_this */
918 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
919 basic_lookup_transparent_type,/* lookup_transparent_type */
920 unk_lang_demangle, /* Language specific symbol demangler */
921 NULL,
922 unk_lang_class_name, /* Language specific
923 class_name_from_physname */
924 unk_op_print_tab, /* expression operators for printing */
925 1, /* c-style arrays */
926 0, /* String lower bound */
927 default_word_break_characters,
928 default_collect_symbol_completion_matches,
929 unknown_language_arch_info, /* la_language_arch_info. */
930 default_print_array_index,
931 default_pass_by_reference,
932 default_get_string,
933 c_watch_location_expression,
934 NULL, /* la_get_symbol_name_matcher */
935 iterate_over_symbols,
936 default_search_name_hash,
937 &default_varobj_ops,
938 NULL,
939 NULL,
940 LANG_MAGIC
941 };
942
943
944 /* Per-architecture language information. */
945
946 static struct gdbarch_data *language_gdbarch_data;
947
948 struct language_gdbarch
949 {
950 /* A vector of per-language per-architecture info. Indexed by "enum
951 language". */
952 struct language_arch_info arch_info[nr_languages];
953 };
954
955 static void *
956 language_gdbarch_post_init (struct gdbarch *gdbarch)
957 {
958 struct language_gdbarch *l;
959
960 l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch);
961 for (const auto &lang : languages)
962 if (lang != NULL && lang->la_language_arch_info != NULL)
963 {
964 lang->la_language_arch_info (gdbarch,
965 l->arch_info + lang->la_language);
966 }
967
968 return l;
969 }
970
971 struct type *
972 language_string_char_type (const struct language_defn *la,
973 struct gdbarch *gdbarch)
974 {
975 struct language_gdbarch *ld
976 = (struct language_gdbarch *) gdbarch_data (gdbarch, language_gdbarch_data);
977
978 return ld->arch_info[la->la_language].string_char_type;
979 }
980
981 struct type *
982 language_bool_type (const struct language_defn *la,
983 struct gdbarch *gdbarch)
984 {
985 struct language_gdbarch *ld
986 = (struct language_gdbarch *) gdbarch_data (gdbarch, language_gdbarch_data);
987
988 if (ld->arch_info[la->la_language].bool_type_symbol)
989 {
990 struct symbol *sym;
991
992 sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
993 NULL, VAR_DOMAIN, NULL).symbol;
994 if (sym)
995 {
996 struct type *type = SYMBOL_TYPE (sym);
997
998 if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
999 return type;
1000 }
1001 }
1002
1003 return ld->arch_info[la->la_language].bool_type_default;
1004 }
1005
1006 /* Helper function for primitive type lookup. */
1007
1008 static struct type **
1009 language_lookup_primitive_type_1 (const struct language_arch_info *lai,
1010 const char *name)
1011 {
1012 struct type **p;
1013
1014 for (p = lai->primitive_type_vector; (*p) != NULL; p++)
1015 {
1016 if (strcmp (TYPE_NAME (*p), name) == 0)
1017 return p;
1018 }
1019 return NULL;
1020 }
1021
1022 /* See language.h. */
1023
1024 struct type *
1025 language_lookup_primitive_type (const struct language_defn *la,
1026 struct gdbarch *gdbarch,
1027 const char *name)
1028 {
1029 struct language_gdbarch *ld =
1030 (struct language_gdbarch *) gdbarch_data (gdbarch, language_gdbarch_data);
1031 struct type **typep;
1032
1033 typep = language_lookup_primitive_type_1 (&ld->arch_info[la->la_language],
1034 name);
1035 if (typep == NULL)
1036 return NULL;
1037 return *typep;
1038 }
1039
1040 /* Helper function for type lookup as a symbol.
1041 Create the symbol corresponding to type TYPE in language LANG. */
1042
1043 static struct symbol *
1044 language_alloc_type_symbol (enum language lang, struct type *type)
1045 {
1046 struct symbol *symbol;
1047 struct gdbarch *gdbarch;
1048
1049 gdb_assert (!TYPE_OBJFILE_OWNED (type));
1050
1051 gdbarch = TYPE_OWNER (type).gdbarch;
1052 symbol = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct symbol);
1053
1054 symbol->ginfo.name = TYPE_NAME (type);
1055 symbol->ginfo.language = lang;
1056 symbol->owner.arch = gdbarch;
1057 SYMBOL_OBJFILE_OWNED (symbol) = 0;
1058 SYMBOL_TYPE (symbol) = type;
1059 SYMBOL_DOMAIN (symbol) = VAR_DOMAIN;
1060 SYMBOL_ACLASS_INDEX (symbol) = LOC_TYPEDEF;
1061
1062 return symbol;
1063 }
1064
1065 /* Initialize the primitive type symbols of language LD.
1066 The primitive type vector must have already been initialized. */
1067
1068 static void
1069 language_init_primitive_type_symbols (struct language_arch_info *lai,
1070 const struct language_defn *la,
1071 struct gdbarch *gdbarch)
1072 {
1073 int n;
1074
1075 gdb_assert (lai->primitive_type_vector != NULL);
1076
1077 for (n = 0; lai->primitive_type_vector[n] != NULL; ++n)
1078 continue;
1079
1080 lai->primitive_type_symbols
1081 = GDBARCH_OBSTACK_CALLOC (gdbarch, n + 1, struct symbol *);
1082
1083 for (n = 0; lai->primitive_type_vector[n] != NULL; ++n)
1084 {
1085 lai->primitive_type_symbols[n]
1086 = language_alloc_type_symbol (la->la_language,
1087 lai->primitive_type_vector[n]);
1088 }
1089
1090 /* Note: The result of symbol lookup is normally a symbol *and* the block
1091 it was found in. Builtin types don't live in blocks. We *could* give
1092 them one, but there is no current need so to keep things simple symbol
1093 lookup is extended to allow for BLOCK_FOUND to be NULL. */
1094 }
1095
1096 /* See language.h. */
1097
1098 struct symbol *
1099 language_lookup_primitive_type_as_symbol (const struct language_defn *la,
1100 struct gdbarch *gdbarch,
1101 const char *name)
1102 {
1103 struct language_gdbarch *ld
1104 = (struct language_gdbarch *) gdbarch_data (gdbarch, language_gdbarch_data);
1105 struct language_arch_info *lai = &ld->arch_info[la->la_language];
1106 struct type **typep;
1107 struct symbol *sym;
1108
1109 if (symbol_lookup_debug)
1110 {
1111 fprintf_unfiltered (gdb_stdlog,
1112 "language_lookup_primitive_type_as_symbol"
1113 " (%s, %s, %s)",
1114 la->la_name, host_address_to_string (gdbarch), name);
1115 }
1116
1117 typep = language_lookup_primitive_type_1 (lai, name);
1118 if (typep == NULL)
1119 {
1120 if (symbol_lookup_debug)
1121 fprintf_unfiltered (gdb_stdlog, " = NULL\n");
1122 return NULL;
1123 }
1124
1125 /* The set of symbols is lazily initialized. */
1126 if (lai->primitive_type_symbols == NULL)
1127 language_init_primitive_type_symbols (lai, la, gdbarch);
1128
1129 sym = lai->primitive_type_symbols[typep - lai->primitive_type_vector];
1130
1131 if (symbol_lookup_debug)
1132 fprintf_unfiltered (gdb_stdlog, " = %s\n", host_address_to_string (sym));
1133 return sym;
1134 }
1135
1136 /* Initialize the language routines. */
1137
1138 void
1139 _initialize_language (void)
1140 {
1141 static const char *const type_or_range_names[]
1142 = { "on", "off", "warn", "auto", NULL };
1143
1144 static const char *const case_sensitive_names[]
1145 = { "on", "off", "auto", NULL };
1146
1147 language_gdbarch_data
1148 = gdbarch_data_register_post_init (language_gdbarch_post_init);
1149
1150 /* GDB commands for language specific stuff. */
1151
1152 add_prefix_cmd ("check", no_class, set_check,
1153 _("Set the status of the type/range checker."),
1154 &setchecklist, "set check ", 0, &setlist);
1155 add_alias_cmd ("c", "check", no_class, 1, &setlist);
1156 add_alias_cmd ("ch", "check", no_class, 1, &setlist);
1157
1158 add_prefix_cmd ("check", no_class, show_check,
1159 _("Show the status of the type/range checker."),
1160 &showchecklist, "show check ", 0, &showlist);
1161 add_alias_cmd ("c", "check", no_class, 1, &showlist);
1162 add_alias_cmd ("ch", "check", no_class, 1, &showlist);
1163
1164 add_setshow_enum_cmd ("range", class_support, type_or_range_names,
1165 &range,
1166 _("Set range checking. (on/warn/off/auto)"),
1167 _("Show range checking. (on/warn/off/auto)"),
1168 NULL, set_range_command,
1169 show_range_command,
1170 &setchecklist, &showchecklist);
1171
1172 add_setshow_enum_cmd ("case-sensitive", class_support, case_sensitive_names,
1173 &case_sensitive, _("\
1174 Set case sensitivity in name search. (on/off/auto)"), _("\
1175 Show case sensitivity in name search. (on/off/auto)"), _("\
1176 For Fortran the default is off; for other languages the default is on."),
1177 set_case_command,
1178 show_case_command,
1179 &setlist, &showlist);
1180
1181 add_set_language_command ();
1182
1183 language = xstrdup ("auto");
1184 type = xstrdup ("auto");
1185 range = xstrdup ("auto");
1186 case_sensitive = xstrdup ("auto");
1187
1188 /* Have the above take effect. */
1189 set_language (language_auto);
1190 }
gdbarch
Definition: gdbarch.c:127
string
const char * string
Definition: signals.c:50
unknown_language_defn
const struct language_defn unknown_language_defn
Definition: language.c:843
rust_language_defn
const struct language_defn rust_language_defn
unk_lang_class_name
static char * unk_lang_class_name(const char *mangled)
Definition: language.c:823
nr_languages
Definition: defs.h:220
lookup_name_info::ada
const ada_lookup_name_info & ada() const
Definition: symtab.h:240
TYPE_CODE_BOOL
Definition: gdbtypes.h:164
range_check_on
Definition: language.h:61
symbol::owner
union symbol::@173 owner
ada_lookup_name_info::verbatim_p
bool verbatim_p() const
Definition: symtab.h:114
setchecklist
struct cmd_list_element * setchecklist
Definition: cli-cmds.c:157
range
static const char * range
Definition: language.c:114
c_language_defn
const struct language_defn c_language_defn
language_lookup_primitive_type_as_symbol
struct symbol * language_lookup_primitive_type_as_symbol(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
Definition: language.c:1099
TYPE_OBJFILE_OWNED
#define TYPE_OBJFILE_OWNED(t)
Definition: gdbtypes.h:289
language_info
void language_info(int quietly)
Definition: language.c:394
cplus_language_defn
const struct language_defn cplus_language_defn
get_selected_frame
struct frame_info * get_selected_frame(const char *message)
Definition: frame.c:1638
range_check_off
Definition: language.h:61
range_check_warn
Definition: language.h:61
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
showchecklist
struct cmd_list_element * showchecklist
Definition: cli-cmds.c:159
default_search_name_hash
unsigned int default_search_name_hash(const char *string0)
Definition: dictionary.c:769
range_mode
range_mode
Definition: language.h:48
language_defn::la_pass_by_reference
int(* la_pass_by_reference)(struct type *type)
Definition: language.h:341
show_case_command
static void show_case_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition: language.c:293
d_language_defn
const struct language_defn d_language_defn
no_class
Definition: command.h:41
pointer_type
int pointer_type(struct type *type)
Definition: language.c:415
PREC_NULL
Definition: parser-defs.h:296
languages
static const struct language_defn * languages[]
Definition: language.c:92
class_support
Definition: command.h:42
GDBARCH_OBSTACK_CALLOC
#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE)
Definition: gdbarch.h:1708
cmd_list_element
Definition: cli-decode.h:46
language_defn::la_case_sensitivity
enum case_sensitivity la_case_sensitivity
Definition: language.h:151
default_word_break_characters
const char * default_word_break_characters(void)
Definition: language.c:679
warning
void warning(const char *fmt,...)
Definition: errors.c:26
symbol_search_name
const char * symbol_search_name(const struct general_symbol_info *gsymbol)
Definition: symtab.c:943
TYPE_NAME
#define TYPE_NAME(thistype)
Definition: gdbtypes.h:1224
get_symbol_name_matcher
symbol_name_matcher_ftype * get_symbol_name_matcher(const language_defn *lang, const lookup_name_info &lookup_name)
Definition: language.c:730
compare_cstrings
static bool compare_cstrings(const char *str1, const char *str2)
Definition: utils.h:102
set_language
enum language set_language(enum language lang)
Definition: language.c:379
lookup_name_info::completion_mode
bool completion_mode() const
Definition: symtab.h:195
language_string_char_type
struct type * language_string_char_type(const struct language_defn *la, struct gdbarch *gdbarch)
Definition: language.c:972
builtin_type
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
Definition: gdbtypes.c:5217
f_language_defn
const struct language_defn f_language_defn
RETURN_MASK_ERROR
Definition: common-exceptions.h:43
internal_error
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
language_def
const struct language_defn * language_def(enum language lang)
Definition: language.c:494
strncmp_iw_mode::MATCH_PARAMS
add_setshow_enum_cmd
void 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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
Definition: cli-decode.c:515
varobj.h
add_filename_language
void add_filename_language(const char *ext, enum language lang)
Definition: symfile.c:2680
symbol_lookup_debug
unsigned int symbol_lookup_debug
Definition: symtab.c:218
symbol_name_matcher_ftype
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:324
default_read_var_value
struct value * default_read_var_value(struct symbol *var, const struct block *var_block, struct frame_info *frame)
Definition: findvar.c:587
language_enum
enum language language_enum(const char *str)
Definition: language.c:479
pascal_language_defn
const struct language_defn pascal_language_defn
set_initial_language
void set_initial_language(void)
Definition: symfile.c:1690
frame_info
Definition: frame.c:85
cp-support.h
language_defn::la_language
enum language la_language
Definition: language.h:144
LOC_TYPEDEF
Definition: symtab.h:844
set_range_case
static void set_range_case(void)
Definition: language.c:366
language_gdbarch_post_init
static void * language_gdbarch_post_init(struct gdbarch *gdbarch)
Definition: language.c:956
lookup_symbol
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:1893
default_print_typedef
void default_print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream)
Definition: typeprint.c:344
_
#define _(String)
Definition: gdb_locale.h:35
ui_file
Definition: ui-file.h:26
language_arch_info::string_char_type
struct type * string_char_type
Definition: language.h:122
defs.h
TYPE_OWNER
#define TYPE_OWNER(t)
Definition: gdbtypes.h:290
show_range_command
static void show_range_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition: language.c:218
typep
struct type * typep
Definition: linespec.c:82
END_CATCH
#define END_CATCH
Definition: common-exceptions.h:259
cleanup_check.ps
ps
Definition: cleanup_check.py:333
opencl_language_defn
const struct language_defn opencl_language_defn
case_mode_manual
Definition: language.h:71
asm_language_defn
const struct language_defn asm_language_defn
range_check
range_check
Definition: language.h:59
printf_filtered
void printf_filtered(const char *format,...)
Definition: utils.c:2045
case_sensitive_on
Definition: language.h:92
op_print
Definition: parser-defs.h:305
GDBARCH_OBSTACK_ZALLOC
#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE)
Definition: gdbarch.h:1709
host_address_to_string
#define host_address_to_string(ADDR)
Definition: print-utils.h:75
completion_match_result
Definition: completer.h:205
strncmp_iw_with_mode
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)
Definition: utils.c:2277
lang_frame_mismatch_warn
char lang_frame_mismatch_warn[]
Definition: language.c:119
TYPE_IS_REFERENCE
#define TYPE_IS_REFERENCE(t)
Definition: gdbtypes.h:332
language_defn
Definition: language.h:132
language_alloc_type_symbol
static struct symbol * language_alloc_type_symbol(enum language lang, struct type *type)
Definition: language.c:1044
add_prefix_cmd
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
Definition: cli-decode.c:367
parser-defs.h
flags
mach_port_t kern_return_t mach_port_t msgports 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:1891
TRY
#define TRY
Definition: common-exceptions.h:246
symtab.h
array_row_major
Definition: language.h:81
case_mode
case_mode
Definition: language.h:69
setlist
struct cmd_list_element * setlist
Definition: cli-cmds.c:111
name
const char *const name
Definition: aarch64-tdep.c:76
gdb_demangle
char * gdb_demangle(const char *name, int options)
Definition: cp-support.c:1518
auto_language_defn
const struct language_defn auto_language_defn
Definition: language.c:894
SYMBOL_ACLASS_INDEX
#define SYMBOL_ACLASS_INDEX(symbol)
Definition: symtab.h:1154
CATCH
#define CATCH(EXCEPTION, MASK)
Definition: common-exceptions.h:254
language_arch_info::primitive_type_symbols
struct symbol ** primitive_type_symbols
Definition: language.h:119
value_print_options
Definition: valprint.h:25
basic_lookup_symbol_nonlocal
struct block_symbol basic_lookup_symbol_nonlocal(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain)
Definition: symtab.c:2417
language_arch_info::bool_type_default
struct type * bool_type_default
Definition: language.h:127
go_language_defn
const struct language_defn go_language_defn
SYMBOL_DOMAIN
#define SYMBOL_DOMAIN(symbol)
Definition: symtab.h:1152
unk_lang_printchar
static void unk_lang_printchar(int c, struct type *type, struct ui_file *stream)
Definition: language.c:768
range_error
void range_error(const char *string,...)
Definition: language.c:448
language_ada
Definition: defs.h:219
verror
void void void void verror(const char *fmt, va_list args) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF(1
fprintf_filtered
void fprintf_filtered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2008
range_mode_manual
Definition: language.h:50
unk_lang_value_print
static void unk_lang_value_print(struct value *, struct ui_file *, const struct value_print_options *)
Definition: language.c:805
unk_lang_parser
static int unk_lang_parser(struct parser_state *)
Definition: language.c:748
vfprintf_filtered
void vfprintf_filtered(struct ui_file *stream, const char *format, va_list args)
Definition: utils.c:1963
fprintf_unfiltered
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2018
language_auto
Definition: defs.h:206
showlist
struct cmd_list_element * showlist
Definition: cli-cmds.c:119
frame.h
expression.h
language_arch_info::bool_type_symbol
const char * bool_type_symbol
Definition: language.h:125
default_pass_by_reference
int default_pass_by_reference(struct type *type)
Definition: language.c:669
basic_lookup_transparent_type
struct type * basic_lookup_transparent_type(const char *name)
Definition: symtab.c:2792
language_defn::la_class_name_from_physname
char *(* la_class_name_from_physname)(const char *physname)
Definition: language.h:300
language_str
const char * language_str(enum language lang)
Definition: language.c:502
type
Definition: gdbtypes.h:749
language_gdbarch_data
static struct gdbarch_data * language_gdbarch_data
Definition: language.c:946
language.h
case_mode_auto
Definition: language.h:71
add_set_language_command
static void add_set_language_command()
Definition: language.c:525
type
static const char * type
Definition: language.c:113
set_case_command
static void set_case_command(const char *ignore, int from_tty, struct cmd_list_element *c)
Definition: language.c:331
language_bool_type
struct type * language_bool_type(const struct language_defn *la, struct gdbarch *gdbarch)
Definition: language.c:982
unk_lang_error
static void unk_lang_error(const char *)
Definition: language.c:754
null_post_parser
void null_post_parser(expression_up *exp, int void_context_p)
Definition: parse.c:1319
strncmp_iw_mode::NORMAL
language_mode
language_mode
Definition: language.h:468
default_print_array_index
void default_print_array_index(struct value *index_value, struct ui_file *stream, const struct value_print_options *options)
Definition: language.c:687
range
Definition: value.c:62
unk_lang_emit_char
static void unk_lang_emit_char(int c, struct type *type, struct ui_file *stream, int quoter)
Definition: language.c:760
parser_state
Definition: parser-defs.h:38
printf_unfiltered
void printf_unfiltered(const char *format,...)
Definition: utils.c:2056
completion_match_result::match_for_lcd
completion_match_for_lcd match_for_lcd
Definition: completer.h:211
language_mode_manual
Definition: language.h:470
language_class_name_from_physname
char * language_class_name_from_physname(const struct language_defn *lang, const char *physname)
Definition: language.c:649
language_minimal
Definition: defs.h:218
cmd_show_list
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
Definition: cli-setshow.c:657
unknown_language_arch_info
static void unknown_language_arch_info(struct gdbarch *gdbarch, struct language_arch_info *lai)
Definition: language.c:834
add_alias_cmd
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *old, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
Definition: cli-decode.c:306
block_symbol::symbol
struct symbol * symbol
Definition: symtab.h:1136
general_symbol_info::name
const char * name
Definition: symtab.h:384
gdb_assert
#define gdb_assert(expr)
Definition: gdb_assert.h:32
value
Definition: value.c:169
SYMBOL_OBJFILE_OWNED
#define SYMBOL_OBJFILE_OWNED(symbol)
Definition: symtab.h:1156
default_collect_symbol_completion_matches
void default_collect_symbol_completion_matches(completion_tracker &tracker, complete_symbol_mode mode, symbol_name_match_type name_match_type, const char *text, const char *word, enum type_code code)
Definition: symtab.c:5190
unk_lang_val_print
static void unk_lang_val_print(struct type *type, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options)
Definition: language.c:794
TYPE_CODE_PTR
Definition: gdbtypes.h:84
ui_file::printf
void printf(const char *,...) ATTRIBUTE_PRINTF(2
Definition: ui-file.c:37
gdb_byte
bfd_byte gdb_byte
Definition: common-types.h:38
c_watch_location_expression
gdb::unique_xmalloc_ptr< char > c_watch_location_expression(struct type *type, CORE_ADDR addr)
Definition: c-lang.c:712
help_list
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
Definition: cli-decode.c:1071
language_mode_auto
Definition: language.h:470
language_gdbarch::arch_info
struct language_arch_info arch_info[nr_languages]
Definition: language.c:952
builtin_type::builtin_char
struct type * builtin_char
Definition: gdbtypes.h:1501
current_language
const struct language_defn * current_language
Definition: language.c:81
language_defn::la_demangle
char *(* la_demangle)(const char *mangled, int options)
Definition: language.h:281
language_lookup_primitive_type_1
static struct type ** language_lookup_primitive_type_1(const struct language_arch_info *lai, const char *name)
Definition: language.c:1009
macro_expansion_no
Definition: language.h:103
completion_match_result::set_match
void set_match(const char *m, const char *m_for_lcd=NULL)
Definition: completer.h:215
strncmp_iw_mode
strncmp_iw_mode
Definition: utils.h:36
language_demangle
char * language_demangle(const struct language_defn *current_language, const char *mangled, int options)
Definition: language.c:622
get_frame_language
enum language get_frame_language(struct frame_info *frame)
Definition: frame.c:2740
gdb_stderr
#define gdb_stderr
Definition: utils.h:344
default_get_string
void default_get_string(struct value *value, gdb_byte **buffer, int *length, struct type **char_type, const char **charset)
Definition: language.c:696
lookup_name_info::name
const std::string & name() const
Definition: symtab.h:196
TYPE_CODE
#define TYPE_CODE(thistype)
Definition: gdbtypes.h:1238
default_varobj_ops
#define default_varobj_ops
Definition: varobj.h:236
string_file::c_str
const char * c_str() const
Definition: ui-file.h:137
c-lang.h
language_defn::la_range_check
enum range_check la_range_check
Definition: language.h:148
general_symbol_info::language
__extension__ enum language language
Definition: symtab.h:432
exp_descriptor_standard
const struct exp_descriptor exp_descriptor_standard
Definition: parse.c:58
symbol
const char * symbol
Definition: signals.c:48
minimal_language_defn
const struct language_defn minimal_language_defn
expected_language
const struct language_defn * expected_language
Definition: language.c:87
type_print_options
Definition: typeprint.h:41
language_defn::la_get_symbol_name_matcher
symbol_name_matcher_ftype *(* la_get_symbol_name_matcher)(const lookup_name_info &)
Definition: language.h:373
m2_language_defn
const struct language_defn m2_language_defn
symbol::ginfo
struct general_symbol_info ginfo
Definition: symtab.h:1054
buffer
Definition: buffer.h:23
unk_lang_trampoline
static CORE_ADDR unk_lang_trampoline(struct frame_info *, CORE_ADDR pc)
Definition: language.c:812
show_check
static void show_check(const char *ignore, int from_tty)
Definition: language.c:516
target.h
value_logical_not
int value_logical_not(struct value *arg1)
Definition: valarith.c:1416
set_check
static void set_check(const char *ignore, int from_tty)
Definition: language.c:508
VAR_DOMAIN
Definition: symtab.h:739
value.h
completion_match_for_lcd
Definition: completer.h:134
symbol::arch
struct gdbarch * arch
Definition: symtab.h:1071
gdbtypes.h
language
static const char * language
Definition: language.c:112
ignore
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
Definition: corelow.c:879
language
language
Definition: defs.h:203
gdb_stdlog
#define gdb_stdlog
Definition: utils.h:349
_initialize_language
void _initialize_language(void)
Definition: language.c:1139
SYMBOL_TYPE
#define SYMBOL_TYPE(symbol)
Definition: symtab.h:1161
language_arch_info
Definition: language.h:109
symbol
Definition: symtab.h:1049
language_sniff_from_mangled_name
int language_sniff_from_mangled_name(const struct language_defn *lang, const char *mangled, char **demangled)
Definition: language.c:633
all_commands
Definition: command.h:39
LA_VALUE_PRINT
#define LA_VALUE_PRINT(val, stream, options)
Definition: language.h:524
case_sensitive
static const char * case_sensitive
Definition: language.c:115
iterate_over_symbols
void iterate_over_symbols(const struct block *block, const lookup_name_info &name, const domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback)
Definition: symtab.c:2849
objc_language_defn
const struct language_defn objc_language_defn
language_lookup_primitive_type
struct type * language_lookup_primitive_type(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
Definition: language.c:1025
skip_language_trampoline
CORE_ADDR skip_language_trampoline(struct frame_info *frame, CORE_ADDR pc)
Definition: language.c:599
language_gdbarch
Definition: language.c:948
vwarning
void void vwarning(const char *fmt, va_list args) ATTRIBUTE_PRINTF(1
language_unknown
Definition: defs.h:205
value_true
int value_true(struct value *val)
Definition: language.c:426
LANG_MAGIC
#define LANG_MAGIC
Definition: language.h:438
gdbarch_data
Definition: gdbarch.c:5084
language_arch_info::primitive_type_vector
struct type ** primitive_type_vector
Definition: language.h:115
language_defn::la_sniff_from_mangled_name
int(* la_sniff_from_mangled_name)(const char *mangled, char **demangled)
Definition: language.h:297
lookup_name_info
Definition: symtab.h:179
language_defn::la_name
const char * la_name
Definition: language.h:136
gdbcmd.h
has_stack_frames
int has_stack_frames(void)
Definition: frame.c:1609
case_sensitivity
case_sensitivity
Definition: language.h:90
default_symbol_name_matcher
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:705
unk_lang_print_type
static void unk_lang_print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
Definition: language.c:785
set_range_command
static void set_range_command(const char *ignore, int from_tty, struct cmd_list_element *c)
Definition: language.c:256
ada_language_defn
const struct language_defn ada_language_defn
error
void error(const char *fmt,...)
Definition: errors.c:38
case_sensitive_off
Definition: language.h:92
show_language_command
static void show_language_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition: language.c:128
gdbarch_data_register_post_init
struct gdbarch_data * gdbarch_data_register_post_init(gdbarch_data_post_init_ftype *post_init)
Definition: gdbarch.c:5136
language_init_primitive_type_symbols
static void language_init_primitive_type_symbols(struct language_arch_info *lai, const struct language_defn *la, struct gdbarch *gdbarch)
Definition: language.c:1069
unk_op_print_tab
static const struct op_print unk_op_print_tab[]
Definition: language.c:828
unk_lang_printstr
static void unk_lang_printstr(struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *encoding, int force_ellipses, const struct value_print_options *options)
Definition: language.c:775
language_pass_by_reference
int language_pass_by_reference(struct type *type)
Definition: language.c:660
range_mode_auto
Definition: language.h:50
symfile.h
unk_lang_demangle
static char * unk_lang_demangle(const char *mangled, int options)
Definition: language.c:818
set_language_command
static void set_language_command(const char *ignore, int from_tty, struct cmd_list_element *c)
Definition: language.c:158
gdb_stdout
#define gdb_stdout
Definition: utils.h:340
builtin_type::builtin_int
struct type * builtin_int
Definition: gdbtypes.h:1503
string_file
Definition: ui-file.h:106