OLD | NEW |
1 /* OpenCL language support for GDB, the GNU debugger. | 1 /* OpenCL language support for GDB, the GNU debugger. |
2 Copyright (C) 2010-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2010-2012 Free Software Foundation, Inc. |
3 | 3 |
4 Contributed by Ken Werner <ken.werner@de.ibm.com>. | 4 Contributed by Ken Werner <ken.werner@de.ibm.com>. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 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 | 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 | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 opencl_primitive_type_size_t, | 61 opencl_primitive_type_size_t, |
62 opencl_primitive_type_ptrdiff_t, | 62 opencl_primitive_type_ptrdiff_t, |
63 opencl_primitive_type_intptr_t, | 63 opencl_primitive_type_intptr_t, |
64 opencl_primitive_type_uintptr_t, | 64 opencl_primitive_type_uintptr_t, |
65 opencl_primitive_type_void, | 65 opencl_primitive_type_void, |
66 nr_opencl_primitive_types | 66 nr_opencl_primitive_types |
67 }; | 67 }; |
68 | 68 |
69 static struct gdbarch_data *opencl_type_data; | 69 static struct gdbarch_data *opencl_type_data; |
70 | 70 |
71 struct type ** | 71 static struct type ** |
72 builtin_opencl_type (struct gdbarch *gdbarch) | 72 builtin_opencl_type (struct gdbarch *gdbarch) |
73 { | 73 { |
74 return gdbarch_data (gdbarch, opencl_type_data); | 74 return gdbarch_data (gdbarch, opencl_type_data); |
75 } | 75 } |
76 | 76 |
77 /* Returns the corresponding OpenCL vector type from the given type code, | 77 /* Returns the corresponding OpenCL vector type from the given type code, |
78 the length of the element type, the unsigned flag and the amount of | 78 the length of the element type, the unsigned flag and the amount of |
79 elements (N). */ | 79 elements (N). */ |
80 | 80 |
81 static struct type * | 81 static struct type * |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 "structure"); | 954 "structure"); |
955 } | 955 } |
956 } | 956 } |
957 default: | 957 default: |
958 break; | 958 break; |
959 } | 959 } |
960 | 960 |
961 return evaluate_subexp_c (expect_type, exp, pos, noside); | 961 return evaluate_subexp_c (expect_type, exp, pos, noside); |
962 } | 962 } |
963 | 963 |
964 void | 964 static void |
965 opencl_language_arch_info (struct gdbarch *gdbarch, | 965 opencl_language_arch_info (struct gdbarch *gdbarch, |
966 struct language_arch_info *lai) | 966 struct language_arch_info *lai) |
967 { | 967 { |
968 struct type **types = builtin_opencl_type (gdbarch); | 968 struct type **types = builtin_opencl_type (gdbarch); |
969 | 969 |
970 /* Copy primitive types vector from gdbarch. */ | 970 /* Copy primitive types vector from gdbarch. */ |
971 lai->primitive_type_vector = types; | 971 lai->primitive_type_vector = types; |
972 | 972 |
973 /* Type of elements of strings. */ | 973 /* Type of elements of strings. */ |
974 lai->string_char_type = types [opencl_primitive_type_char]; | 974 lai->string_char_type = types [opencl_primitive_type_char]; |
(...skipping 26 matching lines...) Expand all Loading... |
1001 c_parse, | 1001 c_parse, |
1002 c_error, | 1002 c_error, |
1003 null_post_parser, | 1003 null_post_parser, |
1004 c_printchar, /* Print a character constant */ | 1004 c_printchar, /* Print a character constant */ |
1005 c_printstr, /* Function to print string constant */ | 1005 c_printstr, /* Function to print string constant */ |
1006 c_emit_char, /* Print a single char */ | 1006 c_emit_char, /* Print a single char */ |
1007 c_print_type, /* Print a type using appropriate syntax */ | 1007 c_print_type, /* Print a type using appropriate syntax */ |
1008 c_print_typedef, /* Print a typedef using appropriate syntax */ | 1008 c_print_typedef, /* Print a typedef using appropriate syntax */ |
1009 c_val_print, /* Print a value using appropriate syntax */ | 1009 c_val_print, /* Print a value using appropriate syntax */ |
1010 c_value_print, /* Print a top-level value */ | 1010 c_value_print, /* Print a top-level value */ |
| 1011 default_read_var_value, /* la_read_var_value */ |
1011 NULL, /* Language specific skip_trampoline */ | 1012 NULL, /* Language specific skip_trampoline */ |
1012 NULL, /* name_of_this */ | 1013 NULL, /* name_of_this */ |
1013 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ | 1014 basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ |
1014 basic_lookup_transparent_type,/* lookup_transparent_type */ | 1015 basic_lookup_transparent_type,/* lookup_transparent_type */ |
1015 NULL, /* Language specific symbol demangler */ | 1016 NULL, /* Language specific symbol demangler */ |
1016 NULL, /* Language specific | 1017 NULL, /* Language specific |
1017 class_name_from_physname */ | 1018 class_name_from_physname */ |
1018 c_op_print_tab, /* expression operators for printing */ | 1019 c_op_print_tab, /* expression operators for printing */ |
1019 1, /* c-style arrays */ | 1020 1, /* c-style arrays */ |
1020 0, /* String lower bound */ | 1021 0, /* String lower bound */ |
1021 default_word_break_characters, | 1022 default_word_break_characters, |
1022 default_make_symbol_completion_list, | 1023 default_make_symbol_completion_list, |
1023 opencl_language_arch_info, | 1024 opencl_language_arch_info, |
1024 default_print_array_index, | 1025 default_print_array_index, |
1025 default_pass_by_reference, | 1026 default_pass_by_reference, |
1026 c_get_string, | 1027 c_get_string, |
1027 strcmp_iw_ordered, | 1028 NULL,»» » » /* la_get_symbol_name_cmp */ |
1028 iterate_over_symbols, | 1029 iterate_over_symbols, |
1029 LANG_MAGIC | 1030 LANG_MAGIC |
1030 }; | 1031 }; |
1031 | 1032 |
1032 static void * | 1033 static void * |
1033 build_opencl_types (struct gdbarch *gdbarch) | 1034 build_opencl_types (struct gdbarch *gdbarch) |
1034 { | 1035 { |
1035 struct type **types | 1036 struct type **types |
1036 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_opencl_primitive_types + 1, | 1037 = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_opencl_primitive_types + 1, |
1037 struct type *); | 1038 struct type *); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 types[opencl_primitive_type_intptr_t] | 1110 types[opencl_primitive_type_intptr_t] |
1110 = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"); | 1111 = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"); |
1111 types[opencl_primitive_type_uintptr_t] | 1112 types[opencl_primitive_type_uintptr_t] |
1112 = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"); | 1113 = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"); |
1113 types[opencl_primitive_type_void] | 1114 types[opencl_primitive_type_void] |
1114 = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); | 1115 = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); |
1115 | 1116 |
1116 return types; | 1117 return types; |
1117 } | 1118 } |
1118 | 1119 |
| 1120 /* Provide a prototype to silence -Wmissing-prototypes. */ |
| 1121 extern initialize_file_ftype _initialize_opencl_language; |
| 1122 |
1119 void | 1123 void |
1120 _initialize_opencl_language (void) | 1124 _initialize_opencl_language (void) |
1121 { | 1125 { |
1122 opencl_type_data = gdbarch_data_register_post_init (build_opencl_types); | 1126 opencl_type_data = gdbarch_data_register_post_init (build_opencl_types); |
1123 add_language (&opencl_language_defn); | 1127 add_language (&opencl_language_defn); |
1124 } | 1128 } |
OLD | NEW |