Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb does not stops inside a template function
@ 2006-06-20  9:50 Dima Sorkin
  2006-06-20 12:21 ` Nick Roberts
  2006-06-20 12:27 ` Daniel Jacobowitz
  0 siblings, 2 replies; 3+ messages in thread
From: Dima Sorkin @ 2006-06-20  9:50 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

Hi.
 I have the following problem with gdb6.3 :
If I put a breakpoint on a line inside a function template,
the gdb not always stops there.

Please see attached ".cpp" file and the gdb session transcript
(file: "templ_dbg.1.output").
It can be seen that gdb stops on first call to "f",
but not on second.

Regards and thank you,
  Dima.

P.S.
 I use various versions of gcc compiler (3.3.6, 4.0.0),
the result was the same.

[-- Attachment #2: templ_dbg.lines_numbered.cpp --]
[-- Type: text/plain, Size: 335 bytes --]

1 // templ_dbg.cpp -*-c++-*-
2
3 template<typename T> T const f(T const &t){
4         return t+t;
5 }
6
7 #include<iostream>
8 using namespace std;
9
10 int main(){
11         int i(5);
12         cout << f(i) << '\n';
13
14         double d(0.3);
15         cout << f(d) << '\n';
16
17         return 0;
18 }
19


[-- Attachment #3: templ_dbg.1.output --]
[-- Type: text/plain, Size: 458 bytes --]

(gdb) break templ_dbg.cpp:4
Breakpoint 1 at 0x804870b: file templ_dbg.cpp, line 4.
(gdb) run
Starting program: /home/dima/templ_dbg 
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x50d000

Breakpoint 1, f<int> (t=@0xbfa784c4) at templ_dbg.cpp:4
4               return t+t;
(gdb) print t
$1 = (const int &) @0xbfa784c4: 5
(gdb) continue
Continuing.
10
0.6

Program exited normally.
(gdb)


[-- Attachment #4: gdb.version --]
[-- Type: text/plain, Size: 418 bytes --]

GNU gdb Red Hat Linux (6.3.0.0-1.21rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* gdb does not stops inside a template function
  2006-06-20  9:50 gdb does not stops inside a template function Dima Sorkin
@ 2006-06-20 12:21 ` Nick Roberts
  2006-06-20 12:27 ` Daniel Jacobowitz
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Roberts @ 2006-06-20 12:21 UTC (permalink / raw)
  To: Dima Sorkin; +Cc: gdb


> Hi.
>  I have the following problem with gdb6.3 :
> If I put a breakpoint on a line inside a function template,
> the gdb not always stops there.


> Please see attached ".cpp" file and the gdb session transcript
> (file: "templ_dbg.1.output").
> It can be seen that gdb stops on first call to "f",
> but not on second.

...
(gdb) break templ_dbg.cpp:4

I think you need to do:

(gdb) b int const f<int>(int const&)
(gdb) b double const f<double>(double const&)

if you want it to stop at both places.  Completion makes them easier
to type:

(gdb) b int<TAB>
(gdb) b double<TAB>

(Although I can only see how to select a candidate using Emacs.)

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gdb does not stops inside a template function
  2006-06-20  9:50 gdb does not stops inside a template function Dima Sorkin
  2006-06-20 12:21 ` Nick Roberts
@ 2006-06-20 12:27 ` Daniel Jacobowitz
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2006-06-20 12:27 UTC (permalink / raw)
  To: Dima Sorkin; +Cc: gdb

On Tue, Jun 20, 2006 at 10:38:01AM +0200, Dima Sorkin wrote:
> Hi.
> I have the following problem with gdb6.3 :
> If I put a breakpoint on a line inside a function template,
> the gdb not always stops there.
> 
> Please see attached ".cpp" file and the gdb session transcript
> (file: "templ_dbg.1.output").
> It can be seen that gdb stops on first call to "f",
> but not on second.

Yes, this is a known bug; it's basically the same bug as not stopping
in constructor functions using g++.  Sorry.  No one has had time to do
the major changes needed to fix it.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-20 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-20  9:50 gdb does not stops inside a template function Dima Sorkin
2006-06-20 12:21 ` Nick Roberts
2006-06-20 12:27 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox