This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setting a breakpoint on a dll, relative path or absolute path issue

On 2011-6-11 22:25, Earnie wrote:
asmwarrior wrote:
The strange thing is:
when I pass a true path
"E:\code\cb\wx\wxWidgets-2.8.12\src/common/string.cpp", then the
breakpoint failed, gdb report that there is no such source file.

But when using "../../src/common/datetime.cpp" or
the breakpoint can be set correctly.

So, can some gdb developers can tell the truth why this would happen?
I think at least when using
"E:\code\cb\wx\wxWidgets-2.8.12\src/common/string.cpp", the breakpoint
should set correctly.

I'm not a gdb developer nor do I use it often but I'm of the opinion that gdb isn't looking on disk for the file and is looking instead for a match in a record in the object data. Does it help if you use the --directory=/path/to/source/files switch?

My dll was located in: E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28ud_gcc_custom.dll and when build this dll, I use the make file locates in: E:\code\cb\wx\wxWidgets-2.8.12\build\msw\makefile.gcc and all the sources were under: E:\code\cb\wx\wxWidgets-2.8.12\src

I have manually add the directory by using those command:
dir E:/code/cb/wx/wxWidgets-2.8.12/build/msw
dir E:/code/cb/wx/wxWidgets-2.8.12/src
dir dir E:/code/cb/wx/wxWidgets-2.8.12/lib/gcc_dll

and now, I try to set a break point:
> break "E:/code/cb/wx/wxWidgets-2.8.12/src/common/string.cpp:164"
No source file named E:/code/cb/wx/wxWidgets-2.8.12/src/common/string.cpp.
Breakpoint 3 ("E:/code/cb/wx/wxWidgets-2.8.12/src/common/string.cpp:164) pending.

Which means: passing the absolute path still failed.


The strange thing is that passing a relative path works
> break "../../src/common/string.cpp:164"
Breakpoint 4 at 0x66d89f44: file ../../src/common/string.cpp, line 164.

This means that gdb internally know this relative path matches some debugging symbols.

The more strange thing is, if the path was supplied by this:
> break E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp:164
Breakpoint 2 at 0x66d89f44: file ../../src/common/string.cpp, line 164.

> break E:\code\cb\wx\wxWidgets-2.8.12\src\common/../../src/common/string.cpp:165
No source file named E:\code\cb\wx\wxWidgets-2.8.12\src\common/../../src/common/string.cpp.
Breakpoint 3 (E:\code\cb\wx\wxWidgets-2.8.12\src\common/../../src/common/string.cpp:165) pending.

> break E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll/../../src/common/string.cpp:165
No source file named E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll/../../src/common/string.cpp.
Breakpoint 4 (E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll/../../src/common/string.cpp:165) pending.

You can see: if the relative path is followed by
the breakpoint can be set correctly.

If the relative path is followed by some other path like:
The breakpoint can't be set.

Can you give me a direction that I can dig into the gdb's source?

Sorry, no, debugging the debugger is an awesome task and one I've never desired to do. Good luck on your journey into this venture, I truly wish you well. There has been little development in gdb on Windows that I know of and it would be good if someone had the heart to put some love into it.

thanks for the encourage, and I will do my best to contribute.

ollydbg from codeblocks' forum

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]