From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28522 invoked by alias); 20 Dec 2010 07:41:06 -0000 Received: (qmail 28501 invoked by uid 22791); 20 Dec 2010 07:41:04 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from ms9.webland.ch (HELO ms9smtp.webland.ch) (92.43.217.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Dec 2010 07:40:58 +0000 Received: from macserver.private ([84.74.43.109]) by ms9smtp.webland.ch (Webland Mail Server v10.0) with ASMTP id CTI56655; Mon, 20 Dec 2010 08:40:55 +0100 Received: from localhost (localhost [127.0.0.1]) by macserver.private (Postfix) with ESMTP id 869F2A6EB81; Mon, 20 Dec 2010 08:40:53 +0100 (CET) Received: from macserver.private ([127.0.0.1]) by localhost (macserver.private [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9HOYQbcGrwPT; Mon, 20 Dec 2010 08:40:53 +0100 (CET) Received: from [192.168.1.86] (unknown [192.168.1.86]) by macserver.private (Postfix) with ESMTP id 03081A6EB74; Mon, 20 Dec 2010 08:40:52 +0100 (CET) Message-ID: <4D0F0885.9010104@indel.ch> Date: Mon, 20 Dec 2010 07:41:00 -0000 From: Raphael Zulliger User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: proposal: substitute-path handles foreign dir separators References: <4D0B7125.2010203@indel.ch> <834oach14b.fsf@gnu.org> <201012171750.36936.pedro@codesourcery.com> In-Reply-To: <201012171750.36936.pedro@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00363.txt.bz2 On 17.12.2010 18:50, Pedro Alves wrote: > > Here's a patch I wrote a few months back when I was working on > the "set/show target-file-system-kind" support, but put it on > the back burner and never looked at it again. It adds a new > "set source-filenames-matching-scheme dos/unix" command to select > the behavior at run-time, and adds a new source_filename_cmp function > to be used whenever we are comparing source file names instead of > using FILENAME_CMP. I never did an exaustive check on all FILENAME_CMP > calls that should be replaced, and neither did much testing on it > when I wrote it. I've new comfirmed it still builds, but didn't retest > more than that. > I applied your patch and tested it against my use case. First of all I need to admit that I really don't have the "overall picture about GDB internals" yet. I mention this because I can't judge most parts of your patch (psymtab.c, buildsym.c, etc.). Opposed to that, I think I do understand the changes you've done in source.c, filenames.h and filename_cmp.c. First of all, your patch doesn't help for my use case. I guess (although I didn't verify that) your patch only handles "relative" source file names. Unfortunately, in my case, find_and_open_source is called with the following argument values: filename: "X:\\projects\\inos_projects\\inos_trunk\\os\\inos\\src\\inos.cpp" dirname: "/cygdrive/x/projects/inos_projects/inos_trunk/testing/hwtarget_603/" *fullpath: 0 I use the following substitute-path rule: set substitute-path X:\\projects\\inos_projects /mnt/hgfs/projects/inos_projects/ According to my understanding, if having absolute file names in the binary, the following if statement (in find_and_open_source) should become true: if (IS_ABSOLUTE_PATH (filename)) which, unfortunately, is not the case because IS_ABSOLUTE_PATH internally uses Unix style file name rules. To make a long story short: I think that we still need to do the things that are done by my original patch to make my use case working: . Create some kind of IS_ABSOLUTE_PATH which (optionally) works for all file name styles . Create some kind fo IS_DIR_SEPARATOR which (optionally) works for all file name styles . Make sure we don't pass DOSish file names to openp (the one in find_and_open_source) if running on a Unix-like system Assuming that my statements/observations are right, how would be implement these points? We could do similar things with IS_ABSOLUTE_PATH and IS_DIR_SEPARATOR as has been done with the FILENAME_CMP macro by your patch. Having done this, we probably need a third options for source-filenames-matching-scheme: 'mixed'. As I mentioned in the original post, it may happen that you end up with a binary which has been linked from libraries that were compiled on different platforms (e.g. by different developer teams). As far as I understand GDB's source code handling, this would require that IS_ABSOLUTE_PATH and IS_DIR_SEPARATOR need to test for both file name styles. Thanks. Raphael