OSDN Git Service

2009-02-05 Thiago Jung Bauermann <bauerman@br.ibm.com>
[pf3gnuchains/pf3gnuchains3x.git] / gdb / c-lang.c
1 /* C language support routines for GDB, the GNU debugger.
2
3    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003,
4    2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #include "defs.h"
22 #include "symtab.h"
23 #include "gdbtypes.h"
24 #include "expression.h"
25 #include "parser-defs.h"
26 #include "language.h"
27 #include "c-lang.h"
28 #include "valprint.h"
29 #include "macroscope.h"
30 #include "gdb_assert.h"
31 #include "charset.h"
32 #include "gdb_string.h"
33 #include "demangle.h"
34 #include "cp-abi.h"
35 #include "cp-support.h"
36
37 extern void _initialize_c_language (void);
38 static void c_emit_char (int c, struct ui_file * stream, int quoter);
39
40 /* Print the character C on STREAM as part of the contents of a literal
41    string whose delimiter is QUOTER.  Note that that format for printing
42    characters and strings is language specific. */
43
44 static void
45 c_emit_char (int c, struct ui_file *stream, int quoter)
46 {
47   const char *escape;
48   int host_char;
49
50   c &= 0xFF;                    /* Avoid sign bit follies */
51
52   escape = c_target_char_has_backslash_escape (c);
53   if (escape)
54     {
55       if (quoter == '"' && strcmp (escape, "0") == 0)
56         /* Print nulls embedded in double quoted strings as \000 to
57            prevent ambiguity.  */
58         fprintf_filtered (stream, "\\000");
59       else
60         fprintf_filtered (stream, "\\%s", escape);
61     }
62   else if (target_char_to_host (c, &host_char)
63            && host_char_print_literally (host_char))
64     {
65       if (host_char == '\\' || host_char == quoter)
66         fputs_filtered ("\\", stream);
67       fprintf_filtered (stream, "%c", host_char);
68     }
69   else
70     fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
71 }
72
73 void
74 c_printchar (int c, struct ui_file *stream)
75 {
76   fputc_filtered ('\'', stream);
77   LA_EMIT_CHAR (c, stream, '\'');
78   fputc_filtered ('\'', stream);
79 }
80
81 /* Print the character string STRING, printing at most LENGTH characters.
82    LENGTH is -1 if the string is nul terminated.  Each character is WIDTH bytes
83    long.  Printing stops early if the number hits print_max; repeat counts are
84    printed as appropriate.  Print ellipses at the end if we had to stop before
85    printing LENGTH characters, or if FORCE_ELLIPSES.  */
86
87 void
88 c_printstr (struct ui_file *stream, const gdb_byte *string,
89             unsigned int length, int width, int force_ellipses,
90             const struct value_print_options *options)
91 {
92   unsigned int i;
93   unsigned int things_printed = 0;
94   int in_quotes = 0;
95   int need_comma = 0;
96
97   /* If the string was not truncated due to `set print elements', and
98      the last byte of it is a null, we don't print that, in traditional C
99      style.  */
100   if (!force_ellipses
101       && length > 0
102       && (extract_unsigned_integer (string + (length - 1) * width, width)
103           == '\0'))
104     length--;
105
106   if (length == 0)
107     {
108       fputs_filtered ("\"\"", stream);
109       return;
110     }
111
112   for (i = 0; i < length && things_printed < options->print_max; ++i)
113     {
114       /* Position of the character we are examining
115          to see whether it is repeated.  */
116       unsigned int rep1;
117       /* Number of repetitions we have detected so far.  */
118       unsigned int reps;
119       unsigned long current_char;
120
121       QUIT;
122
123       if (need_comma)
124         {
125           fputs_filtered (", ", stream);
126           need_comma = 0;
127         }
128
129       current_char = extract_unsigned_integer (string + i * width, width);
130
131       rep1 = i + 1;
132       reps = 1;
133       while (rep1 < length
134              && extract_unsigned_integer (string + rep1 * width, width)
135              == current_char)
136         {
137           ++rep1;
138           ++reps;
139         }
140
141       if (reps > options->repeat_count_threshold)
142         {
143           if (in_quotes)
144             {
145               if (options->inspect_it)
146                 fputs_filtered ("\\\", ", stream);
147               else
148                 fputs_filtered ("\", ", stream);
149               in_quotes = 0;
150             }
151           LA_PRINT_CHAR (current_char, stream);
152           fprintf_filtered (stream, _(" <repeats %u times>"), reps);
153           i = rep1 - 1;
154           things_printed += options->repeat_count_threshold;
155           need_comma = 1;
156         }
157       else
158         {
159           if (!in_quotes)
160             {
161               if (options->inspect_it)
162                 fputs_filtered ("\\\"", stream);
163               else
164                 fputs_filtered ("\"", stream);
165               in_quotes = 1;
166             }
167           LA_EMIT_CHAR (current_char, stream, '"');
168           ++things_printed;
169         }
170     }
171
172   /* Terminate the quotes if necessary.  */
173   if (in_quotes)
174     {
175       if (options->inspect_it)
176         fputs_filtered ("\\\"", stream);
177       else
178         fputs_filtered ("\"", stream);
179     }
180
181   if (force_ellipses || i < length)
182     fputs_filtered ("...", stream);
183 }
184
185 /* Obtain a C string from the inferior storing it in a newly allocated
186    buffer in BUFFER, which should be freed by the caller.  The string is
187    read until a null character is found. If VALUE is an array with known
188    length, the function will not read past the end of the array.  LENGTH
189    will contain the size of the string in bytes (not counting the null
190    character).
191
192    Assumes strings are terminated by a null character.  The size of a character
193    is determined by the length of the target type of the pointer or array.
194    This means that a null byte present in a multi-byte character will not
195    terminate the string unless the whole character is null.
196
197    CHARSET is always set to the target charset.  */
198
199 void
200 c_get_string (struct value *value, gdb_byte **buffer, int *length,
201               const char **charset)
202 {
203   int err, width;
204   unsigned int fetchlimit;
205   struct type *type = check_typedef (value_type (value));
206   struct type *element_type = TYPE_TARGET_TYPE (type);
207
208   if (element_type == NULL)
209     goto error;
210
211   if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
212     {
213       /* If we know the size of the array, we can use it as a limit on the
214          number of characters to be fetched.  */
215       if (TYPE_NFIELDS (type) == 1
216           && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
217         {
218           LONGEST low_bound, high_bound;
219
220           get_discrete_bounds (TYPE_FIELD_TYPE (type, 0),
221                                &low_bound, &high_bound);
222           fetchlimit = high_bound - low_bound + 1;
223         }
224       else
225         fetchlimit = UINT_MAX;
226     }
227   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
228     fetchlimit = UINT_MAX;
229   else
230     /* We work only with arrays and pointers.  */
231     goto error;
232
233   element_type = check_typedef (element_type);
234   if (TYPE_CODE (element_type) != TYPE_CODE_INT
235       && TYPE_CODE (element_type) != TYPE_CODE_CHAR)
236     /* If the elements are not integers or characters, we don't consider it
237        a string.  */
238     goto error;
239
240   width = TYPE_LENGTH (element_type);
241
242   /* If the string lives in GDB's memory intead of the inferior's, then we
243      just need to copy it to BUFFER.  Also, since such strings are arrays
244      with known size, FETCHLIMIT will hold the size of the array.  */
245   if ((VALUE_LVAL (value) == not_lval
246        || VALUE_LVAL (value) == lval_internalvar)
247       && fetchlimit != UINT_MAX)
248     {
249       int i;
250       const gdb_byte *contents = value_contents (value);
251
252       /* Look for a null character.  */
253       for (i = 0; i < fetchlimit; i++)
254         if (extract_unsigned_integer (contents + i * width, width) == 0)
255           break;
256
257       /* I is now either the number of non-null characters, or FETCHLIMIT.  */
258       *length = i * width;
259       *buffer = xmalloc (*length);
260       memcpy (*buffer, contents, *length);
261       err = 0;
262     }
263   else
264     {
265       err = read_string (value_as_address (value), -1, width, fetchlimit,
266                          buffer, length);
267       if (err)
268         {
269           xfree (buffer);
270           error (_("Error reading string from inferior: %s"),
271                  safe_strerror (err));
272         }
273     }
274
275   /* If the last character is null, subtract it from LENGTH.  */
276   if (*length > 0
277       && extract_unsigned_integer (*buffer + *length - width, width) == 0)
278     *length -= width;
279
280   *charset = target_charset ();
281
282   return;
283
284  error:
285   {
286     char *type_str;
287
288     type_str = type_to_string (type);
289     if (type_str)
290       {
291         make_cleanup (xfree, type_str);
292         error (_("Trying to read string with inappropriate type `%s'."),
293                type_str);
294       }
295     else
296       error (_("Trying to read string with inappropriate type."));
297   }
298 }
299
300 \f
301 /* Preprocessing and parsing C and C++ expressions.  */
302
303
304 \f
305 /* Table mapping opcodes into strings for printing operators
306    and precedences of the operators.  */
307
308 const struct op_print c_op_print_tab[] =
309 {
310   {",", BINOP_COMMA, PREC_COMMA, 0},
311   {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
312   {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
313   {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
314   {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
315   {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
316   {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
317   {"==", BINOP_EQUAL, PREC_EQUAL, 0},
318   {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
319   {"<=", BINOP_LEQ, PREC_ORDER, 0},
320   {">=", BINOP_GEQ, PREC_ORDER, 0},
321   {">", BINOP_GTR, PREC_ORDER, 0},
322   {"<", BINOP_LESS, PREC_ORDER, 0},
323   {">>", BINOP_RSH, PREC_SHIFT, 0},
324   {"<<", BINOP_LSH, PREC_SHIFT, 0},
325   {"+", BINOP_ADD, PREC_ADD, 0},
326   {"-", BINOP_SUB, PREC_ADD, 0},
327   {"*", BINOP_MUL, PREC_MUL, 0},
328   {"/", BINOP_DIV, PREC_MUL, 0},
329   {"%", BINOP_REM, PREC_MUL, 0},
330   {"@", BINOP_REPEAT, PREC_REPEAT, 0},
331   {"-", UNOP_NEG, PREC_PREFIX, 0},
332   {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
333   {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
334   {"*", UNOP_IND, PREC_PREFIX, 0},
335   {"&", UNOP_ADDR, PREC_PREFIX, 0},
336   {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
337   {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
338   {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
339   {NULL, 0, 0, 0}
340 };
341 \f
342 enum c_primitive_types {
343   c_primitive_type_int,
344   c_primitive_type_long,
345   c_primitive_type_short,
346   c_primitive_type_char,
347   c_primitive_type_float,
348   c_primitive_type_double,
349   c_primitive_type_void,
350   c_primitive_type_long_long,
351   c_primitive_type_signed_char,
352   c_primitive_type_unsigned_char,
353   c_primitive_type_unsigned_short,
354   c_primitive_type_unsigned_int,
355   c_primitive_type_unsigned_long,
356   c_primitive_type_unsigned_long_long,
357   c_primitive_type_long_double,
358   c_primitive_type_complex,
359   c_primitive_type_double_complex,
360   c_primitive_type_decfloat,
361   c_primitive_type_decdouble,
362   c_primitive_type_declong,
363   nr_c_primitive_types
364 };
365
366 void
367 c_language_arch_info (struct gdbarch *gdbarch,
368                       struct language_arch_info *lai)
369 {
370   const struct builtin_type *builtin = builtin_type (gdbarch);
371   lai->string_char_type = builtin->builtin_char;
372   lai->primitive_type_vector
373     = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1,
374                               struct type *);
375   lai->primitive_type_vector [c_primitive_type_int] = builtin->builtin_int;
376   lai->primitive_type_vector [c_primitive_type_long] = builtin->builtin_long;
377   lai->primitive_type_vector [c_primitive_type_short] = builtin->builtin_short;
378   lai->primitive_type_vector [c_primitive_type_char] = builtin->builtin_char;
379   lai->primitive_type_vector [c_primitive_type_float] = builtin->builtin_float;
380   lai->primitive_type_vector [c_primitive_type_double] = builtin->builtin_double;
381   lai->primitive_type_vector [c_primitive_type_void] = builtin->builtin_void;
382   lai->primitive_type_vector [c_primitive_type_long_long] = builtin->builtin_long_long;
383   lai->primitive_type_vector [c_primitive_type_signed_char] = builtin->builtin_signed_char;
384   lai->primitive_type_vector [c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char;
385   lai->primitive_type_vector [c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short;
386   lai->primitive_type_vector [c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int;
387   lai->primitive_type_vector [c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long;
388   lai->primitive_type_vector [c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long;
389   lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double;
390   lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex;
391   lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex;
392   lai->primitive_type_vector [c_primitive_type_decfloat] = builtin->builtin_decfloat;
393   lai->primitive_type_vector [c_primitive_type_decdouble] = builtin->builtin_decdouble;
394   lai->primitive_type_vector [c_primitive_type_declong] = builtin->builtin_declong;
395
396   lai->bool_type_default = builtin->builtin_int;
397 }
398
399 const struct language_defn c_language_defn =
400 {
401   "c",                          /* Language name */
402   language_c,
403   range_check_off,
404   type_check_off,
405   case_sensitive_on,
406   array_row_major,
407   macro_expansion_c,
408   &exp_descriptor_standard,
409   c_parse,
410   c_error,
411   null_post_parser,
412   c_printchar,                  /* Print a character constant */
413   c_printstr,                   /* Function to print string constant */
414   c_emit_char,                  /* Print a single char */
415   c_print_type,                 /* Print a type using appropriate syntax */
416   c_print_typedef,              /* Print a typedef using appropriate syntax */
417   c_val_print,                  /* Print a value using appropriate syntax */
418   c_value_print,                /* Print a top-level value */
419   NULL,                         /* Language specific skip_trampoline */
420   NULL,                         /* name_of_this */
421   basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
422   basic_lookup_transparent_type,/* lookup_transparent_type */
423   NULL,                         /* Language specific symbol demangler */
424   NULL,                         /* Language specific class_name_from_physname */
425   c_op_print_tab,               /* expression operators for printing */
426   1,                            /* c-style arrays */
427   0,                            /* String lower bound */
428   default_word_break_characters,
429   default_make_symbol_completion_list,
430   c_language_arch_info,
431   default_print_array_index,
432   default_pass_by_reference,
433   c_get_string,
434   LANG_MAGIC
435 };
436
437 enum cplus_primitive_types {
438   cplus_primitive_type_int,
439   cplus_primitive_type_long,
440   cplus_primitive_type_short,
441   cplus_primitive_type_char,
442   cplus_primitive_type_float,
443   cplus_primitive_type_double,
444   cplus_primitive_type_void,
445   cplus_primitive_type_long_long,
446   cplus_primitive_type_signed_char,
447   cplus_primitive_type_unsigned_char,
448   cplus_primitive_type_unsigned_short,
449   cplus_primitive_type_unsigned_int,
450   cplus_primitive_type_unsigned_long,
451   cplus_primitive_type_unsigned_long_long,
452   cplus_primitive_type_long_double,
453   cplus_primitive_type_complex,
454   cplus_primitive_type_double_complex,
455   cplus_primitive_type_bool,
456   cplus_primitive_type_decfloat,
457   cplus_primitive_type_decdouble,
458   cplus_primitive_type_declong,
459   nr_cplus_primitive_types
460 };
461
462 static void
463 cplus_language_arch_info (struct gdbarch *gdbarch,
464                           struct language_arch_info *lai)
465 {
466   const struct builtin_type *builtin = builtin_type (gdbarch);
467   lai->string_char_type = builtin->builtin_char;
468   lai->primitive_type_vector
469     = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
470                               struct type *);
471   lai->primitive_type_vector [cplus_primitive_type_int]
472     = builtin->builtin_int;
473   lai->primitive_type_vector [cplus_primitive_type_long]
474     = builtin->builtin_long;
475   lai->primitive_type_vector [cplus_primitive_type_short]
476     = builtin->builtin_short;
477   lai->primitive_type_vector [cplus_primitive_type_char]
478     = builtin->builtin_char;
479   lai->primitive_type_vector [cplus_primitive_type_float]
480     = builtin->builtin_float;
481   lai->primitive_type_vector [cplus_primitive_type_double]
482     = builtin->builtin_double;
483   lai->primitive_type_vector [cplus_primitive_type_void]
484     = builtin->builtin_void;
485   lai->primitive_type_vector [cplus_primitive_type_long_long]
486     = builtin->builtin_long_long;
487   lai->primitive_type_vector [cplus_primitive_type_signed_char]
488     = builtin->builtin_signed_char;
489   lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
490     = builtin->builtin_unsigned_char;
491   lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
492     = builtin->builtin_unsigned_short;
493   lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
494     = builtin->builtin_unsigned_int;
495   lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
496     = builtin->builtin_unsigned_long;
497   lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
498     = builtin->builtin_unsigned_long_long;
499   lai->primitive_type_vector [cplus_primitive_type_long_double]
500     = builtin->builtin_long_double;
501   lai->primitive_type_vector [cplus_primitive_type_complex]
502     = builtin->builtin_complex;
503   lai->primitive_type_vector [cplus_primitive_type_double_complex]
504     = builtin->builtin_double_complex;
505   lai->primitive_type_vector [cplus_primitive_type_bool]
506     = builtin->builtin_bool;
507   lai->primitive_type_vector [cplus_primitive_type_decfloat]
508     = builtin->builtin_decfloat;
509   lai->primitive_type_vector [cplus_primitive_type_decdouble]
510     = builtin->builtin_decdouble;
511   lai->primitive_type_vector [cplus_primitive_type_declong]
512     = builtin->builtin_declong;
513
514   lai->bool_type_symbol = "bool";
515   lai->bool_type_default = builtin->builtin_bool;
516 }
517
518 const struct language_defn cplus_language_defn =
519 {
520   "c++",                        /* Language name */
521   language_cplus,
522   range_check_off,
523   type_check_off,
524   case_sensitive_on,
525   array_row_major,
526   macro_expansion_c,
527   &exp_descriptor_standard,
528   c_parse,
529   c_error,
530   null_post_parser,
531   c_printchar,                  /* Print a character constant */
532   c_printstr,                   /* Function to print string constant */
533   c_emit_char,                  /* Print a single char */
534   c_print_type,                 /* Print a type using appropriate syntax */
535   c_print_typedef,              /* Print a typedef using appropriate syntax */
536   c_val_print,                  /* Print a value using appropriate syntax */
537   c_value_print,                /* Print a top-level value */
538   cplus_skip_trampoline,        /* Language specific skip_trampoline */
539   "this",                       /* name_of_this */
540   cp_lookup_symbol_nonlocal,    /* lookup_symbol_nonlocal */
541   cp_lookup_transparent_type,   /* lookup_transparent_type */
542   cplus_demangle,               /* Language specific symbol demangler */
543   cp_class_name_from_physname,  /* Language specific class_name_from_physname */
544   c_op_print_tab,               /* expression operators for printing */
545   1,                            /* c-style arrays */
546   0,                            /* String lower bound */
547   default_word_break_characters,
548   default_make_symbol_completion_list,
549   cplus_language_arch_info,
550   default_print_array_index,
551   cp_pass_by_reference,
552   c_get_string,
553   LANG_MAGIC
554 };
555
556 const struct language_defn asm_language_defn =
557 {
558   "asm",                        /* Language name */
559   language_asm,
560   range_check_off,
561   type_check_off,
562   case_sensitive_on,
563   array_row_major,
564   macro_expansion_c,
565   &exp_descriptor_standard,
566   c_parse,
567   c_error,
568   null_post_parser,
569   c_printchar,                  /* Print a character constant */
570   c_printstr,                   /* Function to print string constant */
571   c_emit_char,                  /* Print a single char */
572   c_print_type,                 /* Print a type using appropriate syntax */
573   c_print_typedef,              /* Print a typedef using appropriate syntax */
574   c_val_print,                  /* Print a value using appropriate syntax */
575   c_value_print,                /* Print a top-level value */
576   NULL,                         /* Language specific skip_trampoline */
577   NULL,                         /* name_of_this */
578   basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
579   basic_lookup_transparent_type,/* lookup_transparent_type */
580   NULL,                         /* Language specific symbol demangler */
581   NULL,                         /* Language specific class_name_from_physname */
582   c_op_print_tab,               /* expression operators for printing */
583   1,                            /* c-style arrays */
584   0,                            /* String lower bound */
585   default_word_break_characters,
586   default_make_symbol_completion_list,
587   c_language_arch_info, /* FIXME: la_language_arch_info.  */
588   default_print_array_index,
589   default_pass_by_reference,
590   c_get_string,
591   LANG_MAGIC
592 };
593
594 /* The following language_defn does not represent a real language.
595    It just provides a minimal support a-la-C that should allow users
596    to do some simple operations when debugging applications that use
597    a language currently not supported by GDB.  */
598
599 const struct language_defn minimal_language_defn =
600 {
601   "minimal",                    /* Language name */
602   language_minimal,
603   range_check_off,
604   type_check_off,
605   case_sensitive_on,
606   array_row_major,
607   macro_expansion_c,
608   &exp_descriptor_standard,
609   c_parse,
610   c_error,
611   null_post_parser,
612   c_printchar,                  /* Print a character constant */
613   c_printstr,                   /* Function to print string constant */
614   c_emit_char,                  /* Print a single char */
615   c_print_type,                 /* Print a type using appropriate syntax */
616   c_print_typedef,              /* Print a typedef using appropriate syntax */
617   c_val_print,                  /* Print a value using appropriate syntax */
618   c_value_print,                /* Print a top-level value */
619   NULL,                         /* Language specific skip_trampoline */
620   NULL,                         /* name_of_this */
621   basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
622   basic_lookup_transparent_type,/* lookup_transparent_type */
623   NULL,                         /* Language specific symbol demangler */
624   NULL,                         /* Language specific class_name_from_physname */
625   c_op_print_tab,               /* expression operators for printing */
626   1,                            /* c-style arrays */
627   0,                            /* String lower bound */
628   default_word_break_characters,
629   default_make_symbol_completion_list,
630   c_language_arch_info,
631   default_print_array_index,
632   default_pass_by_reference,
633   c_get_string,
634   LANG_MAGIC
635 };
636
637 void
638 _initialize_c_language (void)
639 {
640   add_language (&c_language_defn);
641   add_language (&cplus_language_defn);
642   add_language (&asm_language_defn);
643   add_language (&minimal_language_defn);
644 }