Re: RFC: next/finish/etc -vs- exceptions

Joel Brobecker
2010-11-24T17:53:30Z

> I'd appreciate comments. I don't want to commit this without a review,
> as my experience is that I usually err when touching breakpoints or
> infrun.

Outch - no feedback as far as I can tell since the patch as posted
something like 6 weeks ago :-(. We are all so busy these days...
When that happens, I suggest we avoid being too conservative on the HEAD,
especially this far before the next branch creation. If you've already
had Pedro's comments and you think you addressed them, how about going
ahead? We can always revert later on...

> 2010-10-06 Tom Tromey <tromey@redhat.com>
>
> * infrun.c (handle_inferior_event): Handle exception breakpoints.
> (handle_inferior_event): Likewise.
> (insert_exception_resume_breakpoint): New function.
> (check_exception_resume): Likewise.
> * inferior.h (delete_longjmp_breakpoint_cleanup): Declare.
> * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static.
> (step_1): Set thread's initiating frame.
> (until_next_continuation): New function.
> (until_next_command): Support exception breakpoints.
> (finish_command_continuation): Delete longjmp breakpoint.
> (finish_forward): Support exception breakpoints.
> * gdbthread.h (struct thread_info) <initiating_frame>: New field.
> * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume,
> bp_exception_master>: New constants.
> (struct bpstat_what) <is_longjmp>: New field.
> * breakpoint.c (create_exception_master_breakpoint): New function.
> (update_breakpoints_after_exec): Handle bp_exception_master. Call
> create_exception_master_breakpoint.
> (print_it_typical): Handle bp_exception_master, bp_exception.
> (bpstat_stop_status): Handle bp_exception_master.
> (bpstat_what): Handle bp_exception_master, bp_exception,
> bp_exception_resume.
> (bptype_string): Likewise.
> (print_one_breakpoint_location): Likewise.
> (allocate_bp_location): Likewise.
> (set_longjmp_breakpoint): Handle exception breakpoints.
> (delete_longjmp_breakpoint): Likewise.
> (mention): Likewise.
> (struct until_break_command_continuation_args) <thread_num>: New
> field.
> (until_break_command_continuation): Call
> delete_longjmp_breakpoint.
> (until_break_command): Support exception breakpoints.
> (delete_command): Likewise.
> (breakpoint_re_set_one): Likewise.
> (breakpoint_re_set): Likewise.
>
> 2010-10-06 Tom Tromey <tromey@redhat.com>
>
> * gdb.java/jnpe.java: New file.
> * gdb.java/jnpe.exp: New file.
> * gdb.cp/gdb9593.exp: New file.
> * gdb.cp/gdb9593.cc: New file.

I started reviewing the patch, and quickly realized that this is
flying way over my head, and would require a significant amount
of time for me to really understand...

I did notice a couple of tiny details, though:

> + case bp_exception_master:
> + /* These should never be enabled. */
> + printf_filtered (_("Exception Master Breakpoint: gdb should not stop!\n"));
> + result = PRINT_NOTHING;
> + break;

I understand that an assert or internal-error would be unnecessarily
catastrophic for the user, but how about a warning instead? (just a
thought - this is really cosmetic)

> +
> + /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME. True if we are
> + handling a longjmp, false if we are handling an exception. */
> + int is_longjmp;

This component is also used with BPSTAT_WHAT_CLEAR_LONGJMP_RESUME.

Sorry for not being of any real help in this case...

--
Joel