From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13573 invoked by alias); 11 Jan 2012 01:04:53 -0000 Received: (qmail 13556 invoked by uid 22791); 11 Jan 2012 01:04:52 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 01:04:40 +0000 From: "dje at google dot com" To: gdb-prs@sourceware.org Subject: [Bug threads/13582] New: issues with accessing errno in non-threaded program Date: Wed, 11 Jan 2012 01:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: threads X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at google dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2012-q1/txt/msg00039.txt.bz2 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 #include 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.