GNU Binutils with patches for OS216
修订版 | 3cb92de7426578057cc03bb3e540772d0828b151 (tree) |
---|---|
时间 | 2017-02-22 06:32:50 |
作者 | Keith Seitz <keiths@redh...> |
Commiter | Keith Seitz |
Use struct block_symbol in linespec APIs.
This patch changes linespec's internal API functions to use block_symbol's
everywhere it currently uses struct symbol's.
gdb/ChangeLog
@@ -5861,7 +5861,7 @@ ada_iterate_over_symbols (const struct block *block, | ||
5861 | 5861 | ndefs = ada_lookup_symbol_list_worker (name, block, domain, &results, 0); |
5862 | 5862 | for (i = 0; i < ndefs; ++i) |
5863 | 5863 | { |
5864 | - if (! (*callback) (results[i].symbol, data)) | |
5864 | + if (! (*callback) (results[i], data)) | |
5865 | 5865 | break; |
5866 | 5866 | } |
5867 | 5867 | } |
@@ -45,9 +45,6 @@ | ||
45 | 45 | #include "stack.h" |
46 | 46 | #include "location.h" |
47 | 47 | |
48 | -typedef struct symbol *symbolp; | |
49 | -DEF_VEC_P (symbolp); | |
50 | - | |
51 | 48 | typedef struct type *typep; |
52 | 49 | DEF_VEC_P (typep); |
53 | 50 |
@@ -82,7 +79,7 @@ struct linespec | ||
82 | 79 | |
83 | 80 | /* A list of matching function symbols and minimal symbols. Both lists |
84 | 81 | may be NULL if no matching symbols were found. */ |
85 | - VEC (symbolp) *function_symbols; | |
82 | + VEC (block_symbol_d) *function_symbols; | |
86 | 83 | VEC (bound_minimal_symbol_d) *minimal_symbols; |
87 | 84 | |
88 | 85 | /* A structure of matching label symbols and the corresponding |
@@ -90,8 +87,8 @@ struct linespec | ||
90 | 87 | or both must be non-NULL. */ |
91 | 88 | struct |
92 | 89 | { |
93 | - VEC (symbolp) *label_symbols; | |
94 | - VEC (symbolp) *function_symbols; | |
90 | + VEC (block_symbol_d) *label_symbols; | |
91 | + VEC (block_symbol_d) *function_symbols; | |
95 | 92 | } labels; |
96 | 93 | }; |
97 | 94 | typedef struct linespec *linespec_p; |
@@ -168,7 +165,7 @@ struct collect_info | ||
168 | 165 | /* The result being accumulated. */ |
169 | 166 | struct |
170 | 167 | { |
171 | - VEC (symbolp) *symbols; | |
168 | + VEC (block_symbol_d) *symbols; | |
172 | 169 | VEC (bound_minimal_symbol_d) *minimal_symbols; |
173 | 170 | } result; |
174 | 171 | }; |
@@ -281,15 +278,16 @@ static struct symtabs_and_lines decode_objc (struct linespec_state *self, | ||
281 | 278 | static VEC (symtab_ptr) *symtabs_from_filename (const char *, |
282 | 279 | struct program_space *pspace); |
283 | 280 | |
284 | -static VEC (symbolp) *find_label_symbols (struct linespec_state *self, | |
285 | - VEC (symbolp) *function_symbols, | |
286 | - VEC (symbolp) **label_funcs_ret, | |
287 | - const char *name); | |
281 | +static VEC (block_symbol_d) *find_label_symbols | |
282 | + (struct linespec_state *self, | |
283 | + VEC (block_symbol_d) *function_symbols, | |
284 | + VEC (block_symbol_d) **label_funcs_ret, | |
285 | + const char *name); | |
288 | 286 | |
289 | 287 | static void find_linespec_symbols (struct linespec_state *self, |
290 | 288 | VEC (symtab_ptr) *file_symtabs, |
291 | 289 | const char *name, |
292 | - VEC (symbolp) **symbols, | |
290 | + VEC (block_symbol_d) **symbols, | |
293 | 291 | VEC (bound_minimal_symbol_d) **minsyms); |
294 | 292 | |
295 | 293 | static struct line_offset |
@@ -932,9 +930,9 @@ struct symbol_and_data_callback | ||
932 | 930 | symbols only. */ |
933 | 931 | |
934 | 932 | static int |
935 | -iterate_inline_only (struct symbol *sym, void *d) | |
933 | +iterate_inline_only (struct block_symbol sym, void *d) | |
936 | 934 | { |
937 | - if (SYMBOL_INLINED (sym)) | |
935 | + if (SYMBOL_INLINED (sym.symbol)) | |
938 | 936 | { |
939 | 937 | struct symbol_and_data_callback *cad |
940 | 938 | = (struct symbol_and_data_callback *) d; |
@@ -1586,7 +1584,7 @@ linespec_parse_basic (linespec_parser *parser) | ||
1586 | 1584 | { |
1587 | 1585 | char *name; |
1588 | 1586 | linespec_token token; |
1589 | - VEC (symbolp) *symbols, *labels; | |
1587 | + VEC (block_symbol_d) *symbols, *labels; | |
1590 | 1588 | VEC (bound_minimal_symbol_d) *minimal_symbols; |
1591 | 1589 | struct cleanup *cleanup; |
1592 | 1590 |
@@ -1790,14 +1788,16 @@ canonicalize_linespec (struct linespec_state *state, const linespec_p ls) | ||
1790 | 1788 | |
1791 | 1789 | if (explicit_loc->function_name == NULL) |
1792 | 1790 | { |
1793 | - struct symbol *s; | |
1791 | + struct block_symbol *s; | |
1794 | 1792 | |
1795 | 1793 | /* No function was specified, so add the symbol name. */ |
1796 | 1794 | gdb_assert (ls->labels.function_symbols != NULL |
1797 | - && (VEC_length (symbolp, ls->labels.function_symbols) | |
1795 | + && (VEC_length (block_symbol_d, | |
1796 | + ls->labels.function_symbols) | |
1798 | 1797 | == 1)); |
1799 | - s = VEC_index (symbolp, ls->labels.function_symbols, 0); | |
1800 | - explicit_loc->function_name = xstrdup (SYMBOL_NATURAL_NAME (s)); | |
1798 | + s = VEC_index (block_symbol_d, ls->labels.function_symbols, 0); | |
1799 | + explicit_loc->function_name | |
1800 | + = xstrdup (SYMBOL_NATURAL_NAME (s->symbol)); | |
1801 | 1801 | } |
1802 | 1802 | } |
1803 | 1803 |
@@ -1994,10 +1994,12 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls) | ||
1994 | 1994 | /* We have just a bunch of functions/methods or labels. */ |
1995 | 1995 | int i; |
1996 | 1996 | struct symtab_and_line sal; |
1997 | - struct symbol *sym; | |
1997 | + struct block_symbol *elt; | |
1998 | 1998 | |
1999 | - for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i) | |
1999 | + for (i = 0; | |
2000 | + VEC_iterate (block_symbol_d, ls->labels.label_symbols, i, elt); ++i) | |
2000 | 2001 | { |
2002 | + struct symbol *sym = elt->symbol; | |
2001 | 2003 | struct program_space *pspace = SYMTAB_PSPACE (symbol_symtab (sym)); |
2002 | 2004 | |
2003 | 2005 | if (symbol_to_sal (&sal, state->funfirstline, sym) |
@@ -2011,20 +2013,23 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls) | ||
2011 | 2013 | /* We have just a bunch of functions and/or methods. */ |
2012 | 2014 | int i; |
2013 | 2015 | struct symtab_and_line sal; |
2014 | - struct symbol *sym; | |
2015 | - bound_minimal_symbol_d *elem; | |
2016 | 2016 | struct program_space *pspace; |
2017 | 2017 | |
2018 | 2018 | if (ls->function_symbols != NULL) |
2019 | 2019 | { |
2020 | + struct block_symbol *elem; | |
2021 | + | |
2020 | 2022 | /* Sort symbols so that symbols with the same program space are next |
2021 | 2023 | to each other. */ |
2022 | - qsort (VEC_address (symbolp, ls->function_symbols), | |
2023 | - VEC_length (symbolp, ls->function_symbols), | |
2024 | - sizeof (symbolp), compare_symbols); | |
2024 | + qsort (VEC_address (block_symbol_d, ls->function_symbols), | |
2025 | + VEC_length (block_symbol_d, ls->function_symbols), | |
2026 | + sizeof (block_symbol_d), compare_symbols); | |
2025 | 2027 | |
2026 | - for (i = 0; VEC_iterate (symbolp, ls->function_symbols, i, sym); ++i) | |
2028 | + for (i = 0; | |
2029 | + VEC_iterate (block_symbol_d, ls->function_symbols, i, elem); ++i) | |
2027 | 2030 | { |
2031 | + struct symbol *sym = elem->symbol; | |
2032 | + | |
2028 | 2033 | pspace = SYMTAB_PSPACE (symbol_symtab (sym)); |
2029 | 2034 | set_current_program_space (pspace); |
2030 | 2035 | if (symbol_to_sal (&sal, state->funfirstline, sym) |
@@ -2036,6 +2041,8 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls) | ||
2036 | 2041 | |
2037 | 2042 | if (ls->minimal_symbols != NULL) |
2038 | 2043 | { |
2044 | + bound_minimal_symbol_d *elem; | |
2045 | + | |
2039 | 2046 | /* Sort minimal symbols by program space, too. */ |
2040 | 2047 | qsort (VEC_address (bound_minimal_symbol_d, ls->minimal_symbols), |
2041 | 2048 | VEC_length (bound_minimal_symbol_d, ls->minimal_symbols), |
@@ -2090,7 +2097,8 @@ convert_explicit_location_to_sals (struct linespec_state *self, | ||
2090 | 2097 | linespec_p result, |
2091 | 2098 | const struct explicit_location *explicit_loc) |
2092 | 2099 | { |
2093 | - VEC (symbolp) *symbols, *labels; | |
2100 | + VEC (block_symbol_d) *labels; | |
2101 | + VEC (block_symbol_d) *symbols; | |
2094 | 2102 | VEC (bound_minimal_symbol_d) *minimal_symbols; |
2095 | 2103 | |
2096 | 2104 | if (explicit_loc->source_filename != NULL) |
@@ -2434,16 +2442,16 @@ linespec_parser_delete (void *arg) | ||
2434 | 2442 | VEC_free (symtab_ptr, PARSER_RESULT (parser)->file_symtabs); |
2435 | 2443 | |
2436 | 2444 | if (PARSER_RESULT (parser)->function_symbols != NULL) |
2437 | - VEC_free (symbolp, PARSER_RESULT (parser)->function_symbols); | |
2445 | + VEC_free (block_symbol_d, PARSER_RESULT (parser)->function_symbols); | |
2438 | 2446 | |
2439 | 2447 | if (PARSER_RESULT (parser)->minimal_symbols != NULL) |
2440 | 2448 | VEC_free (bound_minimal_symbol_d, PARSER_RESULT (parser)->minimal_symbols); |
2441 | 2449 | |
2442 | 2450 | if (PARSER_RESULT (parser)->labels.label_symbols != NULL) |
2443 | - VEC_free (symbolp, PARSER_RESULT (parser)->labels.label_symbols); | |
2451 | + VEC_free (block_symbol_d, PARSER_RESULT (parser)->labels.label_symbols); | |
2444 | 2452 | |
2445 | 2453 | if (PARSER_RESULT (parser)->labels.function_symbols != NULL) |
2446 | - VEC_free (symbolp, PARSER_RESULT (parser)->labels.function_symbols); | |
2454 | + VEC_free (block_symbol_d, PARSER_RESULT (parser)->labels.function_symbols); | |
2447 | 2455 | |
2448 | 2456 | linespec_state_destructor (PARSER_STATE (parser)); |
2449 | 2457 | } |
@@ -2786,7 +2794,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg) | ||
2786 | 2794 | |
2787 | 2795 | add_all_symbol_names_from_pspace (&info, NULL, symbol_names); |
2788 | 2796 | |
2789 | - if (!VEC_empty (symbolp, info.result.symbols) | |
2797 | + if (!VEC_empty (block_symbol_d, info.result.symbols) | |
2790 | 2798 | || !VEC_empty (bound_minimal_symbol_d, info.result.minimal_symbols)) |
2791 | 2799 | { |
2792 | 2800 | char *saved_arg; |
@@ -2830,7 +2838,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg) | ||
2830 | 2838 | struct decode_compound_collector |
2831 | 2839 | { |
2832 | 2840 | /* The result vector. */ |
2833 | - VEC (symbolp) *symbols; | |
2841 | + VEC (block_symbol_d) *symbols; | |
2834 | 2842 | |
2835 | 2843 | /* A hash table of all symbols we found. We use this to avoid |
2836 | 2844 | adding any symbol more than once. */ |
@@ -2853,12 +2861,13 @@ struct decode_compound_collector | ||
2853 | 2861 | lookup_prefix_sym to collect type symbols. */ |
2854 | 2862 | |
2855 | 2863 | static int |
2856 | -collect_one_symbol (struct symbol *sym, void *d) | |
2864 | +collect_one_symbol (struct block_symbol block_sym, void *d) | |
2857 | 2865 | { |
2858 | 2866 | struct decode_compound_collector *collector |
2859 | 2867 | = (struct decode_compound_collector *) d; |
2860 | 2868 | void **slot; |
2861 | 2869 | struct type *t; |
2870 | + struct symbol *sym = block_sym.symbol; | |
2862 | 2871 | |
2863 | 2872 | if (SYMBOL_CLASS (sym) != LOC_TYPEDEF) |
2864 | 2873 | return 1; /* Continue iterating. */ |
@@ -2874,7 +2883,7 @@ collect_one_symbol (struct symbol *sym, void *d) | ||
2874 | 2883 | if (!*slot) |
2875 | 2884 | { |
2876 | 2885 | *slot = sym; |
2877 | - VEC_safe_push (symbolp, collector->symbols, sym); | |
2886 | + VEC_safe_push (block_symbol_d, collector->symbols, &block_sym); | |
2878 | 2887 | } |
2879 | 2888 | |
2880 | 2889 | return 1; /* Continue iterating. */ |
@@ -2882,7 +2891,7 @@ collect_one_symbol (struct symbol *sym, void *d) | ||
2882 | 2891 | |
2883 | 2892 | /* Return any symbols corresponding to CLASS_NAME in FILE_SYMTABS. */ |
2884 | 2893 | |
2885 | -static VEC (symbolp) * | |
2894 | +static VEC (block_symbol_d) * | |
2886 | 2895 | lookup_prefix_sym (struct linespec_state *state, VEC (symtab_ptr) *file_symtabs, |
2887 | 2896 | const char *class_name) |
2888 | 2897 | { |
@@ -2893,7 +2902,7 @@ lookup_prefix_sym (struct linespec_state *state, VEC (symtab_ptr) *file_symtabs, | ||
2893 | 2902 | struct cleanup *cleanup; |
2894 | 2903 | |
2895 | 2904 | collector.symbols = NULL; |
2896 | - outer = make_cleanup (VEC_cleanup (symbolp), &collector.symbols); | |
2905 | + outer = make_cleanup (VEC_cleanup (block_symbol_d), &collector.symbols); | |
2897 | 2906 | |
2898 | 2907 | collector.unique_syms = htab_create_alloc (1, htab_hash_pointer, |
2899 | 2908 | htab_eq_pointer, NULL, |
@@ -2934,20 +2943,22 @@ lookup_prefix_sym (struct linespec_state *state, VEC (symtab_ptr) *file_symtabs, | ||
2934 | 2943 | static int |
2935 | 2944 | compare_symbols (const void *a, const void *b) |
2936 | 2945 | { |
2937 | - struct symbol * const *sa = (struct symbol * const*) a; | |
2938 | - struct symbol * const *sb = (struct symbol * const*) b; | |
2946 | + const struct block_symbol *ba = (const struct block_symbol *) a; | |
2947 | + const struct block_symbol *bb = (const struct block_symbol *) b; | |
2948 | + const struct symbol *sa = ba->symbol; | |
2949 | + const struct symbol *sb = bb->symbol; | |
2939 | 2950 | uintptr_t uia, uib; |
2940 | 2951 | |
2941 | - uia = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (*sa)); | |
2942 | - uib = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (*sb)); | |
2952 | + uia = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (sa)); | |
2953 | + uib = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (sb)); | |
2943 | 2954 | |
2944 | 2955 | if (uia < uib) |
2945 | 2956 | return -1; |
2946 | 2957 | if (uia > uib) |
2947 | 2958 | return 1; |
2948 | 2959 | |
2949 | - uia = (uintptr_t) *sa; | |
2950 | - uib = (uintptr_t) *sb; | |
2960 | + uia = (uintptr_t) sa; | |
2961 | + uib = (uintptr_t) sb; | |
2951 | 2962 | |
2952 | 2963 | if (uia < uib) |
2953 | 2964 | return -1; |
@@ -3041,10 +3052,10 @@ find_superclass_methods (VEC (typep) *superclasses, | ||
3041 | 3052 | static void |
3042 | 3053 | find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs, |
3043 | 3054 | const char *class_name, const char *method_name, |
3044 | - VEC (symbolp) *sym_classes, VEC (symbolp) **symbols, | |
3055 | + VEC (block_symbol_d) *sym_classes, VEC (block_symbol_d) **symbols, | |
3045 | 3056 | VEC (bound_minimal_symbol_d) **minsyms) |
3046 | 3057 | { |
3047 | - struct symbol *sym; | |
3058 | + struct block_symbol *elt; | |
3048 | 3059 | struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); |
3049 | 3060 | int ix; |
3050 | 3061 | int last_result_len; |
@@ -3054,9 +3065,9 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs, | ||
3054 | 3065 | |
3055 | 3066 | /* Sort symbols so that symbols with the same program space are next |
3056 | 3067 | to each other. */ |
3057 | - qsort (VEC_address (symbolp, sym_classes), | |
3058 | - VEC_length (symbolp, sym_classes), | |
3059 | - sizeof (symbolp), | |
3068 | + qsort (VEC_address (block_symbol_d, sym_classes), | |
3069 | + VEC_length (block_symbol_d, sym_classes), | |
3070 | + sizeof (block_symbol_d), | |
3060 | 3071 | compare_symbols); |
3061 | 3072 | |
3062 | 3073 | info.state = self; |
@@ -3078,10 +3089,11 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs, | ||
3078 | 3089 | result_names = NULL; |
3079 | 3090 | make_cleanup (VEC_cleanup (const_char_ptr), &result_names); |
3080 | 3091 | last_result_len = 0; |
3081 | - for (ix = 0; VEC_iterate (symbolp, sym_classes, ix, sym); ++ix) | |
3092 | + for (ix = 0; VEC_iterate (block_symbol_d, sym_classes, ix, elt); ++ix) | |
3082 | 3093 | { |
3083 | 3094 | struct type *t; |
3084 | 3095 | struct program_space *pspace; |
3096 | + struct symbol *sym = elt->symbol; | |
3085 | 3097 | |
3086 | 3098 | /* Program spaces that are executing startup should have |
3087 | 3099 | been filtered out earlier. */ |
@@ -3093,10 +3105,11 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs, | ||
3093 | 3105 | |
3094 | 3106 | /* Handle all items from a single program space at once; and be |
3095 | 3107 | sure not to miss the last batch. */ |
3096 | - if (ix == VEC_length (symbolp, sym_classes) - 1 | |
3108 | + if (ix == VEC_length (block_symbol_d, sym_classes) - 1 | |
3097 | 3109 | || (pspace |
3098 | - != SYMTAB_PSPACE (symbol_symtab (VEC_index (symbolp, sym_classes, | |
3099 | - ix + 1))))) | |
3110 | + != SYMTAB_PSPACE (symbol_symtab (VEC_index (block_symbol_d, | |
3111 | + sym_classes, | |
3112 | + ix + 1)->symbol)))) | |
3100 | 3113 | { |
3101 | 3114 | /* If we did not find a direct implementation anywhere in |
3102 | 3115 | this program space, consider superclasses. */ |
@@ -3114,7 +3127,7 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs, | ||
3114 | 3127 | } |
3115 | 3128 | } |
3116 | 3129 | |
3117 | - if (!VEC_empty (symbolp, info.result.symbols) | |
3130 | + if (!VEC_empty (block_symbol_d, info.result.symbols) | |
3118 | 3131 | || !VEC_empty (bound_minimal_symbol_d, info.result.minimal_symbols)) |
3119 | 3132 | { |
3120 | 3133 | *symbols = info.result.symbols; |
@@ -3238,7 +3251,7 @@ symtabs_from_filename (const char *filename, | ||
3238 | 3251 | static void |
3239 | 3252 | find_function_symbols (struct linespec_state *state, |
3240 | 3253 | VEC (symtab_ptr) *file_symtabs, const char *name, |
3241 | - VEC (symbolp) **symbols, | |
3254 | + VEC (block_symbol_d) **symbols, | |
3242 | 3255 | VEC (bound_minimal_symbol_d) **minsyms) |
3243 | 3256 | { |
3244 | 3257 | struct collect_info info; |
@@ -3261,9 +3274,9 @@ find_function_symbols (struct linespec_state *state, | ||
3261 | 3274 | |
3262 | 3275 | do_cleanups (cleanup); |
3263 | 3276 | |
3264 | - if (VEC_empty (symbolp, info.result.symbols)) | |
3277 | + if (VEC_empty (block_symbol_d, info.result.symbols)) | |
3265 | 3278 | { |
3266 | - VEC_free (symbolp, info.result.symbols); | |
3279 | + VEC_free (block_symbol_d, info.result.symbols); | |
3267 | 3280 | *symbols = NULL; |
3268 | 3281 | } |
3269 | 3282 | else |
@@ -3285,7 +3298,7 @@ static void | ||
3285 | 3298 | find_linespec_symbols (struct linespec_state *state, |
3286 | 3299 | VEC (symtab_ptr) *file_symtabs, |
3287 | 3300 | const char *name, |
3288 | - VEC (symbolp) **symbols, | |
3301 | + VEC (block_symbol_d) **symbols, | |
3289 | 3302 | VEC (bound_minimal_symbol_d) **minsyms) |
3290 | 3303 | { |
3291 | 3304 | demangle_result_storage demangle_storage; |
@@ -3325,12 +3338,12 @@ find_linespec_symbols (struct linespec_state *state, | ||
3325 | 3338 | /* If we were unable to locate a symbol of the same name, try dividing |
3326 | 3339 | the name into class and method names and searching the class and its |
3327 | 3340 | baseclasses. */ |
3328 | - if (VEC_empty (symbolp, *symbols) | |
3341 | + if (VEC_empty (block_symbol_d, *symbols) | |
3329 | 3342 | && VEC_empty (bound_minimal_symbol_d, *minsyms)) |
3330 | 3343 | { |
3331 | 3344 | std::string klass, method; |
3332 | 3345 | const char *last, *p, *scope_op; |
3333 | - VEC (symbolp) *classes; | |
3346 | + VEC (block_symbol_d) *classes; | |
3334 | 3347 | |
3335 | 3348 | /* See if we can find a scope operator and break this symbol |
3336 | 3349 | name into namespaces${SCOPE_OPERATOR}class_name and method_name. */ |
@@ -3361,9 +3374,9 @@ find_linespec_symbols (struct linespec_state *state, | ||
3361 | 3374 | /* Find a list of classes named KLASS. */ |
3362 | 3375 | classes = lookup_prefix_sym (state, file_symtabs, klass.c_str ()); |
3363 | 3376 | struct cleanup *old_chain |
3364 | - = make_cleanup (VEC_cleanup (symbolp), &classes); | |
3377 | + = make_cleanup (VEC_cleanup (block_symbol_d), &classes); | |
3365 | 3378 | |
3366 | - if (!VEC_empty (symbolp, classes)) | |
3379 | + if (!VEC_empty (block_symbol_d, classes)) | |
3367 | 3380 | { |
3368 | 3381 | /* Now locate a list of suitable methods named METHOD. */ |
3369 | 3382 | TRY |
@@ -3390,19 +3403,21 @@ find_linespec_symbols (struct linespec_state *state, | ||
3390 | 3403 | /* Return all labels named NAME in FUNCTION_SYMBOLS. Return the |
3391 | 3404 | actual function symbol in which the label was found in LABEL_FUNC_RET. */ |
3392 | 3405 | |
3393 | -static VEC (symbolp) * | |
3406 | +static VEC (block_symbol_d) * | |
3394 | 3407 | find_label_symbols (struct linespec_state *self, |
3395 | - VEC (symbolp) *function_symbols, | |
3396 | - VEC (symbolp) **label_funcs_ret, const char *name) | |
3408 | + VEC (block_symbol_d) *function_symbols, | |
3409 | + VEC (block_symbol_d) **label_funcs_ret, const char *name) | |
3397 | 3410 | { |
3398 | 3411 | int ix; |
3399 | 3412 | const struct block *block; |
3400 | - struct symbol *sym; | |
3401 | - struct symbol *fn_sym; | |
3402 | - VEC (symbolp) *result = NULL; | |
3413 | + | |
3414 | + VEC (block_symbol_d) *result = NULL; | |
3403 | 3415 | |
3404 | 3416 | if (function_symbols == NULL) |
3405 | 3417 | { |
3418 | + struct block_symbol block_sym; | |
3419 | + struct block_symbol fn_block_sym; | |
3420 | + | |
3406 | 3421 | set_current_program_space (self->program_space); |
3407 | 3422 | block = get_current_search_block (); |
3408 | 3423 |
@@ -3412,29 +3427,35 @@ find_label_symbols (struct linespec_state *self, | ||
3412 | 3427 | ; |
3413 | 3428 | if (!block) |
3414 | 3429 | return NULL; |
3415 | - fn_sym = BLOCK_FUNCTION (block); | |
3430 | + fn_block_sym.symbol = BLOCK_FUNCTION (block); | |
3431 | + fn_block_sym.block = block; | |
3416 | 3432 | |
3417 | - sym = lookup_symbol (name, block, LABEL_DOMAIN, 0).symbol; | |
3433 | + block_sym = lookup_symbol (name, block, LABEL_DOMAIN, 0); | |
3418 | 3434 | |
3419 | - if (sym != NULL) | |
3435 | + if (block_sym.symbol != NULL) | |
3420 | 3436 | { |
3421 | - VEC_safe_push (symbolp, result, sym); | |
3422 | - VEC_safe_push (symbolp, *label_funcs_ret, fn_sym); | |
3437 | + VEC_safe_push (block_symbol_d, result, &block_sym); | |
3438 | + VEC_safe_push (block_symbol_d, *label_funcs_ret, &fn_block_sym); | |
3423 | 3439 | } |
3424 | 3440 | } |
3425 | 3441 | else |
3426 | 3442 | { |
3443 | + struct block_symbol *elt; | |
3444 | + | |
3427 | 3445 | for (ix = 0; |
3428 | - VEC_iterate (symbolp, function_symbols, ix, fn_sym); ++ix) | |
3446 | + VEC_iterate (block_symbol_d, function_symbols, ix, elt); ++ix) | |
3429 | 3447 | { |
3448 | + struct symbol *fn_sym = elt->symbol; | |
3449 | + struct block_symbol block_sym; | |
3450 | + | |
3430 | 3451 | set_current_program_space (SYMTAB_PSPACE (symbol_symtab (fn_sym))); |
3431 | 3452 | block = SYMBOL_BLOCK_VALUE (fn_sym); |
3432 | - sym = lookup_symbol (name, block, LABEL_DOMAIN, 0).symbol; | |
3453 | + block_sym = lookup_symbol (name, block, LABEL_DOMAIN, 0); | |
3433 | 3454 | |
3434 | - if (sym != NULL) | |
3455 | + if (block_sym.symbol != NULL) | |
3435 | 3456 | { |
3436 | - VEC_safe_push (symbolp, result, sym); | |
3437 | - VEC_safe_push (symbolp, *label_funcs_ret, fn_sym); | |
3457 | + VEC_safe_push (block_symbol_d, result, &block_sym); | |
3458 | + VEC_safe_push (block_symbol_d, *label_funcs_ret, elt); | |
3438 | 3459 | } |
3439 | 3460 | } |
3440 | 3461 | } |
@@ -3580,14 +3601,14 @@ linespec_parse_variable (struct linespec_state *self, const char *variable) | ||
3580 | 3601 | /* A callback used to possibly add a symbol to the results. */ |
3581 | 3602 | |
3582 | 3603 | static int |
3583 | -collect_symbols (struct symbol *sym, void *data) | |
3604 | +collect_symbols (struct block_symbol sym, void *data) | |
3584 | 3605 | { |
3585 | 3606 | struct collect_info *info = (struct collect_info *) data; |
3586 | 3607 | |
3587 | 3608 | /* In list mode, add all matching symbols, regardless of class. |
3588 | 3609 | This allows the user to type "list a_global_variable". */ |
3589 | - if (SYMBOL_CLASS (sym) == LOC_BLOCK || info->state->list_mode) | |
3590 | - VEC_safe_push (symbolp, info->result.symbols, sym); | |
3610 | + if (SYMBOL_CLASS (sym.symbol) == LOC_BLOCK || info->state->list_mode) | |
3611 | + VEC_safe_push (block_symbol_d, info->result.symbols, &sym); | |
3591 | 3612 | return 1; /* Continue iterating. */ |
3592 | 3613 | } |
3593 | 3614 |
@@ -3864,7 +3885,7 @@ add_matching_symbols_to_info (const char *name, | ||
3864 | 3885 | } |
3865 | 3886 | else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt)) |
3866 | 3887 | { |
3867 | - int prev_len = VEC_length (symbolp, info->result.symbols); | |
3888 | + int prev_len = VEC_length (block_symbol_d, info->result.symbols); | |
3868 | 3889 | |
3869 | 3890 | /* Program spaces that are executing startup should have |
3870 | 3891 | been filtered out earlier. */ |
@@ -3877,7 +3898,7 @@ add_matching_symbols_to_info (const char *name, | ||
3877 | 3898 | is in assembler, we might actually be looking for a label for |
3878 | 3899 | which we don't have debug info. Check for a minimal symbol in |
3879 | 3900 | this case. */ |
3880 | - if (prev_len == VEC_length (symbolp, info->result.symbols) | |
3901 | + if (prev_len == VEC_length (block_symbol_d, info->result.symbols) | |
3881 | 3902 | && elt->language == language_asm) |
3882 | 3903 | search_minsyms_for_name (info, name, pspace, elt); |
3883 | 3904 | } |
@@ -2798,7 +2798,9 @@ iterate_over_symbols (const struct block *block, const char *name, | ||
2798 | 2798 | if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), |
2799 | 2799 | SYMBOL_DOMAIN (sym), domain)) |
2800 | 2800 | { |
2801 | - if (!callback (sym, data)) | |
2801 | + struct block_symbol block_sym = {sym, block}; | |
2802 | + | |
2803 | + if (!callback (block_sym, data)) | |
2802 | 2804 | return; |
2803 | 2805 | } |
2804 | 2806 | } |
@@ -834,6 +834,9 @@ struct block_symbol | ||
834 | 834 | const struct block *block; |
835 | 835 | }; |
836 | 836 | |
837 | +typedef struct block_symbol block_symbol_d; | |
838 | +DEF_VEC_O (block_symbol_d); | |
839 | + | |
837 | 840 | extern const struct symbol_impl *symbol_impls; |
838 | 841 | |
839 | 842 | /* For convenience. All fields are NULL. This means "there is no |
@@ -1630,7 +1633,7 @@ VEC (CORE_ADDR) *find_pcs_for_symtab_line (struct symtab *symtab, int line, | ||
1630 | 1633 | should continue iterating, or zero to indicate that the iteration |
1631 | 1634 | should end. */ |
1632 | 1635 | |
1633 | -typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data); | |
1636 | +typedef int (symbol_found_callback_ftype) (struct block_symbol sym, void *data); | |
1634 | 1637 | |
1635 | 1638 | void iterate_over_symbols (const struct block *block, const char *name, |
1636 | 1639 | const domain_enum domain, |