From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: next/finish/etc -vs- exceptions
Date: Thu, 25 Nov 2010 07:59:00 -0000 [thread overview]
Message-ID: <20101125075847.GA19270@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <m38w2a236l.fsf@fleche.redhat.com>
On Thu, 07 Oct 2010 03:37:38 +0200, Tom Tromey wrote:
> * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume,
> bp_exception_master>: New constants.
Therefore it is a precent new `bptype's are permitted instead of using
breakpoint_ops (which may need some extensions, not sure).
It may be explained also by the Joel's difficulties to do so:
http://sourceware.org/ml/gdb-patches/2009-06/msg00298.html
BTW the testcase does not work on neither ppc32 nor on ppc64. ppc32 due to
some unexpected next/step stop lines. I see two places in the code using
CORE_ADDR where is probably gdbarch_convert_from_func_ptr_addr appropriate for
the ppc64 case.
> @@ -8524,6 +8588,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
> frame_unwind_caller_id (frame),
> bp_until);
> make_cleanup_delete_breakpoint (breakpoint2);
> +
> + set_longjmp_breakpoint (thread);
> + tp->initiating_frame = frame_unwind_caller_id (frame);
tp->initiating_frame should be initialized from set_longjmp_breakpoint, as it
is required for that operation.
It probably should not be placed in TP. If we are stepping/until-ing/etc.
some code and execute some breakpoint's command list trying to step/next/etc.
again already from a different frame it won't work. But this is a problem for
most of the TP variables already so that's OK for this patch. It should be
carried over from the set-breakpoint to resume-breakpoint otherwise.
> +static void
> +until_next_continuation (void *arg)
> +{
> + struct thread_info *tp = arg;
Missing empty line. :-)
> + delete_longjmp_breakpoint (tp->num);
> +}
> @@ -1270,7 +1284,19 @@ until_next_command (int from_tty)
>
> tp->step_multi = 0; /* Only one call to proceed */
>
> + set_longjmp_breakpoint (thread);
> + tp->initiating_frame = get_frame_id (frame);
> + old_chain = make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
> +
> proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
> +
> + if (target_can_async_p () && is_running (inferior_ptid))
> + {
> + discard_cleanups (old_chain);
> + add_continuation (tp, until_next_continuation, tp, NULL);
continuation_free_args is NULL here but I think the breakpoint should get
deleted even if there is some premature thread deletion. But maybe just all
the breakpoints specific for that thread (clear_thread_inferior_resources)
should be deleted which would also solve this problem?
> +static void
> +insert_exception_resume_breakpoint (struct thread_info *tp,
> + struct block *b,
> + struct frame_info *frame,
> + struct symbol *sym)
> +{
> + struct gdb_exception e;
> +
> + /* We want to ignore errors here. */
> + TRY_CATCH (e, RETURN_MASK_ALL)
Shouldn't it be RETURN_MASK_ERROR then? Otherwise it should rethrow QUIT (I
hope it works that way) but no such cleanups are probably needed here.
> +static void
> +check_exception_resume (struct execution_control_state *ecs,
> + struct frame_info *frame, struct symbol *func)
> +{
> + struct gdb_exception e;
> +
> + TRY_CATCH (e, RETURN_MASK_ALL)
again RETURN_MASK_ERROR probably.
> diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
> new file mode 100644
> index 0000000..04e9c82
> --- /dev/null
> +++ b/gdb/testsuite/gdb.cp/gdb9593.exp
Please do not use numeric names for testcases. When dealing with them during
regression testing / rebasing etc. it makes more difficult to keep track of
all the numbers and what they were testing.
> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
> + untested gdb9593.exp
> + return -1
> +}
maybe prepare_for_testing?
(nitpick)
> +gdb_exit
> +gdb_start
> +gdb_reinitialize_dir $srcdir/$subdir
> +gdb_load ${binfile}
prepare_for_testing / clean_restart
(nitpick)
> +if {!$ok} {
> + untested gdb9593.exp
rather unsupported? Maybe not, just a hint.
> + return -1
> +}
> +
> +# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593
> +
> +gdb_test "next" \
> + ".*catch (...).*" \
> + "next over a throw 1"
These all have redundant leading `.*'. `(...)' is not backslashed.
> --- /dev/null
> +++ b/gdb/testsuite/gdb.java/jnpe.exp
[...]
> +set testfile "jnpe"
> +set srcfile ${testfile}.java
> +set binfile ${objdir}/${subdir}/${testfile}
> +if { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } {
> + untested "Couldn't compile ${srcdir}/$subdir/${srcfile}"
> + return -1
> +}
maybe prepare_for_testing?
(nitpick)
> +# The line where we stop differ according to gcj; check just we did not already
> +# execute the catch point.
> +
> +gdb_test "next" \
> + "" \
Here should be ".*" (such sanity checking is missing now in lib/gdb.exp).
> --- /dev/null
> +++ b/gdb/testsuite/gdb.java/jnpe.java
> @@ -0,0 +1,38 @@
> +// Test next-over-NPE.
> +/* This testcase is part of GDB, the GNU debugger.
> +
> + Copyright 2009 Free Software Foundation, Inc.
+2010
> + public static void main (String[] args)
> + {
> + try
> + {
> + System.out.println (npe ()); // break here
> + }
> + catch (NullPointerException n)
> + {
> + System.out.println ("success"); // catch point
BTW the testcase fives on Fedora 14 x86_64 and i686:
+FAIL: gdb.java/jnpe.exp: continue to breakpoint: catch point
but this is due to -O0 -g .debug_line wrong in this case.
Breakpoint for line 35 is at 0x400cb3:
0x0000000000400cb3 <+112>: mov $0x601560,%edi
0x0000000000400cb8 <+117>: callq 0x400a18 <_Jv_InitClass@plt>
0x0000000000400cbd <+122>: mov $0x1,%ebx
But the execution goes:
(gdb) stepi
0x0000000000400d0d 33 catch (NullPointerException n)
2: x/i $pc
=> 0x400d0d <jnpe.main(java.lang.String[])void+202>: mov (%rax),%rax
(gdb) stepi
35 System.out.println ("success"); // catch point
2: x/i $pc
=> 0x400d10 <jnpe.main(java.lang.String[])void+205>: test %bl,%bl
(gdb) stepi
0x0000000000400d12 35 System.out.println ("success"); // catch point
2: x/i $pc
=> 0x400d12 <jnpe.main(java.lang.String[])void+207>:
jne 0x400cbd <jnpe.main(java.lang.String[])void+122>
(gdb) stepi
0x0000000000400cbd 35 System.out.println ("success"); // catch point
2: x/i $pc
=> 0x400cbd <jnpe.main(java.lang.String[])void+122>: mov $0x1,%ebx
> + }
> + }
> +}
Thanks,
Jan
next prev parent reply other threads:[~2010-11-25 7:59 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 1:37 Tom Tromey
2010-11-24 17:53 ` Joel Brobecker
2010-11-24 18:24 ` Tom Tromey
2010-11-25 7:59 ` Jan Kratochvil [this message]
2010-11-27 17:25 ` Doug Evans
2010-11-28 8:29 ` Joel Brobecker
2010-11-30 16:43 ` Tom Tromey
2010-11-30 17:02 ` Jan Kratochvil
2010-11-30 17:15 ` Phil Muldoon
2010-11-30 20:15 ` Tom Tromey
2010-12-01 13:42 ` Jan Kratochvil
2010-12-01 21:40 ` Tom Tromey
2010-11-30 18:23 ` Tom Tromey
2010-11-30 18:55 ` Tom Tromey
2010-12-02 15:32 ` Tom Tromey
2010-12-09 16:37 ` Tom Tromey
2010-12-10 4:52 ` Jan Kratochvil
2010-12-10 20:07 ` Tom Tromey
2010-12-11 5:27 ` Jan Kratochvil
2010-12-15 21:18 ` Tom Tromey
-- strict thread matches above, loose matches on Subject: below --
2009-05-29 22:32 Tom Tromey
2009-05-30 21:08 ` Doug Evans
2009-05-30 23:18 ` Tom Tromey
2009-06-10 16:13 ` Joel Brobecker
2009-06-10 16:50 ` Tom Tromey
2009-06-10 17:05 ` Pedro Alves
2009-06-10 17:13 ` Daniel Jacobowitz
2009-06-10 17:47 ` Pedro Alves
2009-06-10 18:32 ` Tom Tromey
2009-06-10 18:49 ` Pedro Alves
2009-06-12 20:49 ` Tom Tromey
2009-06-12 21:51 ` Pedro Alves
2009-06-12 22:07 ` Pedro Alves
2010-11-25 4:54 ` Jan Kratochvil
2009-06-11 14:45 ` Joel Brobecker
2009-06-11 15:47 ` Tom Tromey
2009-07-24 17:38 ` Tom Tromey
2009-07-24 18:54 ` Pedro Alves
2009-07-24 19:18 ` Tom Tromey
2009-09-09 18:56 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101125075847.GA19270@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox