[PUSHED] Remove useless gcore command detection (was: Re: [patch+7.8?] Fix 'gcore' with exited threads)
Commit Message
On 08/17/2014 10:16 PM, Jan Kratochvil wrote:
>>> > > +gdb_test_multiple "help gcore" "help gcore" {
>>> > > + -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
>> >
>> > Is this coming from copy/paste of existing tests?
> Yes.
>
>
>> > I believe this is is stale -- gcore.o has been in COMMON_OBS for a while
>> > now. I think the actual error will be whatever the default for the target
>> > method throws.
> Likewise two paragraphs above. Not sure what I should do with it:
> * If I remove the test from this my testcase and someone later fixes
> the 6 existing instances of this test this only test will remain unfixed.
> * If I waste the time reading the sources what should be the expected output
> I risk the test will not work anyway as I read it wrongly.
> And I will probably wrongly modify 6 other testsuite cases.
> * I can try to find a platform without gcore but in most cases in the past my
> attempts to build GDB on any non-Linux platforms failed.
No no, you misunderstand, we should just delete it completely.
It's a useless test. See patch below.
If we happened to still need it, then the right solution would be to factor
out all those 6 instances into a procedure in gdb.exp that test call
('supports_gcore' or some such), so we only had a single place to maintain,
instead of piling on more.
> I find this problem generally out of the scope of this mail thread / patch.
It's not out of scope as the new test was adding copy/pasted useless code.
I've pushed the patch below.
---------
[PATCH] Remove useless gcore command detection
Checking whether the gcore command is included in the GDB build as
proxy for checking whether core dumping is supported by the target is
useless, as gcore.o has been in COMMON_OBS since git 9b4eba8e:
2009-10-26 Michael Snyder <msnyder@vmware.com>
Hui Zhu <teawater@gmail.com>
* Makefile.in (SFILES): Add gcore.c.
(COMMON_OBS): Add gcore.o.
* config/alpha/alpha-linux.mh (NATDEPFILES): Delete gcore.o.
* config/alpha/fbsd.mh (NATDEPFILES): Ditto.
...
IOW, the command is always included in the build.
Instead, nowadays, tests bail out if actually trying to generate a
core fails with an indication the target doesn't support it. See
gdb_gcore_cmd and callers.
Tested on x86_64 Fedora 20.
gdb/testsuite/ChangeLog:
* gdb.base/gcore-buffer-overflow.exp: Remove "help gcore" test.
* gdb.base/gcore-relro-pie.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp: Likewise.
* gdb.base/print-symbol-loading.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
* lib/gdb.exp (gdb_gcore_cmd): Don't expect "Undefined command".
---
gdb/testsuite/ChangeLog | 10 ++++++++++
gdb/testsuite/gdb.base/gcore-buffer-overflow.exp | 12 ------------
gdb/testsuite/gdb.base/gcore-relro-pie.exp | 13 -------------
gdb/testsuite/gdb.base/gcore-relro.exp | 13 -------------
gdb/testsuite/gdb.base/gcore.exp | 12 ------------
gdb/testsuite/gdb.base/print-symbol-loading.exp | 13 -------------
gdb/testsuite/gdb.threads/gcore-thread.exp | 11 -----------
gdb/testsuite/lib/gdb.exp | 6 ------
8 files changed, 10 insertions(+), 80 deletions(-)
Comments
On Thu, 21 Aug 2014 12:41:12 +0200, Pedro Alves wrote:
> On 08/17/2014 10:16 PM, Jan Kratochvil wrote:
> >> > I believe this is is stale -- gcore.o has been in COMMON_OBS for a while
> >> > now. I think the actual error will be whatever the default for the target
> >> > method throws.
> > Likewise two paragraphs above. Not sure what I should do with it:
> > * If I remove the test from this my testcase and someone later fixes
> > the 6 existing instances of this test this only test will remain unfixed.
> > * If I waste the time reading the sources what should be the expected output
> > I risk the test will not work anyway as I read it wrongly.
> > And I will probably wrongly modify 6 other testsuite cases.
> > * I can try to find a platform without gcore but in most cases in the past my
> > attempts to build GDB on any non-Linux platforms failed.
>
> No no, you misunderstand, we should just delete it completely.
> It's a useless test. See patch below.
I understood it perfectly. I just did not want to invest time into writing
the off-topic patch and writing its ChangeLog for the patch you wrote below.
It is now solved and I can remove the gcore test also from my patch, thanks.
Jan
@@ -1,3 +1,13 @@
+2014-08-21 Pedro Alves <palves@redhat.com>
+
+ * gdb.base/gcore-buffer-overflow.exp: Remove "help gcore" test.
+ * gdb.base/gcore-relro-pie.exp: Likewise.
+ * gdb.base/gcore-relro.exp: Likewise.
+ * gdb.base/gcore.exp: Likewise.
+ * gdb.base/print-symbol-loading.exp: Likewise.
+ * gdb.threads/gcore-thread.exp: Likewise.
+ * lib/gdb.exp (gdb_gcore_cmd): Don't expect "Undefined command".
+
2014-08-20 Pedro Alves <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
@@ -31,18 +31,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
clean_restart ${binfile}
-# Does this gdb support gcore?
-gdb_test_multiple "help gcore" "help gcore" {
- -re "Undefined command: .gcore.*$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*$gdb_prompt $" {
- pass "help gcore"
- }
-}
-
gdb_test_no_output "set args ${pattern}" \
"Set buffer exceeding arguments"
@@ -39,19 +39,6 @@ file attributes ${stripped_binfile} -permissions $perm
clean_restart ${stripped_binfile}
-# Does this gdb support gcore?
-set test "help gcore"
-gdb_test_multiple $test $test {
- -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*\r\n$gdb_prompt $" {
- pass $test
- }
-}
-
# The binary is stripped of debug info, but not minsyms.
if ![runto break_here] {
fail "Can't run to break_here"
@@ -38,19 +38,6 @@ set objfile [standard_output_file ${testfile}.o]
clean_restart ${binfile}
gdb_load_shlibs ${binfile_lib}
-# Does this gdb support gcore?
-set test "help gcore"
-gdb_test_multiple $test $test {
- -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*\r\n$gdb_prompt $" {
- pass $test
- }
-}
-
if ![runto lib] {
return -1
}
@@ -24,18 +24,6 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
-# Does this gdb support gcore?
-gdb_test_multiple "help gcore" "help gcore" {
- -re "Undefined command: .gcore.*$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*$gdb_prompt $" {
- pass "help gcore"
- }
-}
-
if { ! [ runto_main ] } then {
untested gcore.exp
return -1
@@ -40,19 +40,6 @@ if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
clean_restart ${binfile}
gdb_load_shlibs ${binfile_lib}
-# Does this gdb support gcore?
-set test "help gcore"
-gdb_test_multiple $test $test {
- -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*\r\n$gdb_prompt $" {
- pass $test
- }
-}
-
if ![runto lib] {
return -1
}
@@ -55,17 +55,6 @@ set nl "\[\r\n\]+"
set timeout 30
-gdb_test_multiple "help gcore" "help gcore" {
- -re "Undefined command: .gcore.*$gdb_prompt $" {
- # gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1
- }
- -re "Save a core file .*$gdb_prompt $" {
- pass "help gcore"
- }
-}
-
if { ! [ runto_main ] } then {
untested gcore-thread.exp
return -1
@@ -3401,12 +3401,6 @@ proc gdb_gcore_cmd {core test} {
pass $test
set result 1
}
-
- -re "Undefined command.*$gdb_prompt $" {
- unsupported $test
- verbose -log "'gcore' command undefined in gdb_gcore_cmd"
- }
-
-re "(?:Can't create a corefile|Target does not support core file generation\\.)\[\r\n\]+$gdb_prompt $" {
unsupported $test
}