]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | --- ./gdb/linespec.c 2008-08-27 00:27:33.000000000 +0200 |
2 | +++ ./gdb/linespec.c 2008-08-27 00:53:16.000000000 +0200 | |
3 | @@ -284,6 +284,15 @@ find_methods (struct type *t, char *name | |
4 | } | |
5 | ||
6 | static int | |
7 | +add_minsym_members_compar (const void *ap, const void *bp) | |
8 | +{ | |
9 | + const char *a = *(const char **) ap; | |
10 | + const char *b = *(const char **) bp; | |
11 | + | |
12 | + return strcmp (a, b); | |
13 | +} | |
14 | + | |
15 | +static int | |
16 | add_minsym_members (const char *class_name, | |
17 | const char *member_name, | |
18 | struct minimal_symbol **msym_arr) | |
19 | @@ -293,6 +302,7 @@ add_minsym_members (const char *class_na | |
20 | int i; | |
21 | int comp_len; | |
22 | int counter = 0; | |
23 | + int src_i, dst_i; | |
24 | ||
25 | /* To find the member, we first cheat and use symbol completion. | |
26 | This will give us a list of all the member names including | |
27 | @@ -307,6 +317,28 @@ add_minsym_members (const char *class_na | |
28 | strcat (completion_name, "("); | |
29 | list = make_symbol_completion_list (completion_name, | |
30 | completion_name+1); | |
31 | + if (list == NULL || list[0] == NULL) | |
32 | + { | |
33 | + xfree (completion_name); | |
34 | + return 0; | |
35 | + } | |
36 | + | |
37 | + /* Make the list entries unique - Multi-PC breakpoints are already resolved | |
38 | + by GDB-6.8+. */ | |
39 | + counter = 0; | |
40 | + while (list && list[counter] != NULL) | |
41 | + counter++; | |
42 | + qsort (list, counter, sizeof (*list), add_minsym_members_compar); | |
43 | + src_i = dst_i = 0; | |
44 | + while (src_i + 1 < counter) | |
45 | + { | |
46 | + if (strcmp (list[src_i], list[src_i + 1]) != 0) | |
47 | + list[dst_i++] = list[src_i]; | |
48 | + src_i++; | |
49 | + } | |
50 | + list[dst_i++] = list[src_i++]; | |
51 | + gdb_assert (list[src_i] == NULL); | |
52 | + list[dst_i] = 0; | |
53 | ||
54 | /* Now that we have the list, we generate an array of their | |
55 | corresponding minimal symbols. */ | |
56 | @@ -319,6 +351,8 @@ add_minsym_members (const char *class_na | |
57 | ||
58 | xfree (list); | |
59 | ||
60 | +#if 0 /* Multi-PC breakpoints are already resolved by GDB-6.8+. */ | |
61 | + | |
62 | /* In the case of constructors, there may be in-charge vs not-in-charge | |
63 | constructors. Check for names with $base which indicates not-in-charge | |
64 | constructors. */ | |
65 | @@ -353,6 +387,8 @@ add_minsym_members (const char *class_na | |
66 | } | |
67 | xfree (list); | |
68 | ||
69 | +#endif /* Multi-PC breakpoints are already resolved by GDB-6.8+. */ | |
70 | + | |
71 | xfree (completion_name); | |
72 | ||
73 | return counter; |