Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFH] Cygwin (EXEEXT) fix.
@ 2006-12-10 14:38 Pedro Alves
  2006-12-10 15:56 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2006-12-10 14:38 UTC (permalink / raw)
  To: gdb-patches

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

Hi all,

(I know this is a bit offtopic here, since it has mostly to do with my 
lack of tcl knowledge.)

There is a fail on gdb.base/annota3.exp on Cygwin related to a missing 
EXEEXT that
I need help in fixing.

Where is reads '.*annota3' in:

gdb_expect_list "run until main breakpoint" "$gdb_prompt$" {
    "\r\n\032\032post-prompt\r\n"
    "Starting program: .*annota3 \r\n"
    "\r\n\032\032starting\r\n"
    "\r\n\032\032breakpoint 1\r\n"
(...)

My first approach was:
-    "Starting program: .*annota3 \r\n"
+    "Starting program: .*annota3${EXEEXT} \r\n"

But that doesn't work: The variable doesn't get expanded.

Doing:
-    "Starting program: .*annota3 \r\n"
+    "Starting program: .*annota3" [$EXEEXT] " \r\n"

... also doesn't work, much to my surprise, since I copied the syntax 
from gdb.arch/altivec-regs.exp :

(...)
gdb_expect_list "info vector" ".*$gdb_prompt $" {
[$pattern0]
[$pattern1]
(...)

I see that uppercase/lowercase makes a difference, since, if I do a:

+ set exeext ".exe"

-    "Starting program: .*annota3 \r\n"
+    "Starting program: .*annota3" [$exeext] " \r\n"

The regex always passes, no matter what I put in $exeext, even if I put 
something like "asdfad".

How does one go about fixing this?

Cheers,
Pedro Alves


[-- Attachment #2: annota3.diff --]
[-- Type: text/plain, Size: 982 bytes --]

Index: gdb.base/annota3.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v
retrieving revision 1.9
diff -u -p -r1.9 annota3.exp
--- gdb.base/annota3.exp	10 Aug 2006 05:27:20 -0000	1.9
+++ gdb.base/annota3.exp	10 Dec 2006 14:16:17 -0000
@@ -39,7 +39,7 @@ set bug_id 0
 
 set testfile "annota3"
 set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
     untested annota3.exp
@@ -118,7 +118,7 @@ gdb_expect_list "breakpoint info" "$gdb_
 send_gdb "run\n"
 gdb_expect_list "run until main breakpoint" "$gdb_prompt$" {
     "\r\n\032\032post-prompt\r\n"
-    "Starting program: .*annota3 \r\n"
+    "Starting program: .*annota3" [$EXEEXT] " \r\n"
     "\r\n\032\032starting\r\n"
     "\r\n\032\032breakpoint 1\r\n"
     "\r\n"

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

* Re: [RFH] Cygwin (EXEEXT) fix.
  2006-12-10 14:38 [RFH] Cygwin (EXEEXT) fix Pedro Alves
@ 2006-12-10 15:56 ` Daniel Jacobowitz
  2006-12-10 16:54   ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-12-10 15:56 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Sun, Dec 10, 2006 at 02:37:46PM +0000, Pedro Alves wrote:
> gdb_expect_list "run until main breakpoint" "$gdb_prompt$" {
>    "\r\n\032\032post-prompt\r\n"

This is a TCL list.  { } are quotes, like ' ' in the shell, which
prevent expansion.

Try changing it to [list "..." "..."], but you'll need to check the
quoting in every element and add backslashes at the end of every line.
Or, you can just add (|\.exe) instead of $EXEEXT... much simpler.


-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [RFH] Cygwin (EXEEXT) fix.
  2006-12-10 15:56 ` Daniel Jacobowitz
@ 2006-12-10 16:54   ` Pedro Alves
  2006-12-10 17:06     ` Daniel Jacobowitz
  2007-01-04 20:56     ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: Pedro Alves @ 2006-12-10 16:54 UTC (permalink / raw)
  To: gdb-patches

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

Daniel Jacobowitz escreveu:
> On Sun, Dec 10, 2006 at 02:37:46PM +0000, Pedro Alves wrote:
>> gdb_expect_list "run until main breakpoint" "$gdb_prompt$" {
>>    "\r\n\032\032post-prompt\r\n"
> 
> This is a TCL list.  { } are quotes, like ' ' in the shell, which
> prevent expansion.
> 
> Try changing it to [list "..." "..."], but you'll need to check the
> quoting in every element and add backslashes at the end of every line.

Ah, I see. But shouldn't a command work too?
If not, then I don't understand is how this in
gdb.arch/altivec-regs.exp can work.

gdb_expect_list "info vector" ".*$gdb_prompt $" {
[$pattern0]
[$pattern1]
[$pattern2]
[$pattern3]
(...)
}

> Or, you can just add (|\.exe) instead of $EXEEXT... much simpler.
> 
> 

That is what I have in my local tree, but I though that
it wouldn't be acceptable, since it feels like a hack. :)
Since it is, then please find the patch attached.

Please review and commit.

Cheers,
Pedro Alves

---

gdb/testsuite/ChangeLog:

2006-12-10  Pedro Alves  <pedro_alves@portugalmail.pt>

	* gdb.base/annota3.exp ($binfile): Append $EXEEXT.
	Expect ".exe" extension.


[-- Attachment #2: annota3.diff --]
[-- Type: text/plain, Size: 977 bytes --]

Index: gdb.base/annota3.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v
retrieving revision 1.9
diff -u -p -r1.9 annota3.exp
--- gdb.base/annota3.exp	10 Aug 2006 05:27:20 -0000	1.9
+++ gdb.base/annota3.exp	10 Dec 2006 16:47:50 -0000
@@ -39,7 +39,7 @@ set bug_id 0
 
 set testfile "annota3"
 set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
     untested annota3.exp
@@ -118,7 +118,7 @@ gdb_expect_list "breakpoint info" "$gdb_
 send_gdb "run\n"
 gdb_expect_list "run until main breakpoint" "$gdb_prompt$" {
     "\r\n\032\032post-prompt\r\n"
-    "Starting program: .*annota3 \r\n"
+    "Starting program: .*annota3(|\.exe) \r\n"
     "\r\n\032\032starting\r\n"
     "\r\n\032\032breakpoint 1\r\n"
     "\r\n"

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

* Re: [RFH] Cygwin (EXEEXT) fix.
  2006-12-10 16:54   ` Pedro Alves
@ 2006-12-10 17:06     ` Daniel Jacobowitz
  2006-12-10 17:24       ` Pedro Alves
  2007-01-04 20:56     ` Daniel Jacobowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-12-10 17:06 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Sun, Dec 10, 2006 at 04:53:54PM +0000, Pedro Alves wrote:
> Ah, I see. But shouldn't a command work too?
> If not, then I don't understand is how this in
> gdb.arch/altivec-regs.exp can work.
> 
> gdb_expect_list "info vector" ".*$gdb_prompt $" {
> [$pattern0]
> [$pattern1]
> [$pattern2]
> [$pattern3]
> (...)
> }

I don't know how it's supposed to work either.  That's not valid
commands anyway.


-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [RFH] Cygwin (EXEEXT) fix.
  2006-12-10 17:06     ` Daniel Jacobowitz
@ 2006-12-10 17:24       ` Pedro Alves
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2006-12-10 17:24 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz escreveu:
> On Sun, Dec 10, 2006 at 04:53:54PM +0000, Pedro Alves wrote:
>   
>> Ah, I see. But shouldn't a command work too?
>> If not, then I don't understand is how this in
>> gdb.arch/altivec-regs.exp can work.
>>
>> gdb_expect_list "info vector" ".*$gdb_prompt $" {
>> [$pattern0]
>> [$pattern1]
>> [$pattern2]
>> [$pattern3]
>> (...)
>> }
>>     
>
> I don't know how it's supposed to work either.  That's not valid
> commands anyway.
>
>
>   
Thanks, I'll be able to sleep again :)
 From what I saw when trying to do the same thing on annota3.exp, I 
guess those tests will
always yield false positives.

Cheers,
Pedro Alves


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

* Re: [RFH] Cygwin (EXEEXT) fix.
  2006-12-10 16:54   ` Pedro Alves
  2006-12-10 17:06     ` Daniel Jacobowitz
@ 2007-01-04 20:56     ` Daniel Jacobowitz
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-01-04 20:56 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Sun, Dec 10, 2006 at 04:53:54PM +0000, Pedro Alves wrote:
> 2006-12-10  Pedro Alves  <pedro_alves@portugalmail.pt>
> 
> 	* gdb.base/annota3.exp ($binfile): Append $EXEEXT.
> 	Expect ".exe" extension.

Checked in.  I see what you mean about false positives ... it
must be treating "[$pattern0]" as a braced group and getting lucky
somehow.  Those tests ought to be fixed sometime.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-01-04 20:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-10 14:38 [RFH] Cygwin (EXEEXT) fix Pedro Alves
2006-12-10 15:56 ` Daniel Jacobowitz
2006-12-10 16:54   ` Pedro Alves
2006-12-10 17:06     ` Daniel Jacobowitz
2006-12-10 17:24       ` Pedro Alves
2007-01-04 20:56     ` Daniel Jacobowitz

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