@@ -80,29 +80,26 @@ CodeElem CodeViewer::LookUp(uint8_t seg, uint16_t offset, int *idx) {
80
80
81
81
/* *
82
82
* called before the instruction is executed (for breakpoints/step, in CPU.cpp) or
83
- * right after a POP PC is executed (for RET TRACE, in CPUPushPop.cpp)
83
+ * right after a POP PC is executed (for TRACE, in CPUPushPop.cpp)
84
84
*/
85
85
bool CodeViewer::TryTrigBP (uint8_t seg, uint16_t offset, bool bp_mode) {
86
86
for (auto it = break_points.begin (); it != break_points.end (); it++) {
87
87
if (it->second == 1 ) {
88
- // TODO: We ignore a second trigger
89
88
CodeElem e = codes[it->first ];
90
89
if (e.segment == seg && e.offset == offset) {
91
- break_points[it->first ] = 2 ;
92
90
cur_row = it->first ;
93
- need_roll = true ;
94
91
bp = it->first ;
92
+ need_roll = true ;
95
93
return true ;
96
94
}
97
95
}
98
96
}
99
97
if (!bp_mode && (debug_flags & DEBUG_STEP || debug_flags & DEBUG_RET_TRACE)) { // pause for step/trace
100
98
int idx = 0 ;
101
99
LookUp (seg, offset, &idx);
102
- break_points[idx] = 2 ;
103
100
cur_row = idx;
104
- need_roll = true ;
105
101
bp = idx;
102
+ need_roll = true ;
106
103
return true ;
107
104
}
108
105
return false ;
@@ -113,21 +110,22 @@ void CodeViewer::DrawContent() {
113
110
c.Begin (max_row, ImGui::GetTextLineHeight ());
114
111
while (c.Step ()) {
115
112
for (int line_i = c.DisplayStart ; line_i < c.DisplayEnd ; line_i++) {
113
+ if (line_i == bp) {
114
+ // the break point is triggered!
115
+ ImGui::TextColored (ImVec4 (0.0 , 1.0 , 0.0 , 1.0 ), " [ > ]" );
116
+ }
116
117
CodeElem e = codes[line_i];
117
118
auto it = break_points.find (line_i);
118
- if (it == break_points.end ()) {
119
+ if (it == break_points.end () || !break_points[line_i] ) {
119
120
ImGui::Text (" [ o ]" );
120
121
if (ImGui::IsItemHovered () && ImGui::IsMouseClicked (0 )) {
121
122
break_points[line_i] = 1 ;
122
123
}
123
- } else if (it-> second == 1 ) {
124
+ } else {
124
125
ImGui::TextColored (ImVec4 (1.0 , 0.0 , 0.0 , 1.0 ), " [ x ]" );
125
126
if (ImGui::IsItemHovered () && ImGui::IsMouseClicked (0 )) {
126
- break_points. erase ( line_i) ;
127
+ break_points[ line_i] = 0 ;
127
128
}
128
- } else { // it->second == 2
129
- // the break point is triggered!
130
- ImGui::TextColored (ImVec4 (0.0 , 1.0 , 0.0 , 1.0 ), " [ > ]" );
131
129
}
132
130
ImGui::SameLine ();
133
131
ImGui::TextColored (ImVec4 (1.0 , 1.0 , 0.0 , 1.0 ), " %d:%04x" , e.segment , e.offset );
@@ -218,8 +216,9 @@ void CodeViewer::DrawWindow() {
218
216
ImGui::Checkbox (" TRACE" , &trace_debug);
219
217
if (bp != -1 ) {
220
218
ImGui::SameLine ();
221
- if (ImGui::Button (" Continue?" )) {
222
- break_points.erase (bp);
219
+ if (ImGui::Button (" Continue" )) {
220
+ if (!step_debug && !trace_debug)
221
+ break_points[bp] = 0 ;
223
222
m_emu->SetPaused (false );
224
223
bp = -1 ;
225
224
}
0 commit comments