This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Support inferior events in python
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: sami wagiaalla <swagiaal at redhat dot com>, Jan Kratochvil <jan dot kratochvil at redhat dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Fri, 11 Feb 2011 15:56:41 +0000
- Subject: Re: [patch] Support inferior events in python
- References: <m37he0g95v.fsf@fleche.redhat.com> <20110209163022.GA16069@host1.dyn.jankratochvil.net> <4D55559B.1090004@redhat.com>
On Friday 11 February 2011 15:28:27, sami wagiaalla wrote:
> +# This file is part of the GDB testsuite. It tests Python-based
> +# pretty-printing for the CLI.
Is this really about pretty-printing?
> +
> +# Skip all tests if Python scripting is not enabled.
> +
> +if $tracelevel then {
> + strace $tracelevel
> +}
> +
> +load_lib gdb-python.exp
> +
> +set testfile "py-evthreads"
> +set srcfile ${testfile}.c
> +set binfile ${objdir}/${subdir}/${testfile}
> +set pyfile ${srcdir}/${subdir}/py-events.py
> +
> +gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}
You should check for the return here. Not all targets
have <pthread.h>.
> +clean_restart $testfile
> +
> +if { [skip_python_tests] } { continue }
> +
> +gdb_test_no_output "python execfile ('${pyfile}')" ""
> +
> +gdb_test "Test_Events" "Event testers registered."
> +gdb_test_no_output "set non-stop on"
> +gdb_test_no_output "set target-async on"
You're not checking if the target actually
supported async/non-stop when first running, which
means the following tests won't work on many targets.
Actually, do you really need non-stop?
> +
> +gdb_breakpoint [gdb_get_line_number "end of main"]
> +
> +send_gdb "run\n"
Do you really need literal "run" here? This doesn't
work against gdbserver + target remote.
> +gdb_expect {
> + -re ".*stop reason: signal.*
> +.*stop signal: SIGSEGV.*
> +.*thread num: 3.*" {
> + pass "thread 3 was signalled"
> + }
> + timeout {
> + fail "thread 3 was not signalled"
> + }
> +}
I wonder whether if you add an explicit -re for the
prompt, you'll be able to use gdb_test_multiple.
FYI, most tests that do non-stop are written in
MI so that the expected output is easier
to expect.
--
Pedro Alves