Bruno Haible <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> I did not set errno, which would normally happen for a real failure. >> I tried, but __errno_location() returns an invalid address. >> Anyone know how to set errno via gdb? > > I normally use > (gdb) print errno = 22 > since in a single-threaded situation __errno_location() == &errno.
Thanks, but that was the first thing I tried. It doesn't work on rawhide: (gdb) p errno = 2 TLS symbol `errno' not resolved for non-TLS program. You should use symbol "(*__errno_location ())" or compile the program with `gcc -ggdb3' or `gcc -pthread'. (gdb) nor with the tools in debian unstable: (gdb) p errno = 1 No symbol "errno" in current context. Using -ggdb3 didn't help, but finally when I took the 2nd suggestion and compiled with -pthread, I could set errno (to ENOMEM=12). Same result: segfault.