This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug threads/13582] New: issues with accessing errno in non-threadedprogram


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]