Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: delete_breakpoint: don't try to insert other breakpoints
Date: Wed, 14 Nov 2007 20:24:00 -0000	[thread overview]
Message-ID: <200711142324.11319.vladimir@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

 
The delete_breakpoint function tries to check if the
breakpoint being deleted is inserted in inferior, and if
so, searched for breakpoints that are set at the same address
and tries to insert them.  However, GDB removes breakpoint
from the inferior immediately when inferior is stopped,
so this code will never run.  Removing this code has
no effect on test results. 

(And generally, if that function needed to insert breakpoints,
it should have used insert_breakpoints, instead of duplicating
the logic somewhat).

OK?

- Volodya




[-- Attachment #2: dont_insert.diff --]
[-- Type: text/x-diff, Size: 3730 bytes --]

commit 85f4f28add9d57725aefed2b1ea01e45624d542a
Author: Vladimir Prus <vladimir@codesourcery.com>
Date:   Wed Nov 14 23:22:04 2007 +0300

    After deleting breakpoint, don't try to insert others.
    
    The delete_breakpoint function tries to check if the
    breakpoint being deleted is inserted in inferior, and if
    so, searched for breakpoints that are set at the same address
    and tries to insert them.  However, GDB removes breakpoint
    from the inferior immediately when inferior is stopped,
    so this code will never run.  Removing this code has
    no effect on test results.
    
          * breakpoint.c (delete_breakpoint): Don't try
          to insert other breakpoints at the same address.

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e81ec20..176b890 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7148,80 +7148,6 @@ delete_breakpoint (struct breakpoint *bpt)
 
   check_duplicates (bpt);
 
-  if (bpt->type != bp_hardware_watchpoint
-      && bpt->type != bp_read_watchpoint
-      && bpt->type != bp_access_watchpoint
-      && bpt->type != bp_catch_fork
-      && bpt->type != bp_catch_vfork
-      && bpt->type != bp_catch_exec)
-    for (loc = bpt->loc; loc; loc = loc->next)
-      {
-	/* If this breakpoint location was inserted, and there is 
-	   another breakpoint at the same address, we need to 
-	   insert the other breakpoint.  */
-	if (loc->inserted)
-	  {
-	    struct bp_location *loc2;
-	    ALL_BP_LOCATIONS (loc2)
-	      if (loc2->address == loc->address
-		  && loc2->section == loc->section
-		  && !loc->duplicate
-		  && loc2->owner->enable_state != bp_disabled
-		  && loc2->enabled 
-		  && !loc2->shlib_disabled
-		  && loc2->owner->enable_state != bp_call_disabled)
-		{
-		  int val;
-
-		  /* We should never reach this point if there is a permanent
-		     breakpoint at the same address as the one being deleted.
-		     If there is a permanent breakpoint somewhere, it should
-		     always be the only one inserted.  */
-		  if (loc2->owner->enable_state == bp_permanent)
-		    internal_error (__FILE__, __LINE__,
-				    _("another breakpoint was inserted on top of "
-				      "a permanent breakpoint"));
-
-		  memset (&loc2->target_info, 0, sizeof (loc2->target_info));
-		  loc2->target_info.placed_address = loc2->address;
-		  if (b->type == bp_hardware_breakpoint)
-		    val = target_insert_hw_breakpoint (&loc2->target_info);
-		  else
-		    val = target_insert_breakpoint (&loc2->target_info);
-
-		  /* If there was an error in the insert, print a message, then stop execution.  */
-		  if (val != 0)
-		    {
-		      struct ui_file *tmp_error_stream = mem_fileopen ();
-		      make_cleanup_ui_file_delete (tmp_error_stream);
-		      
-		      
-		      if (b->type == bp_hardware_breakpoint)
-			{
-			  fprintf_unfiltered (tmp_error_stream, 
-					      "Cannot insert hardware breakpoint %d.\n"
-					      "You may have requested too many hardware breakpoints.\n",
-					      b->number);
-			}
-		      else
-			{
-			  fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number);
-			  fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
-			  deprecated_print_address_numeric (loc2->address, 1, tmp_error_stream);
-			  fprintf_filtered (tmp_error_stream, ": %s.\n",
-					    safe_strerror (val));
-			}
-		      
-		      fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process.");
-		      target_terminal_ours_for_output ();
-		      error_stream(tmp_error_stream); 
-		    }
-		  else
-		    loc2->inserted = 1;
-		}
-	  }
-      }
-
   free_command_lines (&bpt->commands);
   if (bpt->cond_string != NULL)
     xfree (bpt->cond_string);

             reply	other threads:[~2007-11-14 20:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 20:24 Vladimir Prus [this message]
2007-11-15  4:04 ` Eli Zaretskii
2007-11-15  5:59   ` Vladimir Prus
2007-11-16 10:13     ` Eli Zaretskii
2007-11-16 10:34       ` Vladimir Prus
2007-11-16 11:15         ` Eli Zaretskii
2007-11-16 13:02           ` Daniel Jacobowitz
2007-11-16 14:14             ` Vladimir Prus
2007-11-16 15:09             ` Eli Zaretskii
2007-11-16 21:44               ` Nick Roberts
2007-11-16 22:24                 ` Vladimir Prus
2007-11-17  9:13                 ` Eli Zaretskii
2007-11-18  1:25                   ` Nick Roberts
2007-12-16 21:13 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711142324.11319.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox