Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases
@ 2012-03-16 14:29 Siddhesh Poyarekar
  2012-03-16 15:50 ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Siddhesh Poyarekar @ 2012-03-16 14:29 UTC (permalink / raw)
  To: gdb-patches

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

Hi,

The auxv test case gives a test case failure when ulimit -c is 0. I
have added a check to disable the test if ulimit is 0. Further, the
cond-eval-mode test looks for the wrong message, again resulting in a
spurious test failure.

Regards,
Siddhesh

testsuite/ChangeLog:

2012-03-16  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* gdb.base/auxv.exp: Disable corefile checks if ulimit-c is 0.
	* gdb.base/cond-eval-mode.exp: Fix the anticipated warning
	string

[-- Attachment #2: fix-test-cases.patch --]
[-- Type: text/plain, Size: 2154 bytes --]

diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index da10f05..e1b8cb0 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -42,8 +42,19 @@ set coredir "${objdir}/${subdir}/coredir.[getpid]"
 file mkdir $coredir
 set core_works [expr [isnative] && ! [is_remote target]]
 
-# Run GDB on the test program up to where it will dump core.
+global gdb_prompt
+
+gdb_exit
+gdb_start
+send_gdb "shell ulimit -c\n"
+gdb_expect {
+    -re "0\r\n$gdb_prompt $" {
+        warning "ulimit -c is 0, disabling core tests"
+        set core_works 0
+    }
+}
 
+# Run GDB on the test program up to where it will dump core.
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
@@ -51,11 +62,9 @@ gdb_load ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 gdb_test_no_output "set width 0"
 
-if {$core_works} {
-    if {[gdb_test "cd $coredir" ".*Working directory .*" \
-	     "cd to temporary directory for core dumps"]} {
-	set core_works 0
-    }
+if {[gdb_test "cd $coredir" ".*Working directory .*" \
+         "cd to temporary directory for core dumps"]} {
+    set core_works 0
 }
 
 if { ![runto_main] } then {
@@ -154,7 +163,7 @@ if {$core_works} {
 	pass $test
     } else {
 	set core_works 0
-	warning "can't generate a core file - core tests suppressed - check ulimit -c"
+	warning "can't generate a core file - core tests suppressed"
 	fail $test
     }
 } else {
diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp
index dbbfc28..965c497 100644
--- a/gdb/testsuite/gdb.base/cond-eval-mode.exp
+++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp
@@ -30,7 +30,7 @@ gdb_test_no_output $test_auto
 
 # If target-side condition evaluation is not supported, this warning will be
 # displayed.
-set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing GDB evaluation mode instead.\r\n"
+set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead.\r\n"
 
 gdb_test_multiple $test_target $test_target {
     -re "$warning$gdb_prompt $" {
-- 
1.7.7.4


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

* Re: [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases
  2012-03-16 14:29 [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases Siddhesh Poyarekar
@ 2012-03-16 15:50 ` Pedro Alves
  2012-03-17  7:27   ` Siddhesh Poyarekar
  2012-03-17  7:37   ` [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp Siddhesh Poyarekar
  0 siblings, 2 replies; 10+ messages in thread
From: Pedro Alves @ 2012-03-16 15:50 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

On 03/16/2012 02:30 PM, Siddhesh Poyarekar wrote:

...

> Further, the
> cond-eval-mode test looks for the wrong message, again resulting in a
> spurious test failure.


...

> 2012-03-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
> 
...


> 	* gdb.base/cond-eval-mode.exp: Fix the anticipated warning
> 	string


Please always send separate logical changes as separate emails, each with
its own subject line, description and patch.  This part is obvious and
could have gone in immediately.

-- 
Pedro Alves


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

* Re: [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases
  2012-03-16 15:50 ` Pedro Alves
@ 2012-03-17  7:27   ` Siddhesh Poyarekar
  2012-03-19  9:35     ` [commit] " Jan Kratochvil
  2012-03-17  7:37   ` [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp Siddhesh Poyarekar
  1 sibling, 1 reply; 10+ messages in thread
From: Siddhesh Poyarekar @ 2012-03-17  7:27 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

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

On Fri, Mar 16, 2012 at 03:50:18PM +0000, Pedro Alves wrote:
> > 	* gdb.base/cond-eval-mode.exp: Fix the anticipated warning
> > 	string
> 
> 
> Please always send separate logical changes as separate emails, each with
> its own subject line, description and patch.  This part is obvious and
> could have gone in immediately.
> 

I have attached the cond-eval-mode.exp change here. I'll send another
email for the ulimit change.

--
Siddhesh


testsuite/ChangeLog:

2012-03-16  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* gdb.base/cond-eval-mode.exp: Fix the anticipated warning
	string

[-- Attachment #2: fix-test-cases.patch --]
[-- Type: text/plain, Size: 711 bytes --]

diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp
index dbbfc28..965c497 100644
--- a/gdb/testsuite/gdb.base/cond-eval-mode.exp
+++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp
@@ -30,7 +30,7 @@ gdb_test_no_output $test_auto
 
 # If target-side condition evaluation is not supported, this warning will be
 # displayed.
-set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing GDB evaluation mode instead.\r\n"
+set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead.\r\n"
 
 gdb_test_multiple $test_target $test_target {
     -re "$warning$gdb_prompt $" {
-- 
1.7.7.4


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

* [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-16 15:50 ` Pedro Alves
  2012-03-17  7:27   ` Siddhesh Poyarekar
@ 2012-03-17  7:37   ` Siddhesh Poyarekar
  2012-03-19  9:43     ` Jan Kratochvil
  1 sibling, 1 reply; 10+ messages in thread
From: Siddhesh Poyarekar @ 2012-03-17  7:37 UTC (permalink / raw)
  To: gdb-patches

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

Hi,

The auxv test case gives a test case failure when ulimit -c is 0. I
have added a check to disable the test if ulimit is 0.

Regards,
Siddhesh

testsuite/ChangeLog:

2012-03-16  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* gdb.base/auxv.exp: Disable corefile checks if ulimit-c is 0.

[-- Attachment #2: fix-test-cases-2.patch --]
[-- Type: text/plain, Size: 1443 bytes --]

diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index da10f05..e1b8cb0 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -42,8 +42,19 @@ set coredir "${objdir}/${subdir}/coredir.[getpid]"
 file mkdir $coredir
 set core_works [expr [isnative] && ! [is_remote target]]
 
-# Run GDB on the test program up to where it will dump core.
+global gdb_prompt
+
+gdb_exit
+gdb_start
+send_gdb "shell ulimit -c\n"
+gdb_expect {
+    -re "0\r\n$gdb_prompt $" {
+        warning "ulimit -c is 0, disabling core tests"
+        set core_works 0
+    }
+}
 
+# Run GDB on the test program up to where it will dump core.
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
@@ -51,11 +62,9 @@ gdb_load ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 gdb_test_no_output "set width 0"
 
-if {$core_works} {
-    if {[gdb_test "cd $coredir" ".*Working directory .*" \
-	     "cd to temporary directory for core dumps"]} {
-	set core_works 0
-    }
+if {[gdb_test "cd $coredir" ".*Working directory .*" \
+         "cd to temporary directory for core dumps"]} {
+    set core_works 0
 }
 
 if { ![runto_main] } then {
@@ -154,7 +163,7 @@ if {$core_works} {
 	pass $test
     } else {
 	set core_works 0
-	warning "can't generate a core file - core tests suppressed - check ulimit -c"
+	warning "can't generate a core file - core tests suppressed"
 	fail $test
     }
 } else {

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

* [commit] [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases
  2012-03-17  7:27   ` Siddhesh Poyarekar
@ 2012-03-19  9:35     ` Jan Kratochvil
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2012-03-19  9:35 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: Pedro Alves, gdb-patches

On Sat, 17 Mar 2012 08:28:45 +0100, Siddhesh Poyarekar wrote:
> 2012-03-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
> 
> 	* gdb.base/cond-eval-mode.exp: Fix the anticipated warning
> 	string

Checked it in:
	http://sourceware.org/ml/gdb-cvs/2012-03/msg00231.html


Thanks,
Jan


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

* Re: [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-17  7:37   ` [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp Siddhesh Poyarekar
@ 2012-03-19  9:43     ` Jan Kratochvil
  2012-03-19 15:57       ` Siddhesh Poyarekar
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2012-03-19  9:43 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

On Sat, 17 Mar 2012 08:37:58 +0100, Siddhesh Poyarekar wrote:
> @@ -42,8 +42,19 @@ set coredir "${objdir}/${subdir}/coredir.[getpid]"
>  file mkdir $coredir
>  set core_works [expr [isnative] && ! [is_remote target]]
>  
> -# Run GDB on the test program up to where it will dump core.
> +global gdb_prompt

Such "global" is not needed when it is at the file level.


> +gdb_exit
> +gdb_start
> +send_gdb "shell ulimit -c\n"
> +gdb_expect {
> +    -re "0\r\n$gdb_prompt $" {
> +        warning "ulimit -c is 0, disabling core tests"
> +        set core_works 0
> +    }
> +}

Other testcases try to set 'ulimit -c 0' first, this only testcase does not.
That should be fixed.

Also dealing with ulimit should be limited to the case where $core_works
- that means only for local native runs.  In such case one could also just run
'ulimit' by TCL, not by GDB 'shell'.

And as 'ulimit -c unlimited' in this case would be complicated - or at least
ot well compatible across platforms, there should be IMO setrlimit in the .c
file instead.  It should be protected by #ifdef and the compilation should be
tried with and without it, as I guess setrlimit is also not well compatible
across platforms.


> +# Run GDB on the test program up to where it will dump core.
>  gdb_exit
>  gdb_start
>  gdb_reinitialize_dir $srcdir/$subdir
> @@ -51,11 +62,9 @@ gdb_load ${binfile}
>  gdb_test_no_output "set print sevenbit-strings"
>  gdb_test_no_output "set width 0"
>  
> -if {$core_works} {
> -    if {[gdb_test "cd $coredir" ".*Working directory .*" \
> -	     "cd to temporary directory for core dumps"]} {
> -	set core_works 0
> -    }
> +if {[gdb_test "cd $coredir" ".*Working directory .*" \
> +         "cd to temporary directory for core dumps"]} {
> +    set core_works 0
>  }

I do not see a reason for this change.


>  if { ![runto_main] } then {
> @@ -154,7 +163,7 @@ if {$core_works} {
>  	pass $test
>      } else {
>  	set core_works 0
> -	warning "can't generate a core file - core tests suppressed - check ulimit -c"
> +	warning "can't generate a core file - core tests suppressed"
>  	fail $test

With the suggested 'ulimit -c unlimited' change to match other testcases
I think this change should be dropped.


>      }
>  } else {



Thanks,
Jan


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

* Re: [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-19  9:43     ` Jan Kratochvil
@ 2012-03-19 15:57       ` Siddhesh Poyarekar
  2012-03-19 16:13         ` Jan Kratochvil
  0 siblings, 1 reply; 10+ messages in thread
From: Siddhesh Poyarekar @ 2012-03-19 15:57 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

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

On Mon, Mar 19, 2012 at 10:42:18AM +0100, Jan Kratochvil wrote:
> And as 'ulimit -c unlimited' in this case would be complicated - or at least
> ot well compatible across platforms, there should be IMO setrlimit in the .c
> file instead.  It should be protected by #ifdef and the compilation should be
> tried with and without it, as I guess setrlimit is also not well compatible
> across platforms.
> 

Thanks for your review. I have redone this fix according to your
suggestion, by implementing setrlimit in the code. To check whether
setrlimit and sys/resource.h exist, I added an auto-header feature to
the testsuite configure script and got it to generate lib/config.h
with the necessary #defines, which auxv.c now uses. This should be
usable across other test cases too.

Updated patch attached.

Regards,
Siddhesh

testsuite/ChangeLog:

2012-03-19  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* Makefile.in: Add abs_builddir to CFLAGS_FOR_TARGET in
	site.exp.
	* configure.ac: Add check for setrlimit and sys/resource.h.
	Generate config.h for test cases to use.
	* gdb.base/auxv.c: Include config.h.
	(func2): setrlimit to infinity to enable core dumps.
	* configure: Regenerate.
	* lib/config.in: New file autogenerated by autoheader-2.64

[-- Attachment #2: 0001-Fix-test-case-failure-for-core-dumps.patch --]
[-- Type: text/plain, Size: 17112 bytes --]

diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index b06c382..b2e3900 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -119,6 +119,7 @@ $(abs_builddir)/site.exp site.exp: ./config.status Makefile
 	@echo "set target_triplet ${target_canonical}" >> ./tmp0
 	@echo "set build_triplet ${build_canonical}" >> ./tmp0
 	@echo "set srcdir ${srcdir}" >> ./tmp0
+	@echo "set CFLAGS_FOR_TARGET \"-I${abs_builddir}/lib\"" >> ./tmp0
 	@echo "set tool gdb" >> ./tmp0
 	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
 		@cat ./tmp0 > site.exp
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index fb70b3d..1527c22 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -1613,6 +1613,119 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -2211,6 +2324,9 @@ $as_echo "no" >&6; }
 fi
 
 
+ac_config_headers="$ac_config_headers lib/config.h:lib/config.in"
+
+
 # Enable gdbtk.
 # Check whether --enable-gdbtk was given.
 if test "${enable_gdbtk+set}" = set; then :
@@ -3433,18 +3549,31 @@ fi
 done
 
 
-for ac_header in pthread.h
+for ac_header in pthread.h sys/resource.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
-if test "x$ac_cv_header_pthread_h" = x""yes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
+for ac_func in setrlimit
+do :
+  ac_fn_c_check_func "$LINENO" "setrlimit" "ac_cv_func_setrlimit"
+if test "x$ac_cv_func_setrlimit" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SETRLIMIT 1
+_ACEOF
+
+fi
+done
+
 
 
 
@@ -3529,43 +3658,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section.  Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
-	g
-	s/^\n//
-	s/\n/ /g
-	p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
+DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
@@ -4013,11 +4106,15 @@ case $ac_config_files in *"
 "*) set x $ac_config_files; shift; ac_config_files=$*;;
 esac
 
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
 
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
+config_headers="$ac_config_headers"
 
 _ACEOF
 
@@ -4037,10 +4134,15 @@ Usage: $0 [OPTION]... [TAG]...
       --recheck    update $as_me by reconfiguring in the same conditions
       --file=FILE[:TEMPLATE]
                    instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
 
 Configuration files:
 $config_files
 
+Configuration headers:
+$config_headers
+
 Report bugs to the package provider."
 
 _ACEOF
@@ -4092,7 +4194,18 @@ do
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
-  --he | --h |  --help | --hel | -h )
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -4148,6 +4261,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
+    "lib/config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/config.h:lib/config.in" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "gdb.ada/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.ada/Makefile" ;;
     "gdb.arch/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.arch/Makefile" ;;
@@ -4192,6 +4306,7 @@ done
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
   test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
@@ -4369,8 +4484,116 @@ fi
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
 
-eval set X "  :F $CONFIG_FILES      "
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    "
 shift
 for ac_tag
 do
@@ -4577,7 +4800,30 @@ which seems to be undefined.  Please make sure it is defined." >&2;}
   esac \
   || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
-
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error "could not create -" "$LINENO" 5
+  fi
+ ;;
 
 
   esac
diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac
index 5735805..207ac98 100644
--- a/gdb/testsuite/configure.ac
+++ b/gdb/testsuite/configure.ac
@@ -36,6 +36,8 @@ esac
 AM_CONDITIONAL(GMAKE, test "$MAKE_IS_GNU" = yes)
 AC_PROG_MAKE_SET
 
+AC_CONFIG_HEADER(lib/config.h:lib/config.in)
+
 # Enable gdbtk.
 AC_ARG_ENABLE(gdbtk,
 [  --enable-gtk            enable gdbtk graphical user interface (GUI)],,
@@ -83,7 +85,8 @@ else
 fi
 AC_SUBST(RPATH_ENVVAR)
 
-AC_CHECK_HEADERS(pthread.h)
+AC_CHECK_HEADERS([pthread.h sys/resource.h])
+AC_CHECK_FUNCS(setrlimit)
 
 AC_EXEEXT
 
diff --git a/gdb/testsuite/gdb.base/auxv.c b/gdb/testsuite/gdb.base/auxv.c
index ed5f2b6..db8b403 100644
--- a/gdb/testsuite/gdb.base/auxv.c
+++ b/gdb/testsuite/gdb.base/auxv.c
@@ -28,6 +28,8 @@
 #define HAVE_ABORT 1
 #endif
 
+#include <config.h>
+
 #if HAVE_ABORT
 #include <stdlib.h>
 #define ABORT abort()
@@ -35,6 +37,14 @@
 #define ABORT {char *invalid = 0; *invalid = 0xFF;}
 #endif
 
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#ifndef RLIM_INFINITY
+# define RLIM_INFINITY -1
+#endif
+
 /* Don't make these automatic vars or we will have to walk back up the
    stack to access them. */
 
@@ -53,6 +63,11 @@ func2 (int x)
   int i;
   static int y;
 
+#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_CORE)
+  struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
+  setrlimit (RLIMIT_CORE, &rlim);
+#endif
+
   /* Make sure that coremaker_local doesn't get optimized away. */
   for (i = 0; i < 5; i++)
     coremaker_local[i] = i;
diff --git a/gdb/testsuite/lib/config.in b/gdb/testsuite/lib/config.in
new file mode 100644
index 0000000..7171d57
--- /dev/null
+++ b/gdb/testsuite/lib/config.in
@@ -0,0 +1,58 @@
+/* lib/config.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if you have the `setrlimit' function. */
+#undef HAVE_SETRLIMIT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
-- 
1.7.7.4


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

* Re: [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-19 15:57       ` Siddhesh Poyarekar
@ 2012-03-19 16:13         ` Jan Kratochvil
  2012-03-19 16:39           ` Siddhesh Poyarekar
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kratochvil @ 2012-03-19 16:13 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

On Mon, 19 Mar 2012 16:57:31 +0100, Siddhesh Poyarekar wrote:
> To check whether setrlimit and sys/resource.h exist, I added an auto-header
> feature to the testsuite configure script

Sorry but there are IIRC rather plans to remove the testsuite configure script
at all.  I also find your solution too heavyweight.

I hope you find this simplified patch sufficient enough.


Thanks,
Jan


2012-03-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Siddhesh Poyarekar  <siddhesh@redhat.com>

	* gdb.base/auxv.c (func2): setrlimit to infinity to enable core dumps.
	* gdb.base/auxv.exp: Try to compile it with -DUSE_RLIMIT first.
	(generate native core dump): Make the test unsupported if core cannot
	be generated.

--- a/gdb/testsuite/gdb.base/auxv.c
+++ b/gdb/testsuite/gdb.base/auxv.c
@@ -35,6 +35,13 @@
 #define ABORT {char *invalid = 0; *invalid = 0xFF;}
 #endif
 
+#ifdef USE_RLIMIT
+# include <sys/resource.h>
+# ifndef RLIM_INFINITY
+#  define RLIM_INFINITY -1
+# endif
+#endif /* USE_RLIMIT */
+
 /* Don't make these automatic vars or we will have to walk back up the
    stack to access them. */
 
@@ -53,6 +60,14 @@ func2 (int x)
   int i;
   static int y;
 
+#ifdef USE_RLIMIT
+  {
+    struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
+
+    setrlimit (RLIMIT_CORE, &rlim);
+  }
+#endif
+
   /* Make sure that coremaker_local doesn't get optimized away. */
   for (i = 0; i < 5; i++)
     coremaker_local[i] = i;
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -31,7 +31,10 @@ set binfile ${objdir}/${subdir}/${testfile}
 set corefile ${objdir}/${subdir}/${testfile}.corefile
 set gcorefile ${objdir}/${subdir}/${testfile}.gcore
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+		  {debug additional_flags=-DUSE_RLIMIT}] != ""
+     && [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+		  {debug}] != "" } {
     untested "couldn't compile ${srcdir}/${subdir}/${srcfile}"
     return -1
 }
@@ -155,7 +158,7 @@ if {$core_works} {
     } else {
 	set core_works 0
 	warning "can't generate a core file - core tests suppressed - check ulimit -c"
-	fail $test
+	unsupported $test
     }
 } else {
     unsupported $test


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

* Re: [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-19 16:13         ` Jan Kratochvil
@ 2012-03-19 16:39           ` Siddhesh Poyarekar
  2012-03-19 18:40             ` [commit] " Jan Kratochvil
  0 siblings, 1 reply; 10+ messages in thread
From: Siddhesh Poyarekar @ 2012-03-19 16:39 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Mon, Mar 19, 2012 at 05:13:24PM +0100, Jan Kratochvil wrote:
> On Mon, 19 Mar 2012 16:57:31 +0100, Siddhesh Poyarekar wrote:
> > To check whether setrlimit and sys/resource.h exist, I added an auto-header
> > feature to the testsuite configure script
> 
> Sorry but there are IIRC rather plans to remove the testsuite configure script
> at all.  I also find your solution too heavyweight.
> 
> I hope you find this simplified patch sufficient enough.
> 

That works perfectly, thanks!

--
Siddhesh


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

* [commit] [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp
  2012-03-19 16:39           ` Siddhesh Poyarekar
@ 2012-03-19 18:40             ` Jan Kratochvil
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2012-03-19 18:40 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

On Mon, 19 Mar 2012 17:39:48 +0100, Siddhesh Poyarekar wrote:
> On Mon, Mar 19, 2012 at 05:13:24PM +0100, Jan Kratochvil wrote:
> > I hope you find this simplified patch sufficient enough.
> 
> That works perfectly, thanks!

Checked it in, it is simple enough and it fixes a FAIL:
	http://sourceware.org/ml/gdb-cvs/2012-03/msg00237.html


Thanks,
Jan


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

end of thread, other threads:[~2012-03-19 18:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-16 14:29 [PATCH] Fix gdb.base/auxv and gdb.base/cond-eval-mode test cases Siddhesh Poyarekar
2012-03-16 15:50 ` Pedro Alves
2012-03-17  7:27   ` Siddhesh Poyarekar
2012-03-19  9:35     ` [commit] " Jan Kratochvil
2012-03-17  7:37   ` [PATCH] Fix core dump test case failure with a ulimit check in gdb.base/auxv.exp Siddhesh Poyarekar
2012-03-19  9:43     ` Jan Kratochvil
2012-03-19 15:57       ` Siddhesh Poyarekar
2012-03-19 16:13         ` Jan Kratochvil
2012-03-19 16:39           ` Siddhesh Poyarekar
2012-03-19 18:40             ` [commit] " Jan Kratochvil

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