From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3201 invoked by alias); 8 Jan 2014 10:56:46 -0000 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 Received: (qmail 3171 invoked by uid 48); 8 Jan 2014 10:56:46 -0000 From: "gr.sourceware at anguta dot net" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: threads X-Bugzilla-Version: 7.6 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gr.sourceware at anguta dot net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cf_gcctarget cf_gccbuild attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q1/txt/msg00014.txt.bz2 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 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: ... 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.