No source file named xxxx

View: New views
5 Messages — Rating Filter:   Alert me  

No source file named xxxx

by explodingbadger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi I have a project and although I am able to set break points on functions Ok I am unable to set break points using  filename:line. For example:

(gdb) break Test.cpp:10
No source file named Test.cpp.
Make breakpoint pending on future shared library load? (y or [n])

Test.cpp is the file containing main and is in the same directory as the executable and is the directory where
I am starting gdb.

My project is compiled with:

g++ -g3 -gdwarf-2

I am fairly sure that debug symbols are present in the file because if I use the strip command to remove the symbols

strip -v -o strip.out Test

strip.out is a lot smaller than Test

Any ideas ?

Gareth

Re: No source file named xxxx

by Charles Manning-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 14 May 2009 13:07:27 explodingbadger wrote:

> Hi I have a project and although I am able to set break points on functions
> Ok I am unable to set break points using  filename:line. For example:
>
> (gdb) break Test.cpp:10
> No source file named Test.cpp.
> Make breakpoint pending on future shared library load? (y or [n])
>
> Test.cpp is the file containing main and is in the same directory as the
> executable and is the directory where
> I am starting gdb.
>
> My project is compiled with:
>
> g++ -g3 -gdwarf-2
>
> I am fairly sure that debug symbols are present in the file because if I
> use the strip command to remove the symbols
>
> strip -v -o strip.out Test
>
> strip.out is a lot smaller than Test
>
> Any ideas ?
>
> Gareth

I would not rely on strip to tell you this. Try objdump.

In gdb you should be able to hit tab after entering break and gdb should show
you symbols. You should be able to see file names in the symbols.

(gdb) break Tes<tab> should also give you completion.






Re: No source file named xxxx

by explodingbadger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I would not rely on strip to tell you this. Try objdump.

> In gdb you should be able to hit tab after entering break and gdb should show
> you symbols. You should be able to see file names in the symbols.

> (gdb) break Tes<tab> should also give you completion.

Hi thanks very much for your reply.

Using tab and auto completion it seems that some files are known for example the debugger 'knows' the source files for a static library I am linking to but not for Test.cpp. I tested this by setting a break point in the shared library using
break <filename>:<line number> and it worked but not for Test.cpp.

Looking at the out put for objdump -g I do get a lot of information. It looks like this:

 <2><b3a7>: Abbrev Number: 29 (DW_TAG_subprogram)
    <b3a8>   DW_AT_external    : 1
    <b3a9>   DW_AT_name        : (indirect string, offset: 0x595d): operator FixOrdType*
    <b3ad>   DW_AT_decl_file   : 30
    <b3ae>   DW_AT_decl_line   : 313
    <b3b0>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x4b37): _ZNK8ZmAtomicIP10FixOrdTypeEcvS1_Ev
    <b3b4>   DW_AT_type        : <0xb4b1>
    <b3b8>   DW_AT_declaration : 1
    <b3b9>   DW_AT_sibling     : <0xb3c4>

Re: No source file named xxxx

by Charles Manning-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does gdb find symbols in Test.cpp? If you set a break on a symbol and it has
line info then you should see that displayed. eg.

(gdb) b main
Breakpoint 1 at 0x8048385: file xx.c, line 3.

The default -g level is 2, I wonder whether -g3 is causing some confusion. Try
just -g



On Thursday 14 May 2009 14:19:31 explodingbadger wrote:

> > I would not rely on strip to tell you this. Try objdump.
> >
> > In gdb you should be able to hit tab after entering break and gdb should
> > show
> > you symbols. You should be able to see file names in the symbols.
> >
> > (gdb) break Tes<tab> should also give you completion.
>
> Hi thanks very much for your reply.
>
> Using tab and auto completion it seems that some files are known for
> example the debugger 'knows' the source files for a static library I am
> linking to but not for Test.cpp. I tested this by setting a break point in
> the shared library using
> break <filename>:<line number> and it worked but not for Test.cpp.
>
> Looking at the out put for objdump -g I do get a lot of information. It
> looks like this:
>
>  <2><b3a7>: Abbrev Number: 29 (DW_TAG_subprogram)
>     <b3a8>   DW_AT_external    : 1
>     <b3a9>   DW_AT_name        : (indirect string, offset: 0x595d):
> operator FixOrdType*
>     <b3ad>   DW_AT_decl_file   : 30
>     <b3ae>   DW_AT_decl_line   : 313
>     <b3b0>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x4b37):
> _ZNK8ZmAtomicIP10FixOrdTypeEcvS1_Ev
>     <b3b4>   DW_AT_type        : <0xb4b1>
>     <b3b8>   DW_AT_declaration : 1
>     <b3b9>   DW_AT_sibling     : <0xb3c4>





Re: No source file named xxxx

by explodingbadger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi thanks for your help I just worked it out:

Here is the original make file (actually simplified to make the point)

Test: Test.o
        g++ -g3 -gdwarf-2 Test.o -o Test

I noticed if I do this then the debug flags are only used during the linking phase not in the compilation

If I change the make file to

Test: Test.cpp
        g++ -g3 -gdwarf-2 Test.cpp -o Test

Then it works!

Thanks a lot.

Charles Manning-2 wrote:
Does gdb find symbols in Test.cpp? If you set a break on a symbol and it has
line info then you should see that displayed. eg.

(gdb) b main
Breakpoint 1 at 0x8048385: file xx.c, line 3.

The default -g level is 2, I wonder whether -g3 is causing some confusion. Try
just -g



On Thursday 14 May 2009 14:19:31 explodingbadger wrote:
> > I would not rely on strip to tell you this. Try objdump.
> >
> > In gdb you should be able to hit tab after entering break and gdb should
> > show
> > you symbols. You should be able to see file names in the symbols.
> >
> > (gdb) break Tes<tab> should also give you completion.
>
> Hi thanks very much for your reply.
>
> Using tab and auto completion it seems that some files are known for
> example the debugger 'knows' the source files for a static library I am
> linking to but not for Test.cpp. I tested this by setting a break point in
> the shared library using
> break <filename>:<line number> and it worked but not for Test.cpp.
>
> Looking at the out put for objdump -g I do get a lot of information. It
> looks like this:
>
>  <2><b3a7>: Abbrev Number: 29 (DW_TAG_subprogram)
>     <b3a8>   DW_AT_external    : 1
>     <b3a9>   DW_AT_name        : (indirect string, offset: 0x595d):
> operator FixOrdType*
>     <b3ad>   DW_AT_decl_file   : 30
>     <b3ae>   DW_AT_decl_line   : 313
>     <b3b0>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x4b37):
> _ZNK8ZmAtomicIP10FixOrdTypeEcvS1_Ev
>     <b3b4>   DW_AT_type        : <0xb4b1>
>     <b3b8>   DW_AT_declaration : 1
>     <b3b9>   DW_AT_sibling     : <0xb3c4>