This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: break on a external source file
On 9/22/07, Daniel Jacobowitz <drow@false.org> wrote:
> On Sat, Sep 22, 2007 at 01:21:31AM +0300, costin_c wrote:
> > How can I tell to gdb to put a breakpoint on a given line in C++
> > source file, located in directory situated other than current one ?
>
> You're doing it right. The problem doesn't have to do with that, but
> with this:
> > 4 Print::Print(int v)
> > 5 {
> > 6 val=v+v;
> > 7 };
>
> That's a constructor. This is a known bug in GDB, for which Vladimir
> Prus has recently posted patches.
>
For line 11 form Print::print() in works fine
9 void Print::print()
10 {
11 std::cout<<val<<std::endl;
12 }
break dir/print.cc:11
Breakpoint 1 at 0x80486d0: file dir/print.cc, line 11.
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x080486d0 in Print::print() at dir/print.cc:11
(gdb) r
Starting program: /home/user/print
Failed to read a valid object file image from memory.
Breakpoint 1, Print::print (this=0xbfb2c340) at dir/print.cc:11
11 std::cout<<val<<std::endl;
(gdb) n
200
12 }
(gdb) n
main () at main.cc:7
7 return 0;