user3706789
user3706789

Reputation: 97

Issue Observed while using GDB

I am trying to debug my application which use one static builded library.

I want to set break points in my library so i tried to set it using below command :

break TS.cpp:600(FIle name:line no)

but it says

No source file named TS.cpp.

Make breakpoint pending on future shared library load?(y or [n])

so I presses y here (I came to know after browsing internet) but after pressing y gdb is not stopping at my break point and it completed executing program.

Why GDB is not stopped at my break point??

Any input is highly appreciated.

Upvotes: 0

Views: 91

Answers (2)

Employed Russian
Employed Russian

Reputation: 213526

No source file named TS.cpp

This means one of two things:

  1. either the file TS.cpp was not compiled with -g (or equivalently TS.o has been stripped), or
  2. the file TS.o was not linked into the application.

Since you are seeing prints from that source, it's a safe bet that #1 is the actual root cause.

info sources command shows only my application.c and not the files of my library

That is another confirmation that #1 is the root cause.

Upvotes: 2

Taimoor
Taimoor

Reputation: 53

The problem in your case is with source mapping. It normally happens when application is compiled at some other machine and you are debugging it on some other machine where source location is different.

You can specify source path using directory command of gdb. e.g. if your sources are in /home/taimoor/testApp/src, you can do following:

(gdb) directory /home/taimoor/testApp/src

Upvotes: 0

Related Questions