This is the mail archive of the gdb-patches@sources.redhat.com 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]

PATCH: simplify calls to check_duplicates



I've applied this patch.  This change should have no effect on the
behavior of GDB, but it's preparation for another fix coming up.

2001-05-05  Jim Blandy  <jimb@redhat.com>

	* breakpoint.c (check_duplicates): Take a breakpoint object as an
	argument, rather than an address and section.  All callers changed.

Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/breakpoint.c,v
retrieving revision 1.307
diff -c -r1.307 breakpoint.c
*** gdb/breakpoint.c	2001/03/26 19:53:50	1.307
--- gdb/breakpoint.c	2001/05/06 00:21:22
***************
*** 95,101 ****
  
  struct breakpoint *set_raw_breakpoint (struct symtab_and_line);
  
! static void check_duplicates (CORE_ADDR, asection *);
  
  static void describe_other_breakpoints (CORE_ADDR, asection *);
  
--- 95,101 ----
  
  struct breakpoint *set_raw_breakpoint (struct symtab_and_line);
  
! static void check_duplicates (struct breakpoint *);
  
  static void describe_other_breakpoints (CORE_ADDR, asection *);
  
***************
*** 3704,3721 ****
    default_breakpoint_line = line;
  }
  
! /* Rescan breakpoints at address ADDRESS,
     marking the first one as "first" and any others as "duplicates".
     This is so that the bpt instruction is only inserted once.
!    If we have a permanent breakpoint at ADDRESS, make that one
!    the official one, and the rest as duplicates.  */
  
  static void
! check_duplicates (CORE_ADDR address, asection *section)
  {
    register struct breakpoint *b;
    register int count = 0;
    struct breakpoint *perm_bp = 0;
  
    if (address == 0)		/* Watchpoints are uninteresting */
      return;
--- 3704,3723 ----
    default_breakpoint_line = line;
  }
  
! /* Rescan breakpoints at the same address and section as BPT,
     marking the first one as "first" and any others as "duplicates".
     This is so that the bpt instruction is only inserted once.
!    If we have a permanent breakpoint at the same place as BPT, make
!    that one the official one, and the rest as duplicates.  */
  
  static void
! check_duplicates (struct breakpoint *bpt)
  {
    register struct breakpoint *b;
    register int count = 0;
    struct breakpoint *perm_bp = 0;
+   CORE_ADDR address = bpt->address;
+   asection *section = bpt->section;
  
    if (address == 0)		/* Watchpoints are uninteresting */
      return;
***************
*** 3822,3828 ****
        b1->next = b;
      }
  
!   check_duplicates (sal.pc, sal.section);
    breakpoints_changed ();
  
    return b;
--- 3824,3830 ----
        b1->next = b;
      }
  
!   check_duplicates (b);
    breakpoints_changed ();
  
    return b;
***************
*** 3889,3895 ****
      if (b->type == bp_longjmp)
      {
        b->enable = enabled;
!       check_duplicates (b->address, b->section);
      }
  }
  
--- 3891,3897 ----
      if (b->type == bp_longjmp)
      {
        b->enable = enabled;
!       check_duplicates (b);
      }
  }
  
***************
*** 3903,3909 ****
  	|| b->type == bp_longjmp_resume)
      {
        b->enable = disabled;
!       check_duplicates (b->address, b->section);
      }
  }
  
--- 3905,3911 ----
  	|| b->type == bp_longjmp_resume)
      {
        b->enable = disabled;
!       check_duplicates (b);
      }
  }
  
***************
*** 4246,4252 ****
  	b->frame = frame->frame;
        else
  	b->frame = 0;
!       check_duplicates (b->address, b->section);
        return;
      }
  }
--- 4248,4254 ----
  	b->frame = frame->frame;
        else
  	b->frame = 0;
!       check_duplicates (b);
        return;
      }
  }
***************
*** 4266,4272 ****
  	&& (b->enable == enabled))
        {
  	b->enable = call_disabled;
! 	check_duplicates (b->address, b->section);
        }
    }
  }
--- 4268,4274 ----
  	&& (b->enable == enabled))
        {
  	b->enable = call_disabled;
! 	check_duplicates (b);
        }
    }
  }
***************
*** 4286,4292 ****
  	&& (b->enable == call_disabled))
        {
  	b->enable = enabled;
! 	check_duplicates (b->address, b->section);
        }
    }
  }
--- 4288,4294 ----
  	&& (b->enable == call_disabled))
        {
  	b->enable = enabled;
! 	check_duplicates (b);
        }
    }
  }
***************
*** 6755,6761 ****
  	}
      }
  
!   check_duplicates (bpt->address, bpt->section);
    /* If this breakpoint was inserted, and there is another breakpoint
       at the same address, we need to insert the other breakpoint.  */
    if (bpt->inserted
--- 6757,6763 ----
  	}
      }
  
!   check_duplicates (bpt);
    /* If this breakpoint was inserted, and there is another breakpoint
       at the same address, we need to insert the other breakpoint.  */
    if (bpt->inserted
***************
*** 6998,7004 ****
  
  	  /* Now that this is re-enabled, check_duplicates
  	     can be used. */
! 	  check_duplicates (b->address, b->section);
  
  	}
        xfree (sals.sals);
--- 7000,7006 ----
  
  	  /* Now that this is re-enabled, check_duplicates
  	     can be used. */
! 	  check_duplicates (b);
  
  	}
        xfree (sals.sals);
***************
*** 7263,7269 ****
  
    bpt->enable = disabled;
  
!   check_duplicates (bpt->address, bpt->section);
  
    if (modify_breakpoint_hook)
      modify_breakpoint_hook (bpt);
--- 7265,7271 ----
  
    bpt->enable = disabled;
  
!   check_duplicates (bpt);
  
    if (modify_breakpoint_hook)
      modify_breakpoint_hook (bpt);
***************
*** 7328,7334 ****
    if (bpt->enable != permanent)
      bpt->enable = enabled;
    bpt->disposition = disposition;
!   check_duplicates (bpt->address, bpt->section);
    breakpoints_changed ();
  
    if (bpt->type == bp_watchpoint || 
--- 7330,7336 ----
    if (bpt->enable != permanent)
      bpt->enable = enabled;
    bpt->disposition = disposition;
!   check_duplicates (bpt);
    breakpoints_changed ();
  
    if (bpt->type == bp_watchpoint || 


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