When testing an i386 (-m32) program on an x86_64 host using gdbserver,
the program under test crashes with a segmentation fault.
Steps to reproduce:
$ cat > test.c
int main (void) { return 0; }
$ gcc -m32 -otest32 test.c
$ gdbserver localhost:12345 ./test32
and in another terminal
$ gdb -batch -q -ex "target remote localhost:12345" -ex continue
Expected result: test32 runs to completion
Actual result:
Program received signal SIGSEGV, Segmentation fault.
0xf7ddf3f7 in __ctype_init () from target:/lib/i386-linux-gnu/libc.so.6
This seems to be a known bug, fixed in
<https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=037e8112b9794a633248e5aa5943f3be273e0a20>,
as applied in e.g. Arch Linux's version of gdb 10.2. I'm waiting for a
backport of that change to compile locally so I can try it.
Thanks,
smcv