[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errno in gdb

From: Jim Meyering
Subject: Re: errno in gdb
Date: Sat, 03 Nov 2007 07:52:58 +0100

Bruno Haible <address@hidden> 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 

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]