Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* adjust linux-dp test
@ 2006-11-29 14:58 Nathan Sidwell
  2006-11-29 15:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Sidwell @ 2006-11-29 14:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Daniel Jacobowitz

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

My recent change to linux-dp.exp wasn't robust because (a) some thread ids can 
be negative numbers and (b) sometimes you'd get a 'cannot access memory' error 
in printing out a prototype, and that would mess up the \n placement.

This patch fixes those two problems, and renames the tests to be unique.

tested on i686-pc-linux-gnu, ok?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


[-- Attachment #2: linux.patch --]
[-- Type: text/x-patch, Size: 3206 bytes --]

2006-11-29  Nathan Sidwell  <nathan@codesourcery.com>

	* gdb.threads/linux-dp.exp: Adjust regexps used to scan thread
	info.  Adjust test names.

Index: testsuite/gdb.threads/linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.12
diff -c -3 -p -r1.12 linux-dp.exp
*** testsuite/gdb.threads/linux-dp.exp	28 Nov 2006 15:16:48 -0000	1.12
--- testsuite/gdb.threads/linux-dp.exp	29 Nov 2006 14:51:12 -0000
*************** for {set i 0} {$i < 5} {incr i} {
*** 73,79 ****
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^\\*? +(\[0-9\]+ Thread \[0-9\]+) \[^\n\]*\n" {
  	    verbose -log "found thread $expect_out(1,string)" 2
  	    lappend threads_before $expect_out(1,string)
  	    exp_continue
--- 73,79 ----
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^. +(\[0-9\]+ Thread \[-0-9\]+) (\[^\n\]|Cannot access memory \[^\n\]*\n)*\n" {
  	    verbose -log "found thread $expect_out(1,string)" 2
  	    lappend threads_before $expect_out(1,string)
  	    exp_continue
*************** for {set i 0} {$i < 5} {incr i} {
*** 81,87 ****
  	-re "^$gdb_prompt $" {
  	}
  	timeout {
! 	    fail "(timeout) info threads"
  	}
      }
      send_gdb "next\n"
--- 81,87 ----
  	-re "^$gdb_prompt $" {
  	}
  	timeout {
! 	    fail "(timeout) info threads before: $i"
  	}
      }
      send_gdb "next\n"
*************** for {set i 0} {$i < 5} {incr i} {
*** 139,145 ****
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^\\*? +(\[0-9\]+ Thread \[0-9\]+) \[^\n\]+\n" {
  	    set name $expect_out(1,string)
  	    for {set j 0} {$j != [llength $threads_before] } {incr j} {
  		if {$name == [lindex $threads_before $j]} {
--- 139,145 ----
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^. +(\[0-9\]+ Thread \[-0-9\]+) (\[^\n\]|Cannot access memory \[^\n\]*\n)*\n" {
  	    set name $expect_out(1,string)
  	    for {set j 0} {$j != [llength $threads_before] } {incr j} {
  		if {$name == [lindex $threads_before $j]} {
*************** for {set i 0} {$i < 5} {incr i} {
*** 155,175 ****
  	}
  	-re "^$gdb_prompt $" {
  	    if { [llength $threads_before] != 0 } {
! 		fail "create philosopher: $i"
  	    } elseif { !$i && [llength $threads_after] == 2 } {
  		set expect_manager 1
! 		pass "create philosopher: $i"
  	    } elseif { [llength $threads_after] == 1 } {
  		if { $expect_manager < 0 } {
  		    set expect_manager 0
  		}
! 		pass "create philosopher: $i"
  	    } else {
! 		fail "create philosopher: $i"
  	    }
  	}
  	timeout {
! 	    fail "(timeout) info threads"
  	}
      }
      
--- 155,175 ----
  	}
  	-re "^$gdb_prompt $" {
  	    if { [llength $threads_before] != 0 } {
! 		fail "info threads after: $i"
  	    } elseif { !$i && [llength $threads_after] == 2 } {
  		set expect_manager 1
! 		pass "info threads after: $i"
  	    } elseif { [llength $threads_after] == 1 } {
  		if { $expect_manager < 0 } {
  		    set expect_manager 0
  		}
! 		pass "info threads after: $i"
  	    } else {
! 		fail "info threads after: $i"
  	    }
  	}
  	timeout {
! 	    fail "(timeout) info threads after: $i"
  	}
      }
      

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 14:58 adjust linux-dp test Nathan Sidwell
@ 2006-11-29 15:08 ` Daniel Jacobowitz
  2006-11-29 15:15   ` Nathan Sidwell
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-11-29 15:08 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

On Wed, Nov 29, 2006 at 02:58:08PM +0000, Nathan Sidwell wrote:
> My recent change to linux-dp.exp wasn't robust because (a) some thread ids 
> can be negative numbers and (b) sometimes you'd get a 'cannot access 
> memory' error in printing out a prototype, and that would mess up the \n 
> placement.

When does (b) happen?  That's strange.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:08 ` Daniel Jacobowitz
@ 2006-11-29 15:15   ` Nathan Sidwell
  2006-11-29 15:24     ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Sidwell @ 2006-11-29 15:15 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Wed, Nov 29, 2006 at 02:58:08PM +0000, Nathan Sidwell wrote:
>> My recent change to linux-dp.exp wasn't robust because (a) some thread ids 
>> can be negative numbers and (b) sometimes you'd get a 'cannot access 
>> memory' error in printing out a prototype, and that would mess up the \n 
>> placement.
> 
> When does (b) happen?  That's strange.

for example here ...
info threads
   3 Thread -1218434144 (LWP 2749)  0xffffe410 in __kernel_vsyscall ()
   2 Thread -1210037344 (LWP 2748)  0xffffe410 in __kernel_vsyscall ()
* 1 Thread -1210034512 (LWP 2745)  main (argc=Cannot access memory at address 0x0
) at ../../../src/gdb/testsuite/gdb.threads/linux-dp.c:189

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:15   ` Nathan Sidwell
@ 2006-11-29 15:24     ` Daniel Jacobowitz
  2006-11-29 15:30       ` Nathan Sidwell
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-11-29 15:24 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

On Wed, Nov 29, 2006 at 03:14:50PM +0000, Nathan Sidwell wrote:
> Daniel Jacobowitz wrote:
> >On Wed, Nov 29, 2006 at 02:58:08PM +0000, Nathan Sidwell wrote:
> >>My recent change to linux-dp.exp wasn't robust because (a) some thread 
> >>ids can be negative numbers and (b) sometimes you'd get a 'cannot access 
> >>memory' error in printing out a prototype, and that would mess up the \n 
> >>placement.
> >
> >When does (b) happen?  That's strange.
> 
> for example here ...
> info threads
>   3 Thread -1218434144 (LWP 2749)  0xffffe410 in __kernel_vsyscall ()
>   2 Thread -1210037344 (LWP 2748)  0xffffe410 in __kernel_vsyscall ()
> * 1 Thread -1210034512 (LWP 2745)  main (argc=Cannot access memory at 
> address 0x0
> ) at ../../../src/gdb/testsuite/gdb.threads/linux-dp.c:189

Well that's totally lame.  I don't see how it happens, either, I'd
expect the error in val_print to catch it.

I think you need to allow newlines in this output anyway; it might wrap
printing many parameters of a function.  So may as well just relax the
error for now.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:24     ` Daniel Jacobowitz
@ 2006-11-29 15:30       ` Nathan Sidwell
  2006-11-29 15:33         ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Sidwell @ 2006-11-29 15:30 UTC (permalink / raw)
  To: Nathan Sidwell, gdb-patches

Daniel Jacobowitz wrote:

> I think you need to allow newlines in this output anyway; it might wrap
> printing many parameters of a function.  So may as well just relax the
> error for now.

it'd be easy enough to skip unrecognized lines though. but why would it wrap? 
there's a 'set width 0' to stop gdb wrapping things.


nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:30       ` Nathan Sidwell
@ 2006-11-29 15:33         ` Daniel Jacobowitz
  2006-11-29 15:59           ` Nathan Sidwell
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-11-29 15:33 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

On Wed, Nov 29, 2006 at 03:30:44PM +0000, Nathan Sidwell wrote:
> Daniel Jacobowitz wrote:
> 
> >I think you need to allow newlines in this output anyway; it might wrap
> >printing many parameters of a function.  So may as well just relax the
> >error for now.
> 
> it'd be easy enough to skip unrecognized lines though. but why would it 
> wrap? there's a 'set width 0' to stop gdb wrapping things.

Oh, guess so.  I don't really want to add a patch that recognizes that
error message here; the error message is wrong, we really shouldn't be
printing it.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:33         ` Daniel Jacobowitz
@ 2006-11-29 15:59           ` Nathan Sidwell
  2006-11-29 16:03             ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Sidwell @ 2006-11-29 15:59 UTC (permalink / raw)
  To: Nathan Sidwell, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

Daniel Jacobowitz wrote:

> Oh, guess so.  I don't really want to add a patch that recognizes that
> error message here; the error message is wrong, we really shouldn't be
> printing it.

this one works, ok?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


[-- Attachment #2: linux.patch --]
[-- Type: text/x-patch, Size: 3258 bytes --]

2006-11-29  Nathan Sidwell  <nathan@codesourcery.com>

	* gdb.threads/linux-dp.exp: Adjust regexps used to scan thread
	info.  Adjust test names.

Index: testsuite/gdb.threads/linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.12
diff -c -3 -p -r1.12 linux-dp.exp
*** testsuite/gdb.threads/linux-dp.exp	28 Nov 2006 15:16:48 -0000	1.12
--- testsuite/gdb.threads/linux-dp.exp	29 Nov 2006 15:58:23 -0000
*************** for {set i 0} {$i < 5} {incr i} {
*** 73,87 ****
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^\\*? +(\[0-9\]+ Thread \[0-9\]+) \[^\n\]*\n" {
  	    verbose -log "found thread $expect_out(1,string)" 2
  	    lappend threads_before $expect_out(1,string)
  	    exp_continue
  	}
  	-re "^$gdb_prompt $" {
  	}
  	timeout {
! 	    fail "(timeout) info threads"
  	}
      }
      send_gdb "next\n"
--- 73,90 ----
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^. +(\[0-9\]+ Thread \[-0-9\]+) \[^\n\]*\n" {
  	    verbose -log "found thread $expect_out(1,string)" 2
  	    lappend threads_before $expect_out(1,string)
  	    exp_continue
  	}
+ 	-re "^\[^\n\]*\n" {
+ 	    verbose -log "skipping line" 2
+ 	}
  	-re "^$gdb_prompt $" {
  	}
  	timeout {
! 	    fail "(timeout) info threads before: $i"
  	}
      }
      send_gdb "next\n"
*************** for {set i 0} {$i < 5} {incr i} {
*** 139,145 ****
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^\\*? +(\[0-9\]+ Thread \[0-9\]+) \[^\n\]+\n" {
  	    set name $expect_out(1,string)
  	    for {set j 0} {$j != [llength $threads_before] } {incr j} {
  		if {$name == [lindex $threads_before $j]} {
--- 142,148 ----
  	-re "info threads\r\n" {
  	    exp_continue
  	}
! 	-re "^. +(\[0-9\]+ Thread \[-0-9\]+) \[^\n\]*\n" {
  	    set name $expect_out(1,string)
  	    for {set j 0} {$j != [llength $threads_before] } {incr j} {
  		if {$name == [lindex $threads_before $j]} {
*************** for {set i 0} {$i < 5} {incr i} {
*** 153,175 ****
  	    }
  	    exp_continue
  	}
  	-re "^$gdb_prompt $" {
  	    if { [llength $threads_before] != 0 } {
! 		fail "create philosopher: $i"
  	    } elseif { !$i && [llength $threads_after] == 2 } {
  		set expect_manager 1
! 		pass "create philosopher: $i"
  	    } elseif { [llength $threads_after] == 1 } {
  		if { $expect_manager < 0 } {
  		    set expect_manager 0
  		}
! 		pass "create philosopher: $i"
  	    } else {
! 		fail "create philosopher: $i"
  	    }
  	}
  	timeout {
! 	    fail "(timeout) info threads"
  	}
      }
      
--- 156,181 ----
  	    }
  	    exp_continue
  	}
+ 	-re "^\[^\n\]*\n" {
+ 	    verbose -log "skipping line" 2
+ 	}
  	-re "^$gdb_prompt $" {
  	    if { [llength $threads_before] != 0 } {
! 		fail "info threads after: $i"
  	    } elseif { !$i && [llength $threads_after] == 2 } {
  		set expect_manager 1
! 		pass "info threads after: $i"
  	    } elseif { [llength $threads_after] == 1 } {
  		if { $expect_manager < 0 } {
  		    set expect_manager 0
  		}
! 		pass "info threads after: $i"
  	    } else {
! 		fail "info threads after: $i"
  	    }
  	}
  	timeout {
! 	    fail "(timeout) info threads after: $i"
  	}
      }
      

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: adjust linux-dp test
  2006-11-29 15:59           ` Nathan Sidwell
@ 2006-11-29 16:03             ` Daniel Jacobowitz
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-11-29 16:03 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

On Wed, Nov 29, 2006 at 03:59:42PM +0000, Nathan Sidwell wrote:
> Daniel Jacobowitz wrote:
> 
> >Oh, guess so.  I don't really want to add a patch that recognizes that
> >error message here; the error message is wrong, we really shouldn't be
> >printing it.
> 
> this one works, ok?

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-11-29 16:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-29 14:58 adjust linux-dp test Nathan Sidwell
2006-11-29 15:08 ` Daniel Jacobowitz
2006-11-29 15:15   ` Nathan Sidwell
2006-11-29 15:24     ` Daniel Jacobowitz
2006-11-29 15:30       ` Nathan Sidwell
2006-11-29 15:33         ` Daniel Jacobowitz
2006-11-29 15:59           ` Nathan Sidwell
2006-11-29 16:03             ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox