public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [next-over-throw2] exception_resume_breakpoint comments
@ 2010-04-29 16:47 Jan Kratochvil
  2010-04-30 16:08 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2010-04-29 16:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: archer

Hi,

on this branch I have just seen suspicious:

static void
insert_exception_resume_breakpoint (struct thread_info *tp,
                                    struct block *b,
                                    struct frame_info *frame,
                                    struct symbol *sym)
- does not use TP at all.

Then clear_thread_inferior_resources now clears tp->step_resume_breakpoint.
To make tp->exception_resume_breakpoint on par with existing
tp->step_resume_breakpoint IMO clear_thread_inferior_resources should clear
even tp->exception_resume_breakpoint.

Unrelated bug is that both these breakpoints should be set as thread-specific.
Another unrelated bug is that on a thread exit thread-specific breakpoints are
not deleted (one may ask if they should be deleted, though).  Fix of these two
bugs would simplify clear_thread_inferior_resources to remove even the
tp->step_resume_breakpoint handling from there.


To get back in the scope of this specific patch I would just implement:

# To make tp->exception_resume_breakpoint on par with existing
# tp->step_resume_breakpoint IMO clear_thread_inferior_resources should clear
# even tp->exception_resume_breakpoint.


Thanks,
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [next-over-throw2] exception_resume_breakpoint comments
  2010-04-29 16:47 [next-over-throw2] exception_resume_breakpoint comments Jan Kratochvil
@ 2010-04-30 16:08 ` Tom Tromey
  2010-05-04 19:46   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2010-04-30 16:08 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: archer

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> - does not use TP at all.

Thanks, I fixed this.
It does need to use TP to make the exception-resume breakpoint
thread-specific.

Jan> Then clear_thread_inferior_resources now clears
Jan> tp->step_resume_breakpoint.  To make
Jan> tp->exception_resume_breakpoint on par with existing tp->
Jan> step_resume_breakpoint IMO clear_thread_inferior_resources should
Jan> clear even tp->exception_resume_breakpoint.

I did this too.

Jan> Unrelated bug is that both these breakpoints should be set as
Jan> thread-specific.

I think the bp_exception breakpoint is already thread-specific, see
breakpoint.c:set_longjmp_breakpoint.  When we clone the exception master
breakpoint we also set its thread.

The `TP' part of the new patch fixes the breakpoint we set to resume the
exception.

Jan> Another unrelated bug is that on a thread exit thread-specific
Jan> breakpoints are not deleted (one may ask if they should be deleted,
Jan> though).

I'm not going to touch this in the general case.  Maybe it is worth a
bug report though.

Here's what I plan to commit.  I'm going to run it through the tester as
well, just for a little safety.

Tom

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 3546cf1..40a1211 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4946,6 +4946,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 
 	  bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
 					       handler, bp_exception_resume);
+	  bp->thread = tp->num;
 	  inferior_thread ()->exception_resume_breakpoint = bp;
 	}
     }
diff --git a/gdb/thread.c b/gdb/thread.c
index 3c52ae4..eb0ef8f 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -113,6 +113,12 @@ clear_thread_inferior_resources (struct thread_info *tp)
       tp->step_resume_breakpoint = NULL;
     }
 
+  if (tp->exception_resume_breakpoint)
+    {
+      tp->exception_resume_breakpoint->disposition = disp_del_at_next_stop;
+      tp->exception_resume_breakpoint = NULL;
+    }
+
   bpstat_clear (&tp->stop_bpstat);
 
   discard_all_intermediate_continuations_thread (tp);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [next-over-throw2] exception_resume_breakpoint comments
  2010-04-30 16:08 ` Tom Tromey
@ 2010-05-04 19:46   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2010-05-04 19:46 UTC (permalink / raw)
  To: Tom Tromey; +Cc: archer

On Fri, 30 Apr 2010 18:07:51 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Jan> Another unrelated bug is that on a thread exit thread-specific
> Jan> breakpoints are not deleted (one may ask if they should be deleted,
> Jan> though).
> 
> I'm not going to touch this in the general case.  Maybe it is worth a
> bug report though.

Filed as GDB PR 11568.


Thanks,
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-04 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-29 16:47 [next-over-throw2] exception_resume_breakpoint comments Jan Kratochvil
2010-04-30 16:08 ` Tom Tromey
2010-05-04 19:46   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).