gdb/gdb-6.8-ctors-dtors-unique.patch

74 lines
2.1 KiB
Diff
Raw Normal View History

--- ./gdb/linespec.c 2008-08-27 00:27:33.000000000 +0200
+++ ./gdb/linespec.c 2008-08-27 00:53:16.000000000 +0200
@@ -284,6 +284,15 @@ find_methods (struct type *t, char *name
}
static int
+add_minsym_members_compar (const void *ap, const void *bp)
+{
+ const char *a = *(const char **) ap;
+ const char *b = *(const char **) bp;
+
+ return strcmp (a, b);
+}
+
+static int
add_minsym_members (const char *class_name,
const char *member_name,
struct minimal_symbol **msym_arr)
@@ -293,6 +302,7 @@ add_minsym_members (const char *class_na
int i;
int comp_len;
int counter = 0;
+ int src_i, dst_i;
/* To find the member, we first cheat and use symbol completion.
This will give us a list of all the member names including
@@ -307,6 +317,28 @@ add_minsym_members (const char *class_na
strcat (completion_name, "(");
list = make_symbol_completion_list (completion_name,
completion_name+1);
+ if (list == NULL || list[0] == NULL)
+ {
+ xfree (completion_name);
+ return 0;
+ }
+
+ /* Make the list entries unique - Multi-PC breakpoints are already resolved
+ by GDB-6.8+. */
+ counter = 0;
+ while (list && list[counter] != NULL)
+ counter++;
+ qsort (list, counter, sizeof (*list), add_minsym_members_compar);
+ src_i = dst_i = 0;
+ while (src_i + 1 < counter)
+ {
+ if (strcmp (list[src_i], list[src_i + 1]) != 0)
+ list[dst_i++] = list[src_i];
+ src_i++;
+ }
+ list[dst_i++] = list[src_i++];
+ gdb_assert (list[src_i] == NULL);
+ list[dst_i] = 0;
/* Now that we have the list, we generate an array of their
corresponding minimal symbols. */
@@ -319,6 +351,8 @@ add_minsym_members (const char *class_na
xfree (list);
+#if 0 /* Multi-PC breakpoints are already resolved by GDB-6.8+. */
+
/* In the case of constructors, there may be in-charge vs not-in-charge
constructors. Check for names with $base which indicates not-in-charge
constructors. */
@@ -353,6 +387,8 @@ add_minsym_members (const char *class_na
}
xfree (list);
+#endif /* Multi-PC breakpoints are already resolved by GDB-6.8+. */
+
xfree (completion_name);
return counter;