From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28841 invoked by alias); 14 Jun 2011 04:22:06 -0000 Received: (qmail 28831 invoked by uid 22791); 14 Jun 2011 04:22:04 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 04:21:48 +0000 Received: by wyf19 with SMTP id 19so4491229wyf.0 for ; Mon, 13 Jun 2011 21:21:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.5.143 with SMTP id w15mr228788wes.74.1308025306660; Mon, 13 Jun 2011 21:21:46 -0700 (PDT) Received: by 10.216.87.202 with HTTP; Mon, 13 Jun 2011 21:21:46 -0700 (PDT) Reply-To: noloader@gmail.com In-Reply-To: <4DF6D94A.7080408@gmail.com> 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> <4DF6D123.6000201@gmail.com> <4DF6D94A.7080408@gmail.com> Date: Tue, 14 Jun 2011 04:22:00 -0000 Message-ID: Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue From: Jeffrey Walton To: Asm warrior Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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/msg00101.txt.bz2 On Mon, Jun 13, 2011 at 11:45 PM, Asm warrior wrote: > On 2011-6-14 11:10, Asm warrior wrote: >> >> 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 >> >> char buf[MAX_PATH]; >> char* basename; >> DWORD len = GetFullPathName (filename, MAX_PATH, buf, &basename); >> ... >From experience, I've found that using MAX_PATH*2 is useful. Its not uncommon to have a few directories added to a user's temp directory and exceed MAX_PATH. It will help keep you out of: >> if (len == 0 || len > MAX_PATH - 1) >> return strdup (filename); >From experience, I've never encountered a valid case for MAX_PATH*3. While possibly a valid length, I consider anything greater than MAX_PATH*2 an attack. >> [SNIP] > Did you think we should add the "MS Windows method." in > gdb\libiberty\lrealpath.c to the char * gdb_realpath (const char *filename) > function body? For what its worth, Microsoft has moved to the Consolidated URL Parser (cURL) for path normalization and canonicalization. See, for example, CreateUri Function [1] and ParseURL Function [2]. Howard and LeBlanc recommend their use in Writing Secure Code for Windows Vista (pp. 130-131). > As currently, it just do a strdup(filename) under MinGW32 (Windows). Jeff [1] http://msdn.microsoft.com/en-us/library/ms775098(v=vs.85).aspx [2] http://msdn.microsoft.com/en-us/library/bb773825(v=vs.85).aspx