2004-07-20 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 650ea2a108f25568d30c891c87bfa515b95bf04f..94665bcb46aec69b4487675631fe98d7f879d268 100644 (file)
@@ -627,7 +627,7 @@ commands_command (char *arg, int from_tty)
    shadow contents, not the breakpoints themselves.  From breakpoint.c.  */
 
 int
-read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
+deprecated_read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
 {
   int status;
   struct bp_location *b;
@@ -695,7 +695,7 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
       if (bp_addr > memaddr)
        {
          /* Copy the section of memory before the breakpoint.  */
-         status = read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
+         status = deprecated_read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
          if (status != 0)
            return status;
        }
@@ -703,7 +703,7 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
       if (bp_addr + bp_size < memaddr + len)
        {
          /* Copy the section of memory after the breakpoint.  */
-         status = read_memory_nobpt (bp_addr + bp_size,
+         status = deprecated_read_memory_nobpt (bp_addr + bp_size,
                                      myaddr + bp_addr + bp_size - memaddr,
                                      memaddr + len - (bp_addr + bp_size));
          if (status != 0)
@@ -1767,37 +1767,6 @@ software_breakpoint_inserted_here_p (CORE_ADDR pc)
   return 0;
 }
 
-/* Return nonzero if FRAME is a dummy frame.  We can't use
-   DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would
-   take too much time, at least using frame_register() on the 68k.
-   This means that for this function to work right a port must use the
-   bp_call_dummy breakpoint.  */
-
-int
-deprecated_frame_in_dummy (struct frame_info *frame)
-{
-  struct breakpoint *b;
-
-  /* This function is used by two files: get_frame_type(), after first
-     checking that !DEPRECATED_USE_GENERIC_DUMMY_FRAMES; and
-     sparc-tdep.c, which doesn't yet use generic dummy frames anyway.  */
-  gdb_assert (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
-
-  ALL_BREAKPOINTS (b)
-  {
-    if (b->type == bp_call_dummy
-       && frame_id_eq (b->frame_id, get_frame_id (frame))
-    /* We need to check the PC as well as the frame on the sparc,
-       for signals.exp in the testsuite.  */
-       && (get_frame_pc (frame)
-           >= (b->loc->address
-               - DEPRECATED_SIZEOF_CALL_DUMMY_WORDS / sizeof (LONGEST) * DEPRECATED_REGISTER_SIZE))
-       && get_frame_pc (frame) <= b->loc->address)
-      return 1;
-  }
-  return 0;
-}
-
 /* breakpoint_thread_match (PC, PTID) returns true if the breakpoint at
    PC is valid for process/thread PTID.  */
 
@@ -2590,7 +2559,9 @@ which its expression is valid.\n");
 }
 
 /* Get a bpstat associated with having just stopped at address
-   BP_ADDR.  */
+   BP_ADDR in thread PTID.  STOPPED_BY_WATCHPOINT is 1 if the
+   target thinks we stopped due to a hardware watchpoint, 0 if we
+   know we did not trigger a hardware watchpoint, and -1 if we do not know.  */
 
 /* Determine whether we stopped at a breakpoint, etc, or whether we
    don't understand this stop.  Result is a chain of bpstat's such that:
@@ -2607,7 +2578,7 @@ which its expression is valid.\n");
    commands, FIXME??? fields.  */
 
 bpstat
-bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid)
+bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
 {
   struct breakpoint *b, *temp;
   /* True if we've hit a breakpoint (as opposed to a watchpoint).  */
@@ -2623,15 +2594,10 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid)
     if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
       continue;
 
-    /* Hardware watchpoints are treated as non-existent if the reason we 
-       stopped wasn't a hardware watchpoint (we didn't stop on some data 
-       address).  Otherwise gdb won't stop on a break instruction in the code
-       (not from a breakpoint) when a hardware watchpoint has been defined.  */
     if (b->type != bp_watchpoint
-       && !((b->type == bp_hardware_watchpoint
-             || b->type == bp_read_watchpoint
-             || b->type == bp_access_watchpoint)
-            && target_stopped_data_address () != 0)
+       && b->type != bp_hardware_watchpoint
+       && b->type != bp_read_watchpoint
+       && b->type != bp_access_watchpoint
        && b->type != bp_hardware_breakpoint
        && b->type != bp_catch_fork
        && b->type != bp_catch_vfork
@@ -2647,6 +2613,18 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid)
          continue;
       }
 
+    /* Continuable hardware watchpoints are treated as non-existent if the 
+       reason we stopped wasn't a hardware watchpoint (we didn't stop on 
+       some data address).  Otherwise gdb won't stop on a break instruction 
+       in the code (not from a breakpoint) when a hardware watchpoint has 
+       been defined.  */
+
+    if ((b->type == bp_hardware_watchpoint
+        || b->type == bp_read_watchpoint
+        || b->type == bp_access_watchpoint)
+       && !stopped_by_watchpoint)
+      continue;
+
     if (b->type == bp_hardware_breakpoint)
       {
        if (b->loc->address != bp_addr)
@@ -4280,7 +4258,7 @@ create_thread_event_breakpoint (CORE_ADDR address)
   
   b->enable_state = bp_enabled;
   /* addr_string has to be used or breakpoint_re_set will delete me.  */
-  xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address));
+  b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
 
   return b;
 }
@@ -4924,7 +4902,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
        else
          /* addr_string has to be used or breakpoint_re_set will delete
             me.  */
-         xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address));
+         b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
        b->cond_string = cond_string[i];
        b->ignore_count = ignore_count;
        b->enable_state = bp_enabled;
@@ -5055,7 +5033,8 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
 
          Give the target a chance to bless sals.sals[i].pc before we
          try to make a breakpoint for it. */
-      if (PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
+#ifdef DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE
+      if (DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
        {
          if (address == NULL)
            error ("Cannot break without a running program.");
@@ -5063,6 +5042,7 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
            error ("Cannot break on %s without a running program.", 
                   address);
        }
+#endif
     }
 }
 
This page took 0.044616 seconds and 4 git commands to generate.