From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8142 invoked by alias); 12 Jun 2011 07:45:23 -0000 Received: (qmail 8126 invoked by uid 22791); 12 Jun 2011 07:45:22 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_DB,TW_SM X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 12 Jun 2011 07:45:04 +0000 Received: by pwi12 with SMTP id 12so2097208pwi.0 for ; Sun, 12 Jun 2011 00:45:03 -0700 (PDT) Received: by 10.142.151.4 with SMTP id y4mr805940wfd.133.1307864702527; Sun, 12 Jun 2011 00:45:02 -0700 (PDT) Received: from [192.168.1.100] ([115.195.156.242]) by mx.google.com with ESMTPS id z32sm2681145wfl.23.2011.06.12.00.44.53 (version=SSLv3 cipher=OTHER); Sun, 12 Jun 2011 00:45:01 -0700 (PDT) Message-ID: <4DF46F19.1020009@gmail.com> Date: Sun, 12 Jun 2011 07:45:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Keith Seitz CC: gdb@sourceware.org, MinGW Users List Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue References: <4DF31EB0.6080006@gmail.com> <4DF3A114.8040709@redhat.com> <4DF43971.8090404@gmail.com> In-Reply-To: <4DF43971.8090404@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00079.txt.bz2 On 2011-6-12 11:58, asmwarrior wrote: > On 2011-6-12 1:08, Keith Seitz wrote: >> On 06/11/2011 12:52 AM, asmwarrior wrote: >>> Can you give me a direction that I can dig into the gdb's source? >> >> This is almost certainly PR 12843: >> >> http://sourceware.org/bugzilla/show_bug.cgi?id=12843 >> >> This was caused, I believe, by this patch hunk (for locate_first_half in >> linespec.c), which I committed for c++/12750 on 2011-05-31: >> >> @@ -1160,13 +1207,11 @@ locate_first_half (char **argptr, int >> *is_quote_enclosed >> break; >> } >> /* Check for the end of the first half of the linespec. End of >> - line, a tab, a double colon or the last single colon, or a >> - space. But if enclosed in double quotes we do not break on >> - enclosed spaces. */ >> + line, a tab, a colon or a space. But if enclosed in double >> + quotes we do not break on enclosed spaces. */ >> if (!*p >> || p[0] == '\t' >> - || ((p[0] == ':') >> - && ((p[1] == ':') || (strchr (p + 1, ':') == NULL))) >> + || (p[0] == ':') >> || ((p[0] == ' ') && !*is_quote_enclosed)) >> break; >> if (p[0] == '.' && strchr (p, ':') == NULL) >> >> I am intending to get to this, but it will probably not be until later >> this coming week. >> >> Keith >> > Hi, Keith, thanks for the reply. I have reverted the patch hunk in the > locate_first_half function and build gdb again, now, I can set > breakpoint like: > > > break > "E:/code/cb/test_code/debug_wx_library/debug_wx_libraryMain.cpp:101" > Breakpoint 1 at 0x401d09: file > E:\code\cb\test_code\debug_wx_library\debug_wx_libraryMain.cpp, line 101. > > So, the PR 12843 can be solved. > --------------------------------------------------------------- > But what I have mentioned in my OP is another issue about setting > breakpoint, that is: > > gdb failed on setting a breakpoint on a shared dll(the dll is build with > the relative paths) > > 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 2 ("E:/code/cb/wx/wxWidgets-2.8.12/src/common/string.cpp:164) > pending. > ------------------------------------------------------------------ > But the breakpoint can be set by using two ways below: > > break ../../src/common/string.cpp:164 > Breakpoint 3 at 0x66d89f44: file ../../src/common/string.cpp, line 164. > >>>>>>cb_gdb: > > break > E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp:164 > Breakpoint 4 at 0x66d89f44: file ../../src/common/string.cpp, line 164. > ------------------------------------------------------------------- > What I expect is the let the first way work. > > So, I would like to find some gdb source snippet which handle the file > path match algorithm, so that all the three methods can work. Can you > give me a direction? > > thanks. > asmwarrior > ollydbg from code::blocks' forum > > > Hi, all, by reading the gdb's source, I found that why setting breakpoint faild on this situation, here is my observation: When I run the gdb command: info sources Then, I found that there's on source line named: E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/datetime.cpp This line can be list in symbols or psymbols. Now, a user try to set a breakpoint, he can use a FILE:LINE format, gdb try to match the FILE in all the sources. The match algorithm was mainly in: gdbgit\gdb\gdb\symtab.c in function: struct symtab * lookup_symtab (const char *name) There are three match algorithms involved: 1, exact match If the user supply the string: "E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/datetime.cpp" Then, it will have a exact match, and the breakpoint can set correctly. 2, tailed match If the user supply the string: "../../src/common/datetime.cpp" It will still match that string in the symbol table, so it works OK. 3, transferred match, this is why things break down If the user supply a string: "E:/code/cb/wx/wxWidgets-2.8.12/src/common/datetime.cpp" Now, gdb try to below: const char *fp = symtab_to_fullname (s); if (fp != NULL && FILENAME_CMP (full_path, fp) == 0) { do_cleanups (cleanup); return s; } Note, the s is every string shown in the "info sources", and full_path is the user supplied string, so if the function symtab_to_fullname (s) correctly transferred to "E:/code/cb/wx/wxWidgets-2.8.12/src/common/datetime.cpp" Then, this will get matched. So, as a conclusion: 1, either we should store the "E:/code/cb/wx/wxWidgets-2.8.12/src/common/datetime.cpp" instead of "E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/datetime.cpp" in the symbol tables. 2, or we need to fix the way I said before "transferred match", so they can still get matched. Any ideas? asmwarrior ollydbg from codeblocks' forum