Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilation code
@ 2002-08-20 14:34 Jim Blandy
  2002-08-22 14:32 ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Blandy @ 2002-08-20 14:34 UTC (permalink / raw)
  To: Fernando Nasser, Michael Snyder; +Cc: gdb-patches

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


Any comments on this?


[-- Attachment #2: Type: message/rfc822, Size: 6178 bytes --]

From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: RFA: abstract out thread compilation code
Date: Thu, 13 Jun 2002 12:42:06 -0500 (EST)
Message-ID: <20020613174206.DCA255EA11@zwingli.cygnus.com>


2002-06-13  Jim Blandy  <jimb@redhat.com>

	* gdb.threads/pthreads.exp: Move the portable thread compilation
	code into a function in lib/gdb.exp, and call that from here.
	* lib/gdb.exp (gdb_compile_pthreads): New function.

Index: gdb/testsuite/gdb.threads/pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthreads.exp,v
retrieving revision 1.7
diff -c -r1.7 pthreads.exp
*** gdb/testsuite/gdb.threads/pthreads.exp	1 Oct 2001 20:36:48 -0000	1.7
--- gdb/testsuite/gdb.threads/pthreads.exp	13 Jun 2002 17:39:46 -0000
***************
*** 39,80 ****
  # carriage return)
  set horiz "\[^\n\r\]*"
  
- set built_binfile 0
  if [istarget "*-*-linux"] then {
      set target_cflags "-D_MIT_POSIX_THREADS"
  } else {
      set target_cflags ""
  }
! set why_msg "unrecognized error"
! foreach lib {-lpthreads -lpthread -lthread} {
!     set options "debug"
!     lappend options "incdir=${objdir}/${subdir}"
!     lappend options "libs=$lib"
!     set ccout [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options]
!     switch -regexp -- $ccout {
! 	".*no posix threads support.*" {
! 	    set why_msg "missing threads include file"
! 	    break
! 	}
! 	".*cannot open -lpthread.*" {
! 	    set why_msg "missing runtime threads library"
! 	}
! 	".*Can't find library for -lpthread.*" {
! 	    set why_msg "missing runtime threads library"
! 	}
! 	{^$} {
! 	    pass "successfully compiled posix threads test case"
! 	    set built_binfile 1
! 	    break
! 	}
!     }
! }
! if {$built_binfile == "0"} {
!     unsupported "Couldn't compile ${srcfile}, ${why_msg}"
!     return -1
  }
  
- # Now we can proceed with the real testing.
  
  # Start with a fresh gdb.
  
--- 39,54 ----
  # carriage return)
  set horiz "\[^\n\r\]*"
  
  if [istarget "*-*-linux"] then {
      set target_cflags "-D_MIT_POSIX_THREADS"
  } else {
      set target_cflags ""
  }
! 
! if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}/${subdir}"]] != "" } {
!     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
  }
  
  
  # Start with a fresh gdb.
  
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.20
diff -c -r1.20 gdb.exp
*** gdb/testsuite/lib/gdb.exp	11 Jun 2002 20:37:05 -0000	1.20
--- gdb/testsuite/lib/gdb.exp	13 Jun 2002 17:39:46 -0000
***************
*** 1171,1176 ****
--- 1171,1212 ----
      return $result;
  }
  
+ 
+ # This is just like gdb_compile, above, except that it tries compiling
+ # against several different thread libraries, to see which one this
+ # system has.
+ proc gdb_compile_pthreads {source dest type options} {
+     set build_binfile 0
+     set why_msg "unrecognized error"
+     foreach lib {-lpthreads -lpthread -lthread} {
+         # This kind of wipes out whatever libs the caller may have
+         # set.  Or maybe theirs will override ours.  How infelicitous.
+         set options_with_lib [concat $options [list libs=$lib]]
+         set ccout [gdb_compile $source $dest $type $options_with_lib]
+         switch -regexp -- $ccout {
+             ".*no posix threads support.*" {
+                 set why_msg "missing threads include file"
+                 break
+             }
+             ".*cannot open -lpthread.*" {
+                 set why_msg "missing runtime threads library"
+             }
+             ".*Can't find library for -lpthread.*" {
+                 set why_msg "missing runtime threads library"
+             }
+             {^$} {
+                 pass "successfully compiled posix threads test case"
+                 set built_binfile 1
+                 break
+             }
+         }
+     }
+     if {$built_binfile == "0"} {
+         unsupported "Couldn't compile $source: ${why_msg}"
+         return -1
+     }
+ }
+ 
  proc send_gdb { string } {
      global suppress_flag;
      if { $suppress_flag } {


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

* Re: [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilation  code
  2002-08-20 14:34 [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilation code Jim Blandy
@ 2002-08-22 14:32 ` Michael Snyder
  2002-08-22 14:53   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2002-08-22 14:32 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Fernando Nasser, Michael Snyder, gdb-patches

Jim Blandy wrote:
> 
> Any comments on this?

This is fine with me, if it's ok with the testsuite maintainer.
[Fernando: just say 'yes'.  ;-)]


> Subject: RFA: abstract out thread compilation code
> Date: Thu, 13 Jun 2002 12:42:06 -0500 (EST)
> From: Jim Blandy <jimb@redhat.com>
> To: gdb-patches@sources.redhat.com
> 
> 2002-06-13  Jim Blandy  <jimb@redhat.com>
> 
>         * gdb.threads/pthreads.exp: Move the portable thread compilation
>         code into a function in lib/gdb.exp, and call that from here.
>         * lib/gdb.exp (gdb_compile_pthreads): New function.
> 
> Index: gdb/testsuite/gdb.threads/pthreads.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthreads.exp,v
> retrieving revision 1.7
> diff -c -r1.7 pthreads.exp
> *** gdb/testsuite/gdb.threads/pthreads.exp      1 Oct 2001 20:36:48 -0000       1.7
> --- gdb/testsuite/gdb.threads/pthreads.exp      13 Jun 2002 17:39:46 -0000
> ***************
> *** 39,80 ****
>   # carriage return)
>   set horiz "\[^\n\r\]*"
> 
> - set built_binfile 0
>   if [istarget "*-*-linux"] then {
>       set target_cflags "-D_MIT_POSIX_THREADS"
>   } else {
>       set target_cflags ""
>   }
> ! set why_msg "unrecognized error"
> ! foreach lib {-lpthreads -lpthread -lthread} {
> !     set options "debug"
> !     lappend options "incdir=${objdir}/${subdir}"
> !     lappend options "libs=$lib"
> !     set ccout [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options]
> !     switch -regexp -- $ccout {
> !       ".*no posix threads support.*" {
> !           set why_msg "missing threads include file"
> !           break
> !       }
> !       ".*cannot open -lpthread.*" {
> !           set why_msg "missing runtime threads library"
> !       }
> !       ".*Can't find library for -lpthread.*" {
> !           set why_msg "missing runtime threads library"
> !       }
> !       {^$} {
> !           pass "successfully compiled posix threads test case"
> !           set built_binfile 1
> !           break
> !       }
> !     }
> ! }
> ! if {$built_binfile == "0"} {
> !     unsupported "Couldn't compile ${srcfile}, ${why_msg}"
> !     return -1
>   }
> 
> - # Now we can proceed with the real testing.
> 
>   # Start with a fresh gdb.
> 
> --- 39,54 ----
>   # carriage return)
>   set horiz "\[^\n\r\]*"
> 
>   if [istarget "*-*-linux"] then {
>       set target_cflags "-D_MIT_POSIX_THREADS"
>   } else {
>       set target_cflags ""
>   }
> !
> ! if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}/${subdir}"]] != "" } {
> !     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
>   }
> 
> 
>   # Start with a fresh gdb.
> 
> Index: gdb/testsuite/lib/gdb.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.20
> diff -c -r1.20 gdb.exp
> *** gdb/testsuite/lib/gdb.exp   11 Jun 2002 20:37:05 -0000      1.20
> --- gdb/testsuite/lib/gdb.exp   13 Jun 2002 17:39:46 -0000
> ***************
> *** 1171,1176 ****
> --- 1171,1212 ----
>       return $result;
>   }
> 
> +
> + # This is just like gdb_compile, above, except that it tries compiling
> + # against several different thread libraries, to see which one this
> + # system has.
> + proc gdb_compile_pthreads {source dest type options} {
> +     set build_binfile 0
> +     set why_msg "unrecognized error"
> +     foreach lib {-lpthreads -lpthread -lthread} {
> +         # This kind of wipes out whatever libs the caller may have
> +         # set.  Or maybe theirs will override ours.  How infelicitous.
> +         set options_with_lib [concat $options [list libs=$lib]]
> +         set ccout [gdb_compile $source $dest $type $options_with_lib]
> +         switch -regexp -- $ccout {
> +             ".*no posix threads support.*" {
> +                 set why_msg "missing threads include file"
> +                 break
> +             }
> +             ".*cannot open -lpthread.*" {
> +                 set why_msg "missing runtime threads library"
> +             }
> +             ".*Can't find library for -lpthread.*" {
> +                 set why_msg "missing runtime threads library"
> +             }
> +             {^$} {
> +                 pass "successfully compiled posix threads test case"
> +                 set built_binfile 1
> +                 break
> +             }
> +         }
> +     }
> +     if {$built_binfile == "0"} {
> +         unsupported "Couldn't compile $source: ${why_msg}"
> +         return -1
> +     }
> + }
> +
>   proc send_gdb { string } {
>       global suppress_flag;
>       if { $suppress_flag } {


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

* Re: [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilation code
  2002-08-22 14:32 ` Michael Snyder
@ 2002-08-22 14:53   ` Andrew Cagney
  2002-08-22 15:19     ` [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilationcode Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-08-22 14:53 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Jim Blandy, Fernando Nasser, Michael Snyder, gdb-patches

> Jim Blandy wrote:
> 
>> 
>> Any comments on this?
> 
> 
> This is fine with me, if it's ok with the testsuite maintainer.
> [Fernando: just say 'yes'.  ;-)]

But Michael, you _are_ the (threads) testsuite maintainer! :-)

Andrew



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

* Re: [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread  compilationcode
  2002-08-22 14:53   ` Andrew Cagney
@ 2002-08-22 15:19     ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2002-08-22 15:19 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Jim Blandy, Fernando Nasser, Michael Snyder, gdb-patches

Andrew Cagney wrote:
> 
> > Jim Blandy wrote:
> >
> >>
> >> Any comments on this?
> >
> >
> > This is fine with me, if it's ok with the testsuite maintainer.
> > [Fernando: just say 'yes'.  ;-)]
> 
> But Michael, you _are_ the (threads) testsuite maintainer! :-)

Yeah, but this touches gdb.exp.  Oh well, all right --
donning my hat of infinite wisdom and authority, 
the patch is approved.   ;-)


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

end of thread, other threads:[~2002-08-22 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 14:34 [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilation code Jim Blandy
2002-08-22 14:32 ` Michael Snyder
2002-08-22 14:53   ` Andrew Cagney
2002-08-22 15:19     ` [Jim Blandy <jimb@redhat.com>] RFA: abstract out thread compilationcode Michael Snyder

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