From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4425 invoked by alias); 14 Jun 2011 03:14:21 -0000 Received: (qmail 4417 invoked by uid 22791); 14 Jun 2011 03:14:20 -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 X-Spam-Check-By: sourceware.org Received: from mail-pz0-f41.google.com (HELO mail-pz0-f41.google.com) (209.85.210.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 03:14:04 +0000 Received: by pzk4 with SMTP id 4so2893044pzk.0 for ; Mon, 13 Jun 2011 20:14:03 -0700 (PDT) Received: by 10.142.204.3 with SMTP id b3mr1025507wfg.49.1308021243635; Mon, 13 Jun 2011 20:14:03 -0700 (PDT) Received: from [210.32.139.52] ([210.32.139.52]) by mx.google.com with ESMTPS id d15sm6634460wfl.6.2011.06.13.20.14.00 (version=SSLv3 cipher=OTHER); Mon, 13 Jun 2011 20:14:02 -0700 (PDT) Message-ID: <4DF6D123.6000201@gmail.com> Date: Tue, 14 Jun 2011 03:14:00 -0000 From: Asm warrior User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Eli Zaretskii CC: gdb@sourceware.org Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue References: <4DF31EB0.6080006@gmail.com> <4DF37ADA.3070905@users.sourceforge.net> <4DF4513A.3090902__7466.60719528354$1307866544$gmane$org@gmail.com> <4DF5AE48.9050202@gmail.com> <83ips9acr7.fsf@gnu.org> In-Reply-To: <83ips9acr7.fsf@gnu.org> 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/msg00099.txt.bz2 On 2011-6-14 0:59, Eli Zaretskii wrote: >> Date: Mon, 13 Jun 2011 14:29:28 +0800 >> > From: Asm warrior >> > CC: "John E. / TDM", Eli Zaretskii, >> > jan.kratochvil@redhat.com,keiths@redhat.com >> > >> > When loop on the symbols. I found that at one loop, I get >> > >> > s->filename = "../../src/common/string.cpp" >> > s->dirname = "D:\code\wxWidgets-2.8.12\build\msw" >> > >> > But too badly, the result >> > s->fullname = >> > "D:\code\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp" >> > >> > This is the reason about the issue, if the result is: >> > "D:\code\wxWidgets-2.8.12/src/common/string.cpp" >> > Then, this problem can be fixed. >> > >> > I'm not sure why gdb does not give a cannical filename, but still leaves >> > the "../../" in the result. > Because the function that canonicalizes the file name does not support > backslashes correctly? > By reading the gdb source, mostly in file: source.c and symtab.c I found that in the function: char * symtab_to_fullname (struct symtab *s) { int r; if (!s) return NULL; /* Don't check s->fullname here, the file could have been deleted/moved/..., look for it again. */ r = find_and_open_source (s->filename, s->dirname, &s->fullname); if (r >= 0) { close (r); return s->fullname; } return NULL; } This function try to check if the file exists. The lucky thing is: The function call: open("D:\code\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp") ; works OK. Though the file path is not satisfied by me, but it just satisfied by open() function, Yeah, the open() function can internally do a path canonization on its parameter, and gdb knows that this file exists and can be opened. As I know, GDB does not do a canonization on any returned file names. (I can't find any code snippet doing this kind of work). Well, the proposed method can be: (see below) char * symtab_to_fullname (struct symtab *s) { int r; if (!s) return NULL; /* Don't check s->fullname here, the file could have been deleted/moved/..., look for it again. */ r = find_and_open_source (s->filename, s->dirname, &s->fullname); if (r >= 0) { close (r); ******* DoSomePathCanonization(&s->fullname); ******* return s->fullname; } return NULL; } This way, the returned string can be: "D:/code/wxWidgets-2.8.12/src/common/string.cpp" BTW:Did you thing that Any one would like to set a breakpoint by using name containing many "../../"? I can hardly think one would like to set a break point by entering this command: b "D:\code\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp:165" I personally think this is too ugly. Any ideas? Asmwarrior ollydbg from codeblocks' forum