Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Remove comments from user_code in gdb_test_multiple
@ 2008-03-27 15:24 Markus Deuling
  2008-03-27 15:32 ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Markus Deuling @ 2008-03-27 15:24 UTC (permalink / raw)
  To: GDB Patches; +Cc: Ulrich Weigand

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

Hi,

this patch removes all comments from user_code given to gdb_test_multiple. This allows
to have comments in code snippets given to gdb_test_multiple like for exmaple proposed
in this patch:

http://sourceware.org/ml/gdb-patches/2008-03/msg00290.html


ChangeLog:

	* lib/gdb.exp (gdb_test_multiple): Remove comments from user_code.

Ok ?


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: gdb_multiple_cmt --]
[-- Type: text/plain, Size: 532 bytes --]

diff -urpN src/gdb/testsuite/lib/gdb.exp dev/gdb/testsuite/lib/gdb.exp
--- src/gdb/testsuite/lib/gdb.exp	2008-03-10 11:23:52.000000000 +0100
+++ dev/gdb/testsuite/lib/gdb.exp	2008-03-27 16:15:08.000000000 +0100
@@ -566,6 +566,7 @@ proc gdb_test_multiple { command message
     # input doesn't contain a pattern which contains actual embedded newlines
     # at this point!
 
+    regsub -all {[;#].*?[\n]} ${user_code} { } user_code
     regsub -all {\n} ${user_code} { } subst_code
     set subst_code [uplevel list $subst_code]
 

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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 15:24 [patch] Remove comments from user_code in gdb_test_multiple Markus Deuling
@ 2008-03-27 15:32 ` Daniel Jacobowitz
  2008-03-27 15:47   ` Markus Deuling
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-03-27 15:32 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches, Ulrich Weigand

On Thu, Mar 27, 2008 at 04:23:38PM +0100, Markus Deuling wrote:
> Hi,
>
> this patch removes all comments from user_code given to gdb_test_multiple. This allows
> to have comments in code snippets given to gdb_test_multiple like for exmaple proposed
> in this patch:
>
> http://sourceware.org/ml/gdb-patches/2008-03/msg00290.html
>
>
> ChangeLog:
>
> 	* lib/gdb.exp (gdb_test_multiple): Remove comments from user_code.
>
> Ok ?

Won't this eat quoted # signs in the middle of patterns?
I suggest you move the comment inside the code block where it would be
valid, instead.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 15:32 ` Daniel Jacobowitz
@ 2008-03-27 15:47   ` Markus Deuling
  2008-03-27 15:55     ` Daniel Jacobowitz
  2008-03-27 16:35     ` Andrew STUBBS
  0 siblings, 2 replies; 11+ messages in thread
From: Markus Deuling @ 2008-03-27 15:47 UTC (permalink / raw)
  To: Daniel Jacobowitz, Ulrich Weigand; +Cc: GDB Patches

Daniel Jacobowitz schrieb:
> On Thu, Mar 27, 2008 at 04:23:38PM +0100, Markus Deuling wrote:
>> Hi,
>>
>> this patch removes all comments from user_code given to gdb_test_multiple. This allows
>> to have comments in code snippets given to gdb_test_multiple like for exmaple proposed
>> in this patch:
>>
>> http://sourceware.org/ml/gdb-patches/2008-03/msg00290.html
>>
>>
>> ChangeLog:
>>
>> 	* lib/gdb.exp (gdb_test_multiple): Remove comments from user_code.
>>
>> Ok ?
> 
> Won't this eat quoted # signs in the middle of patterns?
> I suggest you move the comment inside the code block where it would be
> valid, instead.
> 

Hm, your're right. They're eaten :-(

S.th. like this isn't possible currently. Moving this comment above gdb_test_multiple might be
confusing (there might be a lot more re's with different meanings):

gdb_test_multiple "info spu mailbox" "$msg" {
    -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
         pass "$msg"
    }
    # Older kernels had a bug that caused them to return arbitrary values when
    # attempting to read from an empty mailbox via spufs.
    -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
         xfail "$msg"
    }
}

What do you think about the spu info mailbox patch then ? Move the comment above gdb_test_multiple ? Or use send_gdb/gdb_expect and have the comments in the right place?


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 15:47   ` Markus Deuling
@ 2008-03-27 15:55     ` Daniel Jacobowitz
  2008-03-27 17:52       ` Ulrich Weigand
  2008-03-27 16:35     ` Andrew STUBBS
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-03-27 15:55 UTC (permalink / raw)
  To: Markus Deuling; +Cc: Ulrich Weigand, GDB Patches

On Thu, Mar 27, 2008 at 04:46:36PM +0100, Markus Deuling wrote:
>    # Older kernels had a bug that caused them to return arbitrary values when
>    # attempting to read from an empty mailbox via spufs.
>    -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
>         xfail "$msg"
>    }
> }
>
> What do you think about the spu info mailbox patch then ? Move the comment above gdb_test_multiple ? Or use send_gdb/gdb_expect and have the comments in the right place?

That becomes:

>     -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
> 	# Older kernels had a bug that caused them to return arbitrary values when
> 	# attempting to read from an empty mailbox via spufs.
> 	xfail "$msg"
>     }

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 15:47   ` Markus Deuling
  2008-03-27 15:55     ` Daniel Jacobowitz
@ 2008-03-27 16:35     ` Andrew STUBBS
  2008-03-28  8:57       ` Markus Deuling
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew STUBBS @ 2008-03-27 16:35 UTC (permalink / raw)
  To: Markus Deuling; +Cc: Daniel Jacobowitz, Ulrich Weigand, GDB Patches

Markus Deuling wrote:
> What do you think about the spu info mailbox patch then ? Move the 
> comment above gdb_test_multiple ? Or use send_gdb/gdb_expect and have 
> the comments in the right place?

The (?#) directive allows you to put the comments inside the regular 
expression itself.

    -re "(?#Older kernels had a bug that caused them to return arbitrary 
values when
            attempting to read from an empty mailbox via spufs.
         )SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt 
Mailbox.*0x.*$gdb_prompt $"

Or, alternatively, the (?x) directive might be cleaner. Note that this 
changes the meaning of white space.

    -re "(?x)
         #Older kernels had a bug that caused them to return arbitrary 
values when
         #attempting to read from an empty mailbox via spufs.
         SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*
         $gdb_prompt[ ]$"


This is untested!

Andrew


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 15:55     ` Daniel Jacobowitz
@ 2008-03-27 17:52       ` Ulrich Weigand
  2008-03-28  9:16         ` Markus Deuling
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2008-03-27 17:52 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Markus Deuling, GDB Patches

Daniel Jacobowitz wrote:

> That becomes:
> 
> >     -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
> > 	# Older kernels had a bug that caused them to return arbitrary values when
> > 	# attempting to read from an empty mailbox via spufs.
> > 	xfail "$msg"
> >     }

I agree that this seems the best solution -- I wasn't trying to 
do anything special, I just didn't think of the where exactly
to place the comment ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 16:35     ` Andrew STUBBS
@ 2008-03-28  8:57       ` Markus Deuling
  2008-03-28  9:40         ` Andrew STUBBS
  0 siblings, 1 reply; 11+ messages in thread
From: Markus Deuling @ 2008-03-28  8:57 UTC (permalink / raw)
  To: Andrew STUBBS
  Cc: Markus Deuling, Daniel Jacobowitz, Ulrich Weigand, GDB Patches

Andrew STUBBS schrieb:
> Markus Deuling wrote:
>> What do you think about the spu info mailbox patch then ? Move the 
>> comment above gdb_test_multiple ? Or use send_gdb/gdb_expect and have 
>> the comments in the right place?
> 
> The (?#) directive allows you to put the comments inside the regular 
> expression itself.
> 
>    -re "(?#Older kernels had a bug that caused them to return arbitrary 
> values when
>            attempting to read from an empty mailbox via spufs.
>         )SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt 
> Mailbox.*0x.*$gdb_prompt $"
> 
> Or, alternatively, the (?x) directive might be cleaner. Note that this 
> changes the meaning of white space.
> 
>    -re "(?x)
>         #Older kernels had a bug that caused them to return arbitrary 
> values when
>         #attempting to read from an empty mailbox via spufs.
>         SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*
>         $gdb_prompt[ ]$"
> 
> 
> This is untested!
> 
> Andrew
> 

This is interesting, thank you! Is this documented somewhere? Maybe it would be a good idea
to add one or two lines above gdb_test_multiple or in the Internal's Manual. What do you think ?

Regards,
Markus

-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-27 17:52       ` Ulrich Weigand
@ 2008-03-28  9:16         ` Markus Deuling
  2008-03-28 16:00           ` Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Markus Deuling @ 2008-03-28  9:16 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: Daniel Jacobowitz, GDB Patches

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

Ulrich Weigand schrieb:
> Daniel Jacobowitz wrote:
> 
>> That becomes:
>>
>>>     -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
>>> 	# Older kernels had a bug that caused them to return arbitrary values when
>>> 	# attempting to read from an empty mailbox via spufs.
>>> 	xfail "$msg"
>>>     }
> 
> I agree that this seems the best solution -- I wasn't trying to 
> do anything special, I just didn't think of the where exactly
> to place the comment ...

Here is a new version. Ok ?


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: fix-spu-mailbox --]
[-- Type: text/plain, Size: 1050 bytes --]

diff -urpN src/gdb/testsuite/gdb.arch/spu-info.exp dev/gdb/testsuite/gdb.arch/spu-info.exp
--- src/gdb/testsuite/gdb.arch/spu-info.exp	2008-01-01 23:53:18.000000000 +0100
+++ dev/gdb/testsuite/gdb.arch/spu-info.exp	2008-03-28 09:53:47.000000000 +0100
@@ -200,9 +200,17 @@ gdb_test "finish" "" "finish"
 # Mailbox Test
 # 'info spu mailbox' should be empty.
 c_to "Marker Mbox"
-gdb_test "info spu mailbox" \
-	 "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \
-	 "info spu mailbox"
+set msg "info spu mailbox"
+gdb_test_multiple "info spu mailbox" $msg {
+    -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
+      pass $msg
+    }
+    -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
+      # Older kernels had a bug that caused them to return arbitrary values
+      # when attempting to read from an empty mailbox via spufs.
+      xfail $msg
+    }
+}
 
 # 'info spu mailbox' should now contain data.
 c_to "Marker MboxEnd"

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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-28  8:57       ` Markus Deuling
@ 2008-03-28  9:40         ` Andrew STUBBS
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew STUBBS @ 2008-03-28  9:40 UTC (permalink / raw)
  To: Markus Deuling; +Cc: Daniel Jacobowitz, Ulrich Weigand, GDB Patches

Markus Deuling wrote:
> This is interesting, thank you! Is this documented somewhere? Maybe it 
> would be a good idea
> to add one or two lines above gdb_test_multiple or in the Internal's 
> Manual. What do you think ?

Well, it's in both the TCL and Perl documentation, for starters. I 
imagine it's a common feature in modern regexp implementations.

Andrew


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-28  9:16         ` Markus Deuling
@ 2008-03-28 16:00           ` Ulrich Weigand
  2008-03-31  8:42             ` Markus Deuling
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2008-03-28 16:00 UTC (permalink / raw)
  To: Markus Deuling; +Cc: Daniel Jacobowitz, GDB Patches

Markus Deuling wrote:

> diff -urpN src/gdb/testsuite/gdb.arch/spu-info.exp dev/gdb/testsuite/gdb.arch/spu-info.exp
> --- src/gdb/testsuite/gdb.arch/spu-info.exp	2008-01-01 23:53:18.000000000 +0100
> +++ dev/gdb/testsuite/gdb.arch/spu-info.exp	2008-03-28 09:53:47.000000000 +0100
> @@ -200,9 +200,17 @@ gdb_test "finish" "" "finish"
>  # Mailbox Test
>  # 'info spu mailbox' should be empty.
>  c_to "Marker Mbox"
> -gdb_test "info spu mailbox" \
> -	 "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \
> -	 "info spu mailbox"
> +set msg "info spu mailbox"
> +gdb_test_multiple "info spu mailbox" $msg {
> +    -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
> +      pass $msg
> +    }
> +    -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
> +      # Older kernels had a bug that caused them to return arbitrary values
> +      # when attempting to read from an empty mailbox via spufs.
> +      xfail $msg
> +    }
> +}
>  
>  # 'info spu mailbox' should now contain data.
>  c_to "Marker MboxEnd"


Assuming you tested the behaviour on both old and new kernels,
this is OK with me.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch] Remove comments from user_code in gdb_test_multiple
  2008-03-28 16:00           ` Ulrich Weigand
@ 2008-03-31  8:42             ` Markus Deuling
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Deuling @ 2008-03-31  8:42 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: Daniel Jacobowitz, GDB Patches

Ulrich Weigand schrieb:
> Markus Deuling wrote:
> 
>> diff -urpN src/gdb/testsuite/gdb.arch/spu-info.exp dev/gdb/testsuite/gdb.arch/spu-info.exp
>> --- src/gdb/testsuite/gdb.arch/spu-info.exp	2008-01-01 23:53:18.000000000 +0100
>> +++ dev/gdb/testsuite/gdb.arch/spu-info.exp	2008-03-28 09:53:47.000000000 +0100
>> @@ -200,9 +200,17 @@ gdb_test "finish" "" "finish"
>>  # Mailbox Test
>>  # 'info spu mailbox' should be empty.
>>  c_to "Marker Mbox"
>> -gdb_test "info spu mailbox" \
>> -	 "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \
>> -	 "info spu mailbox"
>> +set msg "info spu mailbox"
>> +gdb_test_multiple "info spu mailbox" $msg {
>> +    -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
>> +      pass $msg
>> +    }
>> +    -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
>> +      # Older kernels had a bug that caused them to return arbitrary values
>> +      # when attempting to read from an empty mailbox via spufs.
>> +      xfail $msg
>> +    }
>> +}
>>  
>>  # 'info spu mailbox' should now contain data.
>>  c_to "Marker MboxEnd"
> 
> 
> Assuming you tested the behaviour on both old and new kernels,
> this is OK with me.

2.6.20-be0707.1.20070220:
(gdb) XFAIL: gdb.arch/spu-info.exp: info spu mailbox

2.6.22-5.20070821bsc
PASS: gdb.arch/spu-info.exp: info spu mailbox


Committed now with following ChangeLog, thanks.

ChangeLog:

2008-03-31  Markus Deuling  <deuling@de.ibm.com>
	    Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>

	* gdb.arch/spu-info.exp (info spu mailbox): Check for correct initial
	value.  Add xfail for older kernels.


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


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

end of thread, other threads:[~2008-03-31  8:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-27 15:24 [patch] Remove comments from user_code in gdb_test_multiple Markus Deuling
2008-03-27 15:32 ` Daniel Jacobowitz
2008-03-27 15:47   ` Markus Deuling
2008-03-27 15:55     ` Daniel Jacobowitz
2008-03-27 17:52       ` Ulrich Weigand
2008-03-28  9:16         ` Markus Deuling
2008-03-28 16:00           ` Ulrich Weigand
2008-03-31  8:42             ` Markus Deuling
2008-03-27 16:35     ` Andrew STUBBS
2008-03-28  8:57       ` Markus Deuling
2008-03-28  9:40         ` Andrew STUBBS

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