Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: asmwarrior <asmwarrior@gmail.com>
To: MinGW Users List <mingw-users@lists.sourceforge.net>,
	 gdb@sourceware.org
Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue
Date: Sun, 12 Jun 2011 08:15:00 -0000	[thread overview]
Message-ID: <4DF4513A.3090902@gmail.com> (raw)
In-Reply-To: <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



  parent reply	other threads:[~2011-06-12  8:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11  7:49 asmwarrior
2011-06-11 17:56 ` Keith Seitz
2011-06-12  3:56   ` asmwarrior
2011-06-12  7:45     ` asmwarrior
2011-06-12  7:56       ` Jan Kratochvil
2011-06-12  8:06         ` asmwarrior
2011-06-12 16:22           ` [Mingw-users] " Earnie
2011-06-12 16:51         ` Eli Zaretskii
2011-06-12 16:54           ` Jan Kratochvil
     [not found] ` <4DF37ADA.3070905@users.sourceforge.net>
2011-06-12  8:15   ` asmwarrior [this message]
     [not found]   ` <4DF4513A.3090902__7466.60719528354$1307866544$gmane$org@gmail.com>
2011-06-13  6:33     ` Asm warrior
2011-06-13 17:02       ` Eli Zaretskii
2011-06-14  3:14         ` Asm warrior
2011-06-14  3:49           ` Asm warrior
2011-06-14  4:22             ` Jeffrey Walton
2011-06-14  5:27         ` setting a breakpoint on a dll, relative path or absolute path issue[solved with a patch] asmwarrior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DF4513A.3090902@gmail.com \
    --to=asmwarrior@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=mingw-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox