Re: [PATCH 1/3] New test case for PR12929.

Tom Tromey
2013-07-30T19:49:22Z

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> * gdb.python/py-sync-interp.c: New.
Yao> * gdb.python/py-sync-interp.exp: New.

Yao> +# This test case is copied from PR14135.
Yao> +# http://sourceware.org/bugzilla/show_bug.cgi?id=14135
Yao> +
Yao> +set testfile "py-sync-interp"
Yao> +set srcfile ${testfile}.c
Yao> +set binfile ${objdir}/${subdir}/${testfile}

standard_testfile

Yao> +# Test command 'where' is executed when command 'attach' is done, otherwise
Yao> +# function 'sleep' may not show up in backtrace.
Yao> +
Yao> +gdb_test_sequence "python gdb.execute(\"attach $testpid\"); gdb.execute(\"where\")" \
Yao> + "attach and where" {
Yao> + "\[\r\n\]#.* in sleep \\(\\) "
Yao> + "\[\r\n\]#.* in foo1 \\(\\) at "
Yao> + "\[\r\n\]#.* in foo2 \\(\\) at "
Yao> + "\[\r\n\]#.* in foo3 \\(\\) at "
Yao> + "\[\r\n\]#.* in main \\(\\) at "
Yao> +}

I applied this patch to my branch, to see what would happen. On my
system (x86-64 Fedora 18, with glibc debuginfo installed), I see this
backtrace in the log:

python gdb.execute("attach 11985"); gdb.execute("where")
0x0000003e422bb4e0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
#0 0x0000003e422bb4e0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
#1 0x0000003e422bb3a1 in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:137
#2 0x00000000004005da in foo1 () at ../../../archer/gdb/testsuite/gdb.python/py-sync-interp.c:26
#3 0x00000000004005e5 in foo2 () at ../../../archer/gdb/testsuite/gdb.python/py-sync-interp.c:32
#4 0x00000000004005f0 in foo3 () at ../../../archer/gdb/testsuite/gdb.python/py-sync-interp.c:38
#5 0x00000000004005fb in main () at ../../../archer/gdb/testsuite/gdb.python/py-sync-interp.c:45

This yielded a FAIL:

FAIL: gdb.python/py-sync-interp.exp: attach and where (pattern 1)

Tom