forked from Imagelibrary/binutils-gdb
Modify gdb.base/attach.exp to test the behaviour of the option
exec-file-mismatch. Note that this test can also be run using/
make check RUNTESTFLAGS="--target_board=native-extended-gdbserver" TESTS=gdb.base/attach.exp
to test the behaviour of attaching to running program using a gdb server.
Note: when running the test with a gdbserver, the tests in
test_command_line_attach_run fail because the command "run" is not supported.
I tried to extend the condition
if ![isnative] then {
unsupported "commandline attach run test"
return 0
}
but unclear to me how to best do that. The below trials all failed
to work properly:
if { ![isnative] || [target_is_gdbserver] } then {
if { ![isnative] || [use_gdb_stub] } then {
if { ![isnative] || [is_remote target] } then {
=> could never obtain a condition that was true with gdbserver.
2020-01-25 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/attach.exp: Test 'set exec-file-mismatch'.
26 lines
665 B
C
26 lines
665 B
C
/* This program is intended to be started outside of gdb, and then
|
|
attached to by gdb. Thus, it simply spins in a loop. The loop
|
|
is exited when & if the variable 'should_exit' is non-zero. (It
|
|
is initialized to zero in this program, so the loop will never
|
|
exit unless/until gdb sets the variable to non-zero.)
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
float bidule = 0.0;
|
|
int should_exit = 0;
|
|
|
|
int main ()
|
|
{
|
|
int local_i = 0;
|
|
|
|
sleep( 10 ); /* System call causes register fetch to fail */
|
|
/* This is a known HPUX "feature" */
|
|
while (! should_exit)
|
|
{
|
|
local_i++;
|
|
}
|
|
return (0);
|
|
}
|