This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Support inferior events in python


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]