This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't give spurious warnings when using thread specific breakpoints


When creating a thread specific breakpoint GDB will warn about other breakpoints set on the same address even when they are specific to another thread.

The attached patch prevents it warning about breakpoints from other threads. When a non-thread specific breakpoint is created, or already exists, the warning is still given, but is annotated with the thread information. When not using thread specific breakpoints the behaviour should remain unaltered.

:ADDPATCH breakpoint.c:

Andrew Stubbs
2006-10-11  Andrew Stubbs  <andrew.stubbs@st.com>

	* breakpoint.c (describe_other_breakpoints): Add thread parameter.
	Only display breakpoints set on the same thread or globally.
	Annotate display with thread number where appropriate.

Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c	2006-10-11 14:23:37.000000000 +0100
+++ src/gdb/breakpoint.c	2006-10-11 14:29:25.000000000 +0100
@@ -102,7 +102,7 @@ static void breakpoint_adjustment_warnin
 static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr,
                                             enum bptype bptype);
 
-static void describe_other_breakpoints (CORE_ADDR, asection *);
+static void describe_other_breakpoints (CORE_ADDR, asection *, int thread);
 
 static void breakpoints_info (char *, int);
 
@@ -3781,13 +3781,14 @@ maintenance_info_breakpoints (char *bnum
 /* Print a message describing any breakpoints set at PC.  */
 
 static void
-describe_other_breakpoints (CORE_ADDR pc, asection *section)
+describe_other_breakpoints (CORE_ADDR pc, asection *section, int thread)
 {
   int others = 0;
   struct breakpoint *b;
 
   ALL_BREAKPOINTS (b)
-    if (b->loc->address == pc)	/* address match / overlay match */
+    if (b->loc->address == pc	/* address match / overlay match */
+	&& (thread == -1 || b->thread == -1 || b->thread == thread))
       if (!b->pending && (!overlay_debugging || b->loc->section == section))
 	others++;
   if (others > 0)
@@ -3797,12 +3798,17 @@ describe_other_breakpoints (CORE_ADDR pc
       else /* if (others == ???) */
 	printf_filtered (_("Note: breakpoints "));
       ALL_BREAKPOINTS (b)
-	if (b->loc->address == pc)	/* address match / overlay match */
+	if (b->loc->address == pc	/* address match / overlay match */
+	    && (thread == -1 || b->thread == -1 || b->thread == thread))
 	  if (!b->pending && (!overlay_debugging || b->loc->section == section))
 	    {
 	      others--;
-	      printf_filtered ("%d%s%s ",
-			       b->number,
+	      printf_filtered ("%d", b->number);
+	      if (b->thread == -1 && thread != -1)
+		printf_filtered (" (all threads)");
+	      else if (b->thread != -1)
+		printf_filtered (" (thread %d)", b->thread);
+	      printf_filtered ("%s%s ",
 			       ((b->enable_state == bp_disabled || 
 				 b->enable_state == bp_shlib_disabled || 
 				 b->enable_state == bp_call_disabled) 
@@ -4959,7 +4965,7 @@ create_breakpoints (struct symtabs_and_l
 	struct symtab_and_line sal = sals.sals[i];
 
 	if (from_tty)
-	  describe_other_breakpoints (sal.pc, sal.section);
+	  describe_other_breakpoints (sal.pc, sal.section, thread);
 	
 	b = set_raw_breakpoint (sal, type);
 	set_breakpoint_count (breakpoint_count + 1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]