diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2020-05-23 14:54:31 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2020-06-21 12:48:18 +0200 |
commit | 48e9cc84058771da089a2e8e652f70ac20a8fac0 (patch) | |
tree | ab910f5040d0a5df7b43afa317c31cc9f0bcd5b9 /gdb/testsuite/gdb.base/attach2.c | |
parent | 160f8a8f32f5566077e4a4b13943bc7c70bc5da2 (diff) | |
download | gdb-48e9cc84058771da089a2e8e652f70ac20a8fac0.zip gdb-48e9cc84058771da089a2e8e652f70ac20a8fac0.tar.gz gdb-48e9cc84058771da089a2e8e652f70ac20a8fac0.tar.bz2 |
Ensure 'exec-file has changed' check has priority over 'exec-file-mismatch' check
Following the implementation of exec-file-mismatch based on build-id,
an attach to a process that runs a modified exec-file was triggering
the exec-file-mismatch handling, giving a warning such as:
warning: Mismatch between current exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
and automatically determined exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
exec-file-mismatch handling is currently "ask"
as the build-ids differ when an exec-file is recompiled.
This patch ensures that the exec-file-mismatch check is done with an up to date
build-id. With this, exec-file-mismatch check will only trigger when the
PID file really differs from the (build-id refreshed) current exec-file.
Note that the additional check does not (yet) reload the symbols if
the exec-file is changed: this reload will happen later if needed.
gdb/ChangeLog
2020-06-21 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* exec.c (validate_exec_file): Ensure the build-id is up to
date by calling reopen_exec_file (that checks file timestamp
to decide to re-read the file).
gdb/testsuite/ChangeLog
2020-06-21 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/attach.exp: Test priority of 'exec-file' changed
over 'exec-file-mismatch'.
* gdb.base/attach.c: Mark should_exit volatile.
* gdb.base/attach2.c: Likewise. Add a comment explaining
why the sleep cannot be big.
* gdb.base/attach3.c: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/attach2.c')
-rw-r--r-- | gdb/testsuite/gdb.base/attach2.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/attach2.c b/gdb/testsuite/gdb.base/attach2.c index 44d3725..d070d93 100644 --- a/gdb/testsuite/gdb.base/attach2.c +++ b/gdb/testsuite/gdb.base/attach2.c @@ -9,12 +9,14 @@ #include <unistd.h> float bidule = 0.0; -int should_exit = 0; +volatile int should_exit = 0; int main () { int local_i = 0; + /* Cannot sleep a very long time, as attach.exp assumes the + process will exit before the standard GDB timeout. */ sleep( 10 ); /* System call causes register fetch to fail */ /* This is a known HPUX "feature" */ while (! should_exit) |