Lines Matching refs:bp
221 bp_size (struct raw_breakpoint *bp)
225 the_target->sw_breakpoint_from_kind (bp->kind, &size);
232 bp_opcode (struct raw_breakpoint *bp)
236 return the_target->sw_breakpoint_from_kind (bp->kind, &size);
306 struct breakpoint *bp;
309 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
311 if (is_gdb_breakpoint (bp->type))
313 struct gdb_breakpoint *gdb_bp = (struct gdb_breakpoint *) bp;
331 struct raw_breakpoint *bp;
333 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
334 if (bp->pc == addr
335 && bp->raw_type == type
336 && bp->inserted >= 0)
337 return bp;
349 struct raw_breakpoint *bp;
351 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
352 if (bp->pc == addr && bp->raw_type == type && bp->kind == kind)
353 return bp;
361 insert_memory_breakpoint (struct raw_breakpoint *bp)
369 err = read_inferior_memory (bp->pc, buf, bp_size (bp));
374 paddress (bp->pc), safe_strerror (err));
378 memcpy (bp->old_data, buf, bp_size (bp));
380 err = the_target->write_memory (bp->pc, bp_opcode (bp),
381 bp_size (bp));
384 paddress (bp->pc), safe_strerror (err));
392 remove_memory_breakpoint (struct raw_breakpoint *bp)
405 memcpy (buf, bp->old_data, bp_size (bp));
406 err = target_write_memory (bp->pc, buf, bp_size (bp));
410 paddress (bp->pc), safe_strerror (err));
424 struct raw_breakpoint *bp;
428 bp = find_enabled_raw_code_breakpoint_at (where, type);
429 if (bp != NULL && bp->kind != kind)
435 bp->kind, kind);
436 bp->inserted = -1;
437 bp = NULL;
441 bp = find_raw_breakpoint_at (where, type, kind);
444 if (bp == NULL)
447 bp = bp_holder.get ();
448 bp->pc = where;
449 bp->kind = kind;
450 bp->raw_type = type;
453 if (!bp->inserted)
455 *err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
464 bp->inserted = 1;
472 if (++bp->refcount == 1)
474 bp->next = proc->raw_breakpoints;
475 proc->raw_breakpoints = bp;
477 return bp;
552 struct fast_tracepoint_jump *bp, **bp_link;
556 bp = proc->fast_tracepoint_jumps;
559 while (bp)
561 if (bp == todel)
563 if (--bp->refcount == 0)
569 *bp_link = bp->next;
580 buf = (unsigned char *) alloca (bp->length);
581 memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length);
582 ret = target_write_memory (bp->pc, buf, bp->length);
591 paddress (bp->pc), safe_strerror (ret));
595 free (bp);
602 bp_link = &bp->next;
603 bp = *bp_link;
792 struct breakpoint *bp;
807 bp = (struct breakpoint *) gdb_bp;
815 bp = (struct breakpoint *) other_bp;
822 bp = (struct breakpoint *) ss_bp;
827 bp->type = type;
828 bp->raw = raw;
830 bp->next = proc->breakpoints;
831 proc->breakpoints = bp;
833 return bp;
863 struct raw_breakpoint *bp, **bp_link;
866 bp = proc->raw_breakpoints;
869 while (bp)
871 if (bp == todel)
873 if (bp->inserted > 0)
877 *bp_link = bp->next;
879 ret = the_target->remove_point (bp->raw_type, bp->pc,
880 bp->kind, bp);
888 paddress (bp->pc));
893 *bp_link = bp->next;
895 free (bp);
900 bp_link = &bp->next;
901 bp = *bp_link;
910 release_breakpoint (struct process_info *proc, struct breakpoint *bp)
915 newrefcount = bp->raw->refcount - 1;
918 ret = delete_raw_breakpoint (proc, bp->raw);
923 bp->raw->refcount = newrefcount;
925 free (bp);
933 struct breakpoint *bp, **bp_link;
936 bp = proc->breakpoints;
939 while (bp)
941 if (bp == todel)
943 *bp_link = bp->next;
945 err = release_breakpoint (proc, bp);
949 bp = *bp_link;
954 bp_link = &bp->next;
955 bp = *bp_link;
989 struct breakpoint *bp;
992 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
993 if (bp->type == type && bp->raw->pc == addr
994 && (kind == -1 || bp->raw->kind == kind))
995 return (struct gdb_breakpoint *) bp;
1015 struct gdb_breakpoint *bp;
1043 bp = find_gdb_breakpoint (z_type, addr, -1);
1045 if (bp != NULL)
1047 if (bp->base.raw->kind != kind)
1051 bp->base.raw->inserted = -1;
1052 delete_breakpoint ((struct breakpoint *) bp);
1053 bp = NULL;
1064 bp = find_gdb_breakpoint (z_type, addr, -1);
1073 bp = find_gdb_breakpoint (z_type, addr, kind);
1076 if (bp != NULL)
1083 return bp;
1103 gdb_breakpoint *bp = find_gdb_breakpoint (z_type, addr, kind);
1104 if (bp == NULL)
1109 clear_breakpoint_conditions_and_commands (bp);
1110 int err = delete_breakpoint ((struct breakpoint *) bp);
1120 clear_breakpoint_conditions (struct gdb_breakpoint *bp)
1124 if (bp->cond_list == NULL)
1127 cond = bp->cond_list;
1139 bp->cond_list = NULL;
1145 clear_breakpoint_commands (struct gdb_breakpoint *bp)
1149 if (bp->command_list == NULL)
1152 cmd = bp->command_list;
1164 bp->command_list = NULL;
1168 bp)
1170 clear_breakpoint_conditions (bp);
1171 clear_breakpoint_commands (bp);
1174 /* Add condition CONDITION to GDBserver's breakpoint BP. */
1177 add_condition_to_breakpoint (struct gdb_breakpoint *bp,
1187 new_cond->next = bp->cond_list;
1188 bp->cond_list = new_cond;
1194 add_breakpoint_condition (struct gdb_breakpoint *bp, const char **condition)
1202 if (bp == NULL)
1213 add_condition_to_breakpoint (bp, cond);
1220 /* Evaluate condition (if any) at breakpoint BP. Return 1 if
1227 struct gdb_breakpoint *bp = find_gdb_breakpoint (z_type, addr, -1);
1233 if (bp == NULL)
1238 if (bp->cond_list == NULL)
1250 for (cl = bp->cond_list;
1271 /* Add commands COMMANDS to GDBserver's breakpoint BP. */
1274 add_commands_to_breakpoint (struct gdb_breakpoint *bp,
1285 new_cmd->next = bp->command_list;
1286 bp->command_list = new_cmd;
1292 add_breakpoint_commands (struct gdb_breakpoint *bp, const char **command,
1301 if (bp == NULL)
1312 add_commands_to_breakpoint (bp, cmd, persist);
1325 struct gdb_breakpoint *bp = find_gdb_breakpoint (z_type, addr, -1);
1327 if (bp == NULL)
1330 threads_debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s",
1332 phex_nz ((uintptr_t) bp->command_list, 0));
1333 return (bp->command_list == NULL);
1354 struct gdb_breakpoint *bp = find_gdb_breakpoint (z_type, addr, -1);
1360 if (bp == NULL)
1367 for (cl = bp->command_list;
1403 struct single_step_breakpoint *bp;
1407 bp = (struct single_step_breakpoint *) set_breakpoint_type_at (single_step_breakpoint,
1409 bp->ptid = ptid;
1416 struct breakpoint *bp, **bp_link;
1418 bp = proc->breakpoints;
1421 while (bp)
1423 if (bp->type == single_step_breakpoint
1424 && ((struct single_step_breakpoint *) bp)->ptid == thread->id)
1429 *bp_link = bp->next;
1430 release_breakpoint (proc, bp);
1431 bp = *bp_link;
1435 bp_link = &bp->next;
1436 bp = *bp_link;
1442 uninsert_raw_breakpoint (struct raw_breakpoint *bp)
1444 if (bp->inserted < 0)
1447 paddress (bp->pc));
1449 else if (bp->inserted > 0)
1453 bp->inserted = 0;
1455 err = the_target->remove_point (bp->raw_type, bp->pc, bp->kind, bp);
1458 bp->inserted = 1;
1461 paddress (bp->pc));
1470 struct raw_breakpoint *bp;
1473 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1474 if ((bp->raw_type == raw_bkpt_type_sw
1475 || bp->raw_type == raw_bkpt_type_hw)
1476 && bp->pc == pc)
1480 if (bp->inserted)
1481 uninsert_raw_breakpoint (bp);
1498 struct raw_breakpoint *bp;
1500 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1501 if ((bp->raw_type == raw_bkpt_type_sw
1502 || bp->raw_type == raw_bkpt_type_hw)
1503 && bp->inserted)
1504 uninsert_raw_breakpoint (bp);
1511 struct breakpoint *bp;
1513 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
1515 if (bp->type == single_step_breakpoint
1516 && ((struct single_step_breakpoint *) bp)->ptid == thread->id)
1518 gdb_assert (bp->raw->inserted > 0);
1522 if (bp->raw->refcount == 1)
1527 uninsert_raw_breakpoint (bp->raw);
1534 reinsert_raw_breakpoint (struct raw_breakpoint *bp)
1538 if (bp->inserted)
1541 err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
1543 bp->inserted = 1;
1546 paddress (bp->pc), err);
1553 struct raw_breakpoint *bp;
1556 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1557 if ((bp->raw_type == raw_bkpt_type_sw
1558 || bp->raw_type == raw_bkpt_type_hw)
1559 && bp->pc == pc)
1563 reinsert_raw_breakpoint (bp);
1580 struct breakpoint *bp, **bp_link;
1582 bp = proc->breakpoints;
1585 while (bp)
1587 if (bp->type == single_step_breakpoint
1588 && ((struct single_step_breakpoint *) bp)->ptid == thread->id)
1592 bp_link = &bp->next;
1593 bp = *bp_link;
1604 struct raw_breakpoint *bp;
1606 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1607 if ((bp->raw_type == raw_bkpt_type_sw
1608 || bp->raw_type == raw_bkpt_type_hw)
1609 && !bp->inserted)
1610 reinsert_raw_breakpoint (bp);
1617 struct breakpoint *bp;
1619 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
1621 if (bp->type == single_step_breakpoint
1622 && ((struct single_step_breakpoint *) bp)->ptid == thread->id)
1624 gdb_assert (bp->raw->inserted > 0);
1626 if (bp->raw->refcount == 1)
1631 reinsert_raw_breakpoint (bp->raw);
1641 struct breakpoint *bp, **bp_link;
1643 bp = proc->breakpoints;
1646 while (bp)
1648 struct raw_breakpoint *raw = bp->raw;
1660 if (bp->type == other_breakpoint)
1663 = (struct other_breakpoint *) bp;
1667 *bp_link = bp->next;
1669 release_breakpoint (proc, bp);
1671 bp = *bp_link;
1677 bp_link = &bp->next;
1678 bp = *bp_link;
1686 struct raw_breakpoint *bp;
1688 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1689 if ((bp->raw_type == raw_bkpt_type_sw
1690 || bp->raw_type == raw_bkpt_type_hw)
1691 && bp->pc == addr)
1701 struct raw_breakpoint *bp;
1703 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1704 if ((bp->raw_type == raw_bkpt_type_sw
1705 || bp->raw_type == raw_bkpt_type_hw)
1706 && bp->pc == addr
1707 && bp->inserted)
1719 struct raw_breakpoint *bp;
1721 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1722 if (bp->raw_type == raw_bkpt_type_sw
1723 && bp->pc == addr
1724 && bp->inserted)
1736 struct raw_breakpoint *bp;
1738 for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
1739 if (bp->raw_type == raw_bkpt_type_hw
1740 && bp->pc == addr
1741 && bp->inserted)
1753 struct breakpoint *bp;
1755 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
1756 if (bp->type == single_step_breakpoint
1757 && bp->raw->pc == addr
1758 && bp->raw->inserted)
1765 validate_inserted_breakpoint (struct raw_breakpoint *bp)
1770 gdb_assert (bp->inserted);
1771 gdb_assert (bp->raw_type == raw_bkpt_type_sw);
1773 buf = (unsigned char *) alloca (bp_size (bp));
1774 err = the_target->read_memory (bp->pc, buf, bp_size (bp));
1775 if (err || memcmp (buf, bp_opcode (bp), bp_size (bp)) != 0)
1778 bp->inserted = -1;
1789 struct breakpoint *bp, *next;
1791 for (bp = proc->breakpoints; bp != NULL; bp = next)
1793 next = bp->next;
1794 if (bp->raw->inserted < 0)
1798 gdb_assert (bp->type != single_step_breakpoint);
1799 delete_breakpoint_1 (proc, bp);
1815 struct breakpoint *bp;
1817 for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
1819 struct raw_breakpoint *raw = bp->raw;
1832 struct raw_breakpoint *bp = proc->raw_breakpoints;
1869 for (; bp != NULL; bp = bp->next)
1871 CORE_ADDR bp_end = bp->pc + bp_size (bp);
1875 if (bp->raw_type != raw_bkpt_type_sw)
1878 gdb_assert (bp
1879 || buf >= &bp->old_data[sizeof (bp->old_data)]);
1883 if (bp->pc >= mem_end)
1886 start = bp->pc;
1895 copy_offset = start - bp->pc;
1898 if (bp->inserted > 0)
1900 if (validate_inserted_breakpoint (bp))
1901 memcpy (buf + buf_offset, bp->old_data + copy_offset, copy_len);
1916 struct raw_breakpoint *bp = proc->raw_breakpoints;
1958 for (; bp != NULL; bp = bp->next)
1960 CORE_ADDR bp_end = bp->pc + bp_size (bp);
1964 if (bp->raw_type != raw_bkpt_type_sw)
1967 gdb_assert (bp->old_data >= myaddr + mem_len
1968 || myaddr >= &bp->old_data[sizeof (bp->old_data)]);
1972 if (bp->pc >= mem_end)
1975 start = bp->pc;
1984 copy_offset = start - bp->pc;
1987 memcpy (bp->old_data + copy_offset, myaddr + buf_offset, copy_len);
1988 if (bp->inserted > 0)
1990 if (validate_inserted_breakpoint (bp))
1991 memcpy (buf + buf_offset, bp_opcode (bp) + copy_offset, copy_len);
2137 const struct breakpoint *bp;
2146 for (bp = parent_proc->breakpoints; bp != NULL; bp = bp->next)
2148 new_bkpt = clone_one_breakpoint (bp, child_thread->id);