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

* [Bug threads/13582] issues with accessing errno in non-threaded program
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-01-11  9:47 UTC (permalink / raw)
  To: gdb-prs

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

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-01-11 09:47:40 UTC ---
(In reply to comment #0)
> (gdb) p errno
> Cannot find thread-local variables on this target

This is work arounded in Fedora GDB the straightforward way of substituting it
by "*((int *(*) (void)) __errno_location) ()":
http://pkgs.fedoraproject.org/gitweb/?p=gdb.git;a=blob_plain;f=gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch;hb=master


> [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]

This works on normal distros featuring debug info for system components.

-- 
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

* [Bug threads/13582] issues with accessing errno in non-threaded program
  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
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-07-14 20:58 UTC (permalink / raw)
  To: gdb-prs

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

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-07-14 20:58:21 UTC ---
duplicate

*** This bug has been marked as a duplicate of bug 11795 ***

-- 
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

* [Bug threads/13582] issues with accessing errno in non-threaded program
  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
  2 siblings, 0 replies; 4+ messages in thread
From: naesten at gmail dot com @ 2013-01-29 22:54 UTC (permalink / raw)
  To: gdb-prs

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

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naesten at gmail dot com
           See Also|                            |http://bugs.debian.org/5817
                   |                            |07,
                   |                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=185337

-- 
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).