Re: exec-file-mismatch and native-gdbserver testing

Philippe Waroquiers
2020-04-08T20:54:20Z

On Wed, 2020-04-08 at 14:02 +0000, Metzger, Markus T via Gdb wrote:
> Hello,
>
> I noticed an issue when running tests that use standard_temp_file with the native-gdbserver board.
>
> In gdb_remote_download, when called without tofile argument, as it is, for example, when starting gdbserver via gdb_reload, we set the filename to standard_output_file [file tail $fromfile] and copy the file.
>
> GDB and gdbserver now use a copy of the same file at different locations.
>
> This triggers an exec-file-mismatch warning and, with the default “ask” setting, a user prompt that isn’t handled by the tests and eventually leads to a timeout. This can be seen with all tests that use gdb_simple_compile, e.g. via skip_*_test calls. An example would be gdb.btrace/*.exp.
>
> In exec.c:validate_exec_file (), we check the filenames and, if they differ, print a warning and re-load the symbol file.
>
> Should validate_exec_file () check more than just the filenames?
You mean: if the filenames differs, gdb could compare the contents of files and if equal,
not ask the question, considering there is no mismatch ?

> Should gdb_simple_compile use standard_output_file instead of standard_temp_file?

Alternatively, set the value of exec-file-mismatch to warn ?
The reason of this setting is to allow to disable this exec-file-mismatch
logic in case of "unusual" setup, and the above seems to qualify as an unusual setup.
During review, some argued that we might hardcode 'ask' (or even not ask, just
automatically reload). It looks like the setting might have its usefulness :).

Note that on this exec-file-mismatch functionality, we still have PR
https://sourceware.org/bugzilla/show_bug.cgi?id=25475
waiting for (some) feedback about the way to fix/improve

(this PR should better be fixed before the next release, as afterwards,
CLI behaviour is much more difficult to change).

Thanks

Philippe