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]

[PING][PATCH] gdb.threads/thread-specific.exp: Fix uninitialized variable references


Ping!

On Fri, 7 Mar 2014, Maciej W. Rozycki wrote:

> Hi,
> 
>  This fixes:
> 
> FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
> ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
> ERROR: can't read "this_breakpoint": no such variable
>     while executing
> "gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" {
>     -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" {
>         set this_thread $expe..."
>     (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 108)
>     invoked from within
> "source .../gdb/testsuite/gdb.threads/thread-specific.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name""
> 
> and then:
> 
> FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
> UNTESTED: gdb.threads/thread-specific.exp: info on bp
> ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
> ERROR: can't read "this_thread": no such variable
>     while executing
> "gdb_test {print $_thread} ".* = $this_thread" "thread var at break""
>     (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 119)
>     invoked from within
> "source .../gdb/testsuite/gdb.threads/thread-specific.exp"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
>     invoked from within
> "catch "uplevel #0 source $test_file_name""
> 
> Final results:
> 
> FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
> UNTESTED: gdb.threads/thread-specific.exp: info on bp
> UNTESTED: gdb.threads/thread-specific.exp: thread var at break
> 
> Of course the first failure best wasn't there, but failing that the script 
> shouldn't crash.
> 
>  OK to apply?
> 
> 2014-03-07  Maciej W. Rozycki  <macro@codesourcery.com>
> 
> 	gdb/testsuite/
> 	* gdb.threads/thread-specific.exp: Check for the existence of
> 	$this_breakpoint and $this_thread before use.
> 
>   Maciej
> 
> gdb-test-thread-specific-this-foo.diff
> Index: gdb-fsf-trunk-quilt/gdb/testsuite/gdb.threads/thread-specific.exp
> ===================================================================
> --- gdb-fsf-trunk-quilt.orig/gdb/testsuite/gdb.threads/thread-specific.exp	2014-01-03 21:13:59.077575761 +0000
> +++ gdb-fsf-trunk-quilt/gdb/testsuite/gdb.threads/thread-specific.exp	2014-03-07 01:46:50.388996822 +0000
> @@ -105,13 +105,21 @@ gdb_test_multiple "continue" "continue t
>  	}
>  }
>  
> -gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" {
> -    -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" {
> -	set this_thread $expect_out(1,string)
> -	pass "found breakpoint for thread number"
> +if { [info exists this_breakpoint] } {
> +    gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" {
> +	-re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" {
> +	    set this_thread $expect_out(1,string)
> +	    pass "found breakpoint for thread number"
> +	}
>      }
> +} else {
> +    untested "info on bp"
>  }
>  
> -gdb_test {print $_thread} ".* = $this_thread" "thread var at break"
> +if { [info exists this_thread] } {
> +    gdb_test {print $_thread} ".* = $this_thread" "thread var at break"
> +} else {
> +    untested "thread var at break"
> +}
>  
>  return 0
> 


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