public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-13582-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-01-11  1:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  1:04 dje at google dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13582-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).