This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: setting a breakpoint on a dll, relative path or absolute path issue
- From: asmwarrior <asmwarrior at gmail dot com>
- To: MinGW Users List <mingw-users at lists dot sourceforge dot net>, gdb at sourceware dot org
- Date: Sun, 12 Jun 2011 13:40:10 +0800
- Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue
- References: <4DF31EB0.6080006@gmail.com> <4DF37ADA.3070905@users.sourceforge.net>
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
"E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp",
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:
>>>>>>cb_gdb:
> 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.
>>>>>>cb_gdb:
> 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.
>>>>>>cb_gdb:
> 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.
>>>>>>cb_gdb:
You can see: if the relative path is followed by
E:\code\cb\wx\wxWidgets-2.8.12\build\msw
the breakpoint can be set correctly.
If the relative path is followed by some other path like:
E:\code\cb\wx\wxWidgets-2.8.12\src\common
or
E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll
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.
asmwarrior
ollydbg from codeblocks' forum