@@ -611,15 +611,6 @@ static int overlay_events_enabled;
611
611
/* See description in breakpoint.h. */
612
612
bool target_exact_watchpoints = false;
613
613
614
- /* Walk the following statement or block through all breakpoints.
615
- ALL_BREAKPOINTS_SAFE does so even if the statement deletes the
616
- current breakpoint. */
617
-
618
- #define ALL_BREAKPOINTS_SAFE (B ,TMP ) \
619
- for (B = breakpoint_chain; \
620
- B ? (TMP=B->next, 1): 0; \
621
- B = TMP)
622
-
623
614
/* Chains of all breakpoints defined. */
624
615
625
616
static struct breakpoint * breakpoint_chain ;
@@ -7617,72 +7608,73 @@ set_longjmp_breakpoint_for_call_dummy (void)
7617
7608
void
7618
7609
check_longjmp_breakpoint_for_call_dummy (struct thread_info * tp )
7619
7610
{
7620
- struct breakpoint * b , * b_tmp ;
7611
+ for (struct breakpoint * b : all_breakpoints_safe ())
7612
+ {
7613
+ struct breakpoint * b_tmp = b -> next ;
7614
+ if (b -> type == bp_longjmp_call_dummy && b -> thread == tp -> global_num )
7615
+ {
7616
+ struct breakpoint * dummy_b = b -> related_breakpoint ;
7621
7617
7622
- ALL_BREAKPOINTS_SAFE (b , b_tmp )
7623
- if (b -> type == bp_longjmp_call_dummy && b -> thread == tp -> global_num )
7624
- {
7625
- struct breakpoint * dummy_b = b -> related_breakpoint ;
7626
-
7627
- /* Find the bp_call_dummy breakpoint in the list of breakpoints
7628
- chained off b->related_breakpoint. */
7629
- while (dummy_b != b && dummy_b -> type != bp_call_dummy )
7630
- dummy_b = dummy_b -> related_breakpoint ;
7631
-
7632
- /* If there was no bp_call_dummy breakpoint then there's nothing
7633
- more to do. Or, if the dummy frame associated with the
7634
- bp_call_dummy is still on the stack then we need to leave this
7635
- bp_call_dummy in place. */
7636
- if (dummy_b -> type != bp_call_dummy
7637
- || frame_find_by_id (dummy_b -> frame_id ) != NULL )
7638
- continue ;
7618
+ /* Find the bp_call_dummy breakpoint in the list of breakpoints
7619
+ chained off b->related_breakpoint. */
7620
+ while (dummy_b != b && dummy_b -> type != bp_call_dummy )
7621
+ dummy_b = dummy_b -> related_breakpoint ;
7639
7622
7640
- /* We didn't find the dummy frame on the stack, this could be
7641
- because we have longjmp'd to a stack frame that is previous to
7642
- the dummy frame, or it could be because the stack unwind is
7643
- broken at some point between the longjmp frame and the dummy
7644
- frame.
7645
-
7646
- Next we figure out why the stack unwind stopped. If it looks
7647
- like the unwind is complete then we assume the dummy frame has
7648
- been jumped over, however, if the unwind stopped for an
7649
- unexpected reason then we assume the stack unwind is currently
7650
- broken, and that we will (eventually) return to the dummy
7651
- frame.
7652
-
7653
- It might be tempting to consider using frame_id_inner here, but
7654
- that is not safe. There is no guarantee that the stack frames
7655
- we are looking at here are even on the same stack as the
7656
- original dummy frame, hence frame_id_inner can't be used. See
7657
- the comments on frame_id_inner for more details. */
7658
- bool unwind_finished_unexpectedly = false;
7659
- for (frame_info_ptr fi = get_current_frame (); fi != nullptr ; )
7660
- {
7661
- frame_info_ptr prev = get_prev_frame (fi );
7662
- if (prev == nullptr )
7663
- {
7664
- /* FI is the last stack frame. Why did this frame not
7665
- unwind further? */
7666
- auto stop_reason = get_frame_unwind_stop_reason (fi );
7667
- if (stop_reason != UNWIND_NO_REASON
7668
- && stop_reason != UNWIND_OUTERMOST )
7669
- unwind_finished_unexpectedly = true;
7670
- }
7671
- fi = prev ;
7672
- }
7673
- if (unwind_finished_unexpectedly )
7674
- continue ;
7623
+ /* If there was no bp_call_dummy breakpoint then there's nothing
7624
+ more to do. Or, if the dummy frame associated with the
7625
+ bp_call_dummy is still on the stack then we need to leave this
7626
+ bp_call_dummy in place. */
7627
+ if (dummy_b -> type != bp_call_dummy
7628
+ || frame_find_by_id (dummy_b -> frame_id ) != NULL )
7629
+ continue ;
7675
7630
7676
- dummy_frame_discard (dummy_b -> frame_id , tp );
7631
+ /* We didn't find the dummy frame on the stack, this could be
7632
+ because we have longjmp'd to a stack frame that is previous to
7633
+ the dummy frame, or it could be because the stack unwind is
7634
+ broken at some point between the longjmp frame and the dummy
7635
+ frame.
7636
+
7637
+ Next we figure out why the stack unwind stopped. If it looks
7638
+ like the unwind is complete then we assume the dummy frame has
7639
+ been jumped over, however, if the unwind stopped for an
7640
+ unexpected reason then we assume the stack unwind is currently
7641
+ broken, and that we will (eventually) return to the dummy
7642
+ frame.
7643
+
7644
+ It might be tempting to consider using frame_id_inner here, but
7645
+ that is not safe. There is no guarantee that the stack frames
7646
+ we are looking at here are even on the same stack as the
7647
+ original dummy frame, hence frame_id_inner can't be used. See
7648
+ the comments on frame_id_inner for more details. */
7649
+ bool unwind_finished_unexpectedly = false;
7650
+ for (frame_info_ptr fi = get_current_frame (); fi != nullptr ; )
7651
+ {
7652
+ frame_info_ptr prev = get_prev_frame (fi );
7653
+ if (prev == nullptr )
7654
+ {
7655
+ /* FI is the last stack frame. Why did this frame not
7656
+ unwind further? */
7657
+ auto stop_reason = get_frame_unwind_stop_reason (fi );
7658
+ if (stop_reason != UNWIND_NO_REASON
7659
+ && stop_reason != UNWIND_OUTERMOST )
7660
+ unwind_finished_unexpectedly = true;
7661
+ }
7662
+ fi = prev ;
7663
+ }
7664
+ if (unwind_finished_unexpectedly )
7665
+ continue ;
7677
7666
7678
- while (b -> related_breakpoint != b )
7679
- {
7680
- if (b_tmp == b -> related_breakpoint )
7681
- b_tmp = b -> related_breakpoint -> next ;
7682
- delete_breakpoint (b -> related_breakpoint );
7683
- }
7684
- delete_breakpoint (b );
7685
- }
7667
+ dummy_frame_discard (dummy_b -> frame_id , tp );
7668
+
7669
+ while (b -> related_breakpoint != b )
7670
+ {
7671
+ if (b_tmp == b -> related_breakpoint )
7672
+ b_tmp = b -> related_breakpoint -> next ;
7673
+ delete_breakpoint (b -> related_breakpoint );
7674
+ }
7675
+ delete_breakpoint (b );
7676
+ }
7677
+ }
7686
7678
}
7687
7679
7688
7680
void
0 commit comments