From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30967 invoked by alias); 14 Nov 2007 20:24:27 -0000 Received: (qmail 30933 invoked by uid 22791); 14 Nov 2007 20:24:24 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Nov 2007 20:24:20 +0000 Received: (qmail 21680 invoked from network); 14 Nov 2007 20:24:17 -0000 Received: from unknown (HELO wind.local) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Nov 2007 20:24:17 -0000 From: Vladimir Prus 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 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_rl1OH5f06mxWdhS" Message-Id: <200711142324.11319.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00280.txt.bz2 --Boundary-00=_rl1OH5f06mxWdhS Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 537 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 --Boundary-00=_rl1OH5f06mxWdhS Content-Type: text/x-diff; charset="utf-8"; name="dont_insert.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dont_insert.diff" Content-length: 3730 commit 85f4f28add9d57725aefed2b1ea01e45624d542a Author: Vladimir Prus 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); --Boundary-00=_rl1OH5f06mxWdhS--