diff options
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 4dfbf76c950..a16b0fa7fec 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1283,6 +1283,46 @@ proc gdb_compile_pthreads {source dest type options} { } } +# This is just like gdb_compile_pthreads, above, except that we always add the +# objc library for compiling Objective-C programs +proc gdb_compile_objc {source dest type options} { + set built_binfile 0 + set why_msg "unrecognized error" + foreach lib {-lobjc -lpthreads -lpthread -lthread solaris} { + # This kind of wipes out whatever libs the caller may have + # set. Or maybe theirs will override ours. How infelicitous. + if { $lib == "solaris" } { + set lib "-lpthread -lposix4" + } + if { $lib != "-lobjc" } { + set lib "-lobjc $lib" + } + set options_with_lib [concat $options [list libs=$lib quiet]] + 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 objc with posix threads test case" + set built_binfile 1 + break + } + } + } + if {!$built_binfile} { + unsupported "Couldn't compile $source: ${why_msg}" + return -1 + } +} + proc send_gdb { string } { global suppress_flag; if { $suppress_flag } { |