Skip to content

Commit 048f6f6

Browse files
committed
when inserting checkpoints into the list, compare their start addresses (as intended). fixes bug #2122
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45813 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent fb33b9e commit 048f6f6

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

vice/src/monitor/mon_breakpoint.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
#include "monitor_binary.h"
4949
#endif
5050

51+
/*#define DEBUG_BREAKPOINTS*/
52+
53+
#ifdef DEBUG_BREAKPOINTS
54+
#define DBG(x) log_printf x
55+
#else
56+
#define DBG(x)
57+
#endif
58+
5159
struct checkpoint_list_s {
5260
mon_checkpoint_t *checkpt;
5361
struct checkpoint_list_s *next;
@@ -327,6 +335,19 @@ void mon_breakpoint_print_checkpoints(void)
327335
}
328336
}
329337

338+
#ifdef DEBUG_BREAKPOINTS
339+
/* show checkpoint list in the order it is in the list */
340+
static void dump_checkpoint_list(void)
341+
{
342+
checkpoint_list_t *ptr = all_checkpoints;
343+
mon_out("dump_checkpoint_list:\n");
344+
while (ptr) {
345+
print_checkpoint_info(ptr->checkpt);
346+
ptr = ptr->next;
347+
}
348+
}
349+
#endif
350+
330351
void mon_breakpoint_delete_checkpoint(int cp_num)
331352
{
332353
int i;
@@ -423,7 +444,7 @@ static int compare_checkpoints(mon_checkpoint_t *bp1, mon_checkpoint_t *bp2)
423444
*/
424445

425446
addr1 = addr_location(bp1->start_addr);
426-
addr2 = addr_location(bp2->end_addr);
447+
addr2 = addr_location(bp2->start_addr);
427448

428449
if (addr1 < addr2) {
429450
return -1;
@@ -516,7 +537,8 @@ bool mon_breakpoint_check_checkpoint(MEMSPACE mem, unsigned int addr, unsigned i
516537
while (ptr && mon_is_in_range(ptr->checkpt->start_addr, ptr->checkpt->end_addr, addr)) {
517538
cp = ptr->checkpt;
518539
ptr = ptr->next;
519-
if (cp && cp->enabled == e_ON) {
540+
if (cp && (cp->enabled == e_ON)) {
541+
520542
/* If condition test fails, skip this checkpoint */
521543
if (cp->condition) {
522544
if (!mon_evaluate_conditional(cp->condition)) {
@@ -612,11 +634,18 @@ static void add_to_checkpoint_list(checkpoint_list_t **head, mon_checkpoint_t *c
612634
if (!prev_entry) {
613635
*head = new_entry;
614636
new_entry->next = cur_entry;
637+
#ifdef DEBUG_BREAKPOINTS
638+
dump_checkpoint_list();
639+
#endif
615640
return;
616641
}
617642

618643
prev_entry->next = new_entry;
619644
new_entry->next = cur_entry;
645+
646+
#ifdef DEBUG_BREAKPOINTS
647+
dump_checkpoint_list();
648+
#endif
620649
}
621650

622651
static

0 commit comments

Comments
 (0)