|
48 | 48 | #include "monitor_binary.h" |
49 | 49 | #endif |
50 | 50 |
|
| 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 | + |
51 | 59 | struct checkpoint_list_s { |
52 | 60 | mon_checkpoint_t *checkpt; |
53 | 61 | struct checkpoint_list_s *next; |
@@ -327,6 +335,19 @@ void mon_breakpoint_print_checkpoints(void) |
327 | 335 | } |
328 | 336 | } |
329 | 337 |
|
| 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 | + |
330 | 351 | void mon_breakpoint_delete_checkpoint(int cp_num) |
331 | 352 | { |
332 | 353 | int i; |
@@ -423,7 +444,7 @@ static int compare_checkpoints(mon_checkpoint_t *bp1, mon_checkpoint_t *bp2) |
423 | 444 | */ |
424 | 445 |
|
425 | 446 | addr1 = addr_location(bp1->start_addr); |
426 | | - addr2 = addr_location(bp2->end_addr); |
| 447 | + addr2 = addr_location(bp2->start_addr); |
427 | 448 |
|
428 | 449 | if (addr1 < addr2) { |
429 | 450 | return -1; |
@@ -516,7 +537,8 @@ bool mon_breakpoint_check_checkpoint(MEMSPACE mem, unsigned int addr, unsigned i |
516 | 537 | while (ptr && mon_is_in_range(ptr->checkpt->start_addr, ptr->checkpt->end_addr, addr)) { |
517 | 538 | cp = ptr->checkpt; |
518 | 539 | ptr = ptr->next; |
519 | | - if (cp && cp->enabled == e_ON) { |
| 540 | + if (cp && (cp->enabled == e_ON)) { |
| 541 | + |
520 | 542 | /* If condition test fails, skip this checkpoint */ |
521 | 543 | if (cp->condition) { |
522 | 544 | if (!mon_evaluate_conditional(cp->condition)) { |
@@ -612,11 +634,18 @@ static void add_to_checkpoint_list(checkpoint_list_t **head, mon_checkpoint_t *c |
612 | 634 | if (!prev_entry) { |
613 | 635 | *head = new_entry; |
614 | 636 | new_entry->next = cur_entry; |
| 637 | +#ifdef DEBUG_BREAKPOINTS |
| 638 | + dump_checkpoint_list(); |
| 639 | +#endif |
615 | 640 | return; |
616 | 641 | } |
617 | 642 |
|
618 | 643 | prev_entry->next = new_entry; |
619 | 644 | new_entry->next = cur_entry; |
| 645 | + |
| 646 | +#ifdef DEBUG_BREAKPOINTS |
| 647 | + dump_checkpoint_list(); |
| 648 | +#endif |
620 | 649 | } |
621 | 650 |
|
622 | 651 | static |
|
0 commit comments