RFC: refactor gcore checking in test suite

Pedro Alves palves@redhat.com
Tue Oct 30 17:33:00 GMT 2012


Looks fine to me, apart from:

On 10/30/2012 05:10 PM, Tom Tromey wrote:
> +# Invoke "gcore".  CORE is the name of the core file to write.  TEST
> +# is the name of the test case.  This will return 1 if the core file
> +# was created, 0 otherwise.

> If this fails to make a core file due to
> +# some error, it will call "unsupported", not "fail".

This comment made me a bit confused though.  It is not some random error that
results in unsupported.  It's the specific case of ending up in

static char *
exec_make_note_section (bfd *obfd, int *note_size)
{
  error (_("Can't create a corefile"));
}

which means, the current target has no support for generating core files
(as otherwise, target_make_note_section would be implemented by a target
higher up on the target stack, and this wouldn't be reached).

gdb_test_multiple has the catch-all that issues a fail:

	-re "\r\n$gdb_prompt $" {

and that is what I'd consider "due to some error", hence my confusion.

> +proc gdb_gcore_cmd {core test} {
> +    global gdb_prompt
> +
> +    set result 0
> +    gdb_test_multiple "gcore $core" $test {
> +
...
> +	eof {
> +	    # Catastrophe.
> +	    fail $test
> +	}

I understand this is preexisting, but I question its existence.
Maybe it got left behind in some send_gdb/gdb_expect -> gdb_test_multiple
conversion?  gdb_test_multiple already catches eof:

	eof {
	    perror "Process no longer exists"
	    if { $message != "" } {
		fail "$message"
	    }
	    return -1
	}

I think a follow-up could remove that.

-- 
Pedro Alves



More information about the Gdb-patches mailing list