public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17491] New: gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation
@ 2014-10-16  0:47 runipg at broadcom dot com
  2014-10-16  0:53 ` [Bug c++/17491] " runipg at broadcom dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: runipg at broadcom dot com @ 2014-10-16  0:47 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17491
           Summary: gdb cannot find line numbers of certain templated
                    methods in the stack frame even with -ggdb compilation
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: runipg at broadcom dot com

Created attachment 7834
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7834&action=edit
Main program, simply triggers a core dump via an assertion failure

Description

GDB cannot see line numbers for certain templated methods in the stack frame
even though everything is compiled with the -O0 -ggdb flags (see below). In the
frame below #5 and #6 do not have line numbers where as the rest of them do,
which means that gdb cannot step into those templated methods. This makes gdb
virtually unusable on some of our complex C++ code.

(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x002d5df0 in raise () from /lib/libc.so.6
#2  0x002d7701 in abort () from /lib/libc.so.6
#3  0x002cf26b in __assert_fail () from /lib/libc.so.6
#4  0x08055b68 in gdbTest_First_Test::TestBody (this=0x828c608)
    at gdb_test.cc:19
#5  0x08187bd6 in void
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test,
void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#6  0x0818371c in void
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,
void>(testing::Test*, void (testing::Test::*)(), char const*)
    ()
#7  0x0816d1a8 in testing::Test::Run (this=0x828c608) at ../src/gtest.cc:2151
#8  0x0816d8b9 in testing::TestInfo::Run (this=0x828c288)
    at ../src/gtest.cc:2326
#9  0x0816de75 in testing::TestCase::Run (this=0x828c538)
    at ../src/gtest.cc:2444
#10 0x08173c68 in testing::internal::UnitTestImpl::RunAllTests (
    this=0x828c2f0) at ../src/gtest.cc:4315
#11 0x081888f4 in bool
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,
bool>(testing::internal::UnitTestImpl*, bool
(testing::internal::UnitTestImpl::*)(), char const*) ()
#12 0x0818427c in bool
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,
bool>(testing::internal::UnitTestImpl*, bool
(testing::internal::UnitTestImpl::*)(), char const*) ()
#13 0x08172acd in testing::UnitTest::Run (
    this=0x8272600 <testing::UnitTest::GetInstance()::instance>)
    at ../src/gtest.cc:3929
#14 0x08055d45 in RUN_ALL_TESTS ()
    at /projects/ntsw-arch-public/tools/gtest-1.7.0/include/gtest/gtest.h:2288
#15 0x08055b9d in main (argc=1, argv=0xffffba64) at gdb_test.cc:34
(gdb) up
#6  0x0818371c in void
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,
void>(testing::Test*, void (testing::Test::*)(), char const*)
    ()
(gdb) up
#7  0x0816d1a8 in testing::Test::Run (this=0x828c608) at ../src/gtest.cc:2151

How to Reproduce

Unfortunately this has been a really hard bug to reproduce. Here are some
variables which seem to be affecting it:

1. Compile flags for example removing -fPIC from the compile and link seems to
help to some degree but not completely eliminate the problem
2. Moving templated code from exter template cc files to self contained .h
files seems to help, but not completely eliminate the problem
3. Linking to other objects (even though they are not used)

Environment
•    the operating system verson (output of uname -a)
Linux lc-sj1-4507 2.6.18-308.11.1.el5 #1 SMP Fri Jun 15 15:41:53 EDT 2012
x86_64 x86_64 x86_64 GNU/Linux
•    the compiler version (for GCC, the output from gcc -v)
g++ (GCC) 4.7.2
•    how GDB was configured (the This GDB was configured as line from GDB's
startup text)
This GDB was configured as "x86_64-unknown-linux-gnu".

Compile:
/tools/bin/g++ -O0 -ggdb -pthread -m32  -Wall -Wno-unknown-pragmas -Wno-error
-Wno-deprecated  -Wno-unused-variable -Wno-overloaded-virtual -Wno-enum-compare
-Wno-write-strings -m32 -fPIC
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/include
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/build/unix-linux/ip
-I/projects/ntsw-arch-public/tools/systemc-2.3.0a/include 
-I/projects/ntsw-arch-public/tools/boost_1_54_0/include
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/ip/include
-I/projects/ntsw-arch-public/tools/gtest-1.7.0/include
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/include
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/build/unix-linux/ip
-I/projects/ntsw-arch-public/tools/systemc-2.3.0a/include 
-I/projects/ntsw-arch-public/tools/boost_1_54_0/include
-I/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/ip/include
-I/projects/ntsw-arch-public/tools/gtest-1.7.0/include   -c gdb_test.cc -o
/projects/ntsw-arch3/AV/users/runipg/rg_arch2/arch/build/unix-linux/ip/gdb_test.o

I have attached the  simple test program, I use google unit test framework
gtest version 1.7. Note that the bug in this case appears only when I link to a
whole bunch of superflous objects which are not in use by this program. I
cannot attach the executable because of file size limit but can analyze it via
readelf if you wish.

Let me know if you need more information.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-16835-listarch-gdb-prs=sources.redhat.com@sourceware.org Thu Oct 16 00:48:34 2014
Return-Path: <gdb-prs-return-16835-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 862 invoked by alias); 16 Oct 2014 00:48:34 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 835 invoked by uid 48); 16 Oct 2014 00:48:33 -0000
From: "runipg at broadcom dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/17491] gdb cannot find line numbers of certain templated
 methods in the stack frame even with -ggdb compilation
Date: Thu, 16 Oct 2014 00:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: c++
X-Bugzilla-Version: 7.7
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: runipg at broadcom 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-Flags:
X-Bugzilla-Changed-Fields: cf_gcctarget cc cf_gcchost
Message-ID: <bug-17491-4717-OVFEzsJasN@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-17491-4717@http.sourceware.org/bugzilla/>
References: <bug-17491-4717@http.sourceware.org/bugzilla/>
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-q4/txt/msg00078.txt.bz2
Content-length: 794

https://sourceware.org/bugzilla/show_bug.cgi?id\x17491

runipg at broadcom dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |g++ (GCC) 4.7.2
                 CC|                            |runipg at broadcom dot com
               Host|                            |Linux lc-sj1-4507
                   |                            |2.6.18-308.11.1.el5 #1 SMP
                   |                            |Fri Jun 15 15:41:53 EDT
                   |                            |2012 x86_64 x86_64 x86_64
                   |                            |GNU/Linux

--
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 c++/17491] gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation
  2014-10-16  0:47 [Bug c++/17491] New: gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation runipg at broadcom dot com
  2014-10-16  0:53 ` [Bug c++/17491] " runipg at broadcom dot com
@ 2014-10-16  0:53 ` runipg at broadcom dot com
  2015-01-05  4:26 ` julien.nitard at m4tp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: runipg at broadcom dot com @ 2014-10-16  0:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from runipg at broadcom dot com ---
I have now been able to attach the test executable.

-- 
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 c++/17491] gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation
  2014-10-16  0:47 [Bug c++/17491] New: gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation runipg at broadcom dot com
@ 2014-10-16  0:53 ` runipg at broadcom dot com
  2014-10-16  0:53 ` runipg at broadcom dot com
  2015-01-05  4:26 ` julien.nitard at m4tp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: runipg at broadcom dot com @ 2014-10-16  0:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from runipg at broadcom dot com ---
Created attachment 7835
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7835&action=edit
executable

-- 
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 c++/17491] gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation
  2014-10-16  0:47 [Bug c++/17491] New: gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation runipg at broadcom dot com
  2014-10-16  0:53 ` [Bug c++/17491] " runipg at broadcom dot com
  2014-10-16  0:53 ` runipg at broadcom dot com
@ 2015-01-05  4:26 ` julien.nitard at m4tp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: julien.nitard at m4tp dot org @ 2015-01-05  4:26 UTC (permalink / raw)
  To: gdb-prs

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

Julien Nitard <julien.nitard at m4tp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |julien.nitard at m4tp dot org

--- Comment #3 from Julien Nitard <julien.nitard at m4tp dot org> ---
I am seeing the same problem on a rather intricate example.
Also affects GDB 7.8.1 as far as I can tell.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-17242-listarch-gdb-prs=sources.redhat.com@sourceware.org Mon Jan 05 04:30:41 2015
Return-Path: <gdb-prs-return-17242-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 22140 invoked by alias); 5 Jan 2015 04:30:41 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 21168 invoked by uid 48); 5 Jan 2015 04:30:40 -0000
From: "julien.nitard at m4tp dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/17491] gdb cannot find line numbers of certain templated
 methods in the stack frame even with -ggdb compilation
Date: Mon, 05 Jan 2015 04:30:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: c++
X-Bugzilla-Version: 7.7
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: julien.nitard at m4tp dot org
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:
Message-ID: <bug-17491-4717-aS2eHkQNxG@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-17491-4717@http.sourceware.org/bugzilla/>
References: <bug-17491-4717@http.sourceware.org/bugzilla/>
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: 2015-q1/txt/msg00007.txt.bz2
Content-length: 1138

https://sourceware.org/bugzilla/show_bug.cgi?id\x17491

--- Comment #4 from Julien Nitard <julien.nitard at m4tp dot org> ---
ALso, the problem doesn't happen when using -gstabs+ in our case.

It's also worth noting that NM find the line number :

nm -l executable | egrep HandleSehExceptionsInMethodIfSupported
081888ba W
_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
      /projects/ntsw-arch-public/tools/gtest-1.7.0/make/../src/gtest.cc:2059
08187c20 W
_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_15TestFactoryBaseEPNS_4TestEEET0_PT_MS6_FS5_vEPKc
  /projects/ntsw-arch-public/tools/gtest-1.7.0/make/../src/gtest.cc:2059
08187b9c W
_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
/projects/ntsw-arch-public/tools/gtest-1.7.0/make/../src/gtest.cc:2059
081880ca W
_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_8TestCaseEvEET0_PT_MS4_FS3_vEPKc
    /projects/ntsw-arch-public/tools/gtest-1.7.0/make/../src/gtest.cc:2059

--
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:[~2015-01-05  4:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16  0:47 [Bug c++/17491] New: gdb cannot find line numbers of certain templated methods in the stack frame even with -ggdb compilation runipg at broadcom dot com
2014-10-16  0:53 ` [Bug c++/17491] " runipg at broadcom dot com
2014-10-16  0:53 ` runipg at broadcom dot com
2015-01-05  4:26 ` julien.nitard at m4tp dot org

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