public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug threads/13582] New: issues with accessing errno in non-threaded program
@ 2012-01-11  1:04 dje at google dot com
  2012-01-11  9:47 ` [Bug threads/13582] " jan.kratochvil at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dje at google dot com @ 2012-01-11  1:04 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13582

             Bug #: 13582
           Summary: issues with accessing errno in non-threaded program
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: threads
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dje@google.com
    Classification: Unclassified


#include <stdio.h>
#include <errno.h>

int main() {
  errno = 0;
  close(3);
  printf("errno = %d\n", errno);
  return 0;
}

$ gdb a.out
(gdb) start
(gdb) p errno
Cannot find thread-local variables on this target

Compiling with -lpthread will make this work, but ideally it shouldn't be
necessary.
Compiling with -g3 can make this work, but it's not intuitive to the casual
user.
[and on amd64-linux gdb doesn't know __errno_location returns a 64-bit value
and tries to deference the sign-extended 32-bit result]

The error message could maybe improved (if fixing this properly is that much
harder).
[Eventually we want to remove libthread_db, but until then, perhaps gdb could
print a more helpful message if libthread_db isn't loaded?]

There has been work on this in the past, IIRC, but the issue is still present.
Filing this bug so it's not forgotten.
[I couldn't find an existing bug.]

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-29 22:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11  1:04 [Bug threads/13582] New: issues with accessing errno in non-threaded program dje at google dot com
2012-01-11  9:47 ` [Bug threads/13582] " jan.kratochvil at redhat dot com
2012-07-14 20:58 ` jan.kratochvil at redhat dot com
2013-01-29 22:54 ` naesten at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).