public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "gr.sourceware at anguta dot net" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/16413] New: Single-stepping function accessing TLS causes SIGSEGV of traced process
Date: Wed, 08 Jan 2014 10:56:00 -0000	[thread overview]
Message-ID: <bug-16413-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=16413

            Bug ID: 16413
           Summary: Single-stepping function accessing TLS causes SIGSEGV
                    of traced process
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: threads
          Assignee: unassigned at sourceware dot org
          Reporter: gr.sourceware at anguta dot net
            Target: x86_64-linux-gnu
             Build: Ubuntu 13.10

Created attachment 7341
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7341&action=edit
Code snippet exhibiting the issue.

Hello,

I've been experiencing this bug for some time with various gdb versions up to
7.6.1 (included): When single-stepping a function accessing a TLS variable in a
PIC binary, the traced process gets a SIGSEGV.

I could reproduce this using a small code snippet, as attached.

Sample session below:

$ gcc -pthread -fPIC -g gdb-tls.c -o gdb-tls -lpthread
$ gdb ./gdb-tls 
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/gdb-tls...done.
(gdb) br foo
Breakpoint 1 at 0x4006a3: file gdb-tls.c, line 18.
(gdb) r
Starting program: /tmp/./gdb-tls 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, foo () at gdb-tls.c:18
18              global_tls++;
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
foo () at gdb-tls.c:18
18              global_tls++;
(gdb)

Running this without gdb, or without breakpoints works fine.
Compiling without -fPIC fixes the issue, as well as with clang instead of gcc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2014-01-08 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 10:56 gr.sourceware at anguta dot net [this message]
2014-02-15  6:36 ` [Bug threads/16413] " qiyao at gcc dot gnu.org

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