This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix logic in exec_file_locate_attach
- From: Pedro Alves <palves at redhat dot com>
- To: Gary Benson <gbenson at redhat dot com>, gdb-patches at sourceware dot org
- Cc: Luis Machado <lgustavo at codesourcery dot com>
- Date: Thu, 18 Feb 2016 17:28:40 +0000
- Subject: Re: [PATCH] Fix logic in exec_file_locate_attach
- Authentication-results: sourceware.org; auth=none
- References: <56BDF92B dot 50107 at redhat dot com> <1455815129-14795-1-git-send-email-gbenson at redhat dot com>
On 02/18/2016 05:05 PM, Gary Benson wrote:
>
> * exec.c (exec_file_locate_attach): Throw error if
> exec_file_find fails to locate the main executable.
This goes back to:
https://sourceware.org/ml/gdb-patches/2016-02/msg00413.html
Why is this an error, that even makes us stop the attach process
halfway, if the case when we don't know the file name is completely
silent? :
void
exec_file_locate_attach (int pid, int from_tty)
{
...
/* Try to determine a filename from the process itself. */
exec_file = target_pid_to_exec_file (pid);
if (exec_file == NULL)
return;
> +
> +set test_spawn_id [spawn_wait_for_attach $binfile]
> +set testpid [spawn_id_get_pid $test_spawn_id]
> +
> +set outdir [make_gdb_parallel_path outputs $subdir $testfile]
> +set sysroot ${outdir}/does-not-exist
> +
> +gdb_start
> +gdb_test_no_output "set sysroot $sysroot"
Does this "$sysroot" expand to an absolute path? If so,
the test message depends on where in the filesystem you
happen to run the testsuite. So this needs an explicit
test message, or maybe simply:
gdb_test_no_output "set sysroot /dev/null"
> +gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or directory\\."
> +
> +kill_wait_spawned_process $test_spawn_id
>
Thanks,
Pedro Alves