MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_stop_at_pc

Function db_stop_at_pc

freebsd/ddb/db_run.c:96–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94#endif
95
96bool
97db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint)
98{
99 db_addr_t pc;
100 db_breakpoint_t bkpt;
101
102 *is_breakpoint = IS_BREAKPOINT_TRAP(type, code);
103 *is_watchpoint = IS_WATCHPOINT_TRAP(type, code);
104 pc = PC_REGS();
105 if (db_pc_is_singlestep(pc))
106 *is_breakpoint = false;
107
108 db_clear_single_step();
109 db_clear_breakpoints();
110 db_clear_watchpoints();
111
112#ifdef FIXUP_PC_AFTER_BREAK
113 if (*is_breakpoint) {
114 /*
115 * Breakpoint trap. Fix up the PC if the
116 * machine requires it.
117 */
118 FIXUP_PC_AFTER_BREAK
119 pc = PC_REGS();
120 }
121#endif
122
123 /*
124 * Now check for a breakpoint at this address.
125 */
126 bkpt = db_find_breakpoint_here(pc);
127 if (bkpt) {
128 if (--bkpt->count == 0) {
129 bkpt->count = bkpt->init_count;
130 *is_breakpoint = true;
131 return (true); /* stop here */
132 }
133 return (false); /* continue the countdown */
134 } else if (*is_breakpoint) {
135#ifdef BKPT_SKIP
136 BKPT_SKIP;
137#endif
138 }
139
140 *is_breakpoint = false; /* might be a breakpoint, but not ours */
141
142 /*
143 * If not stepping, then silently ignore single-step traps
144 * (except for clearing the single-step-flag above).
145 *
146 * If stepping, then abort if the trap type is unexpected.
147 * Breakpoints owned by us are expected and were handled above.
148 * Single-steps are expected and are handled below. All others
149 * are unexpected.
150 *
151 * Only do either of these if the MD layer claims to classify
152 * single-step traps unambiguously (by defining IS_SSTEP_TRAP).
153 * Otherwise, fall through to the bad historical behaviour

Callers 1

db_trapFunction · 0.85

Calls 9

db_pc_is_singlestepFunction · 0.85
db_clear_single_stepFunction · 0.85
db_clear_breakpointsFunction · 0.85
db_clear_watchpointsFunction · 0.85
db_find_breakpoint_hereFunction · 0.85
db_printfFunction · 0.85
db_print_loc_and_instFunction · 0.85
db_get_valueFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected