From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16382 invoked by alias); 22 Dec 2010 12:00:06 -0000 Received: (qmail 16356 invoked by uid 22791); 22 Dec 2010 12:00:04 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Dec 2010 11:59:56 +0000 Received: (qmail 8677 invoked from network); 22 Dec 2010 11:59:54 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 22 Dec 2010 11:59:54 -0000 From: Pedro Alves To: Raphael Zulliger Subject: Re: proposal: substitute-path handles foreign dir separators Date: Wed, 22 Dec 2010 12:00:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.33-29-realtime; KDE/4.4.5; x86_64; ; ) Cc: gdb-patches@sourceware.org, Eli Zaretskii References: <4D0B7125.2010203@indel.ch> <201012171750.36936.pedro@codesourcery.com> <4D0F0885.9010104@indel.ch> In-Reply-To: <4D0F0885.9010104@indel.ch> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201012221159.51827.pedro@codesourcery.com> 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/msg00393.txt.bz2 On Monday 20 December 2010 07:40:53, Raphael Zulliger wrote: > 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. Yes, that sounds like a natural extension to my patch. In gdb/filesystem.h, we have IS_TARGET_ABSOLUTE_PATH, etc., to handle the similar case with target paths (paths to DSOs in the target filesystem, for example). It sound like we need to add similar IS_SOURCE_ABSOLUTE_PATH and friends to source.h, and make substitute-path use them, quite like gdb/solib.c:solib_find uses IS_TARGET_ABSOLUTE_PATH, etc. -- Pedro Alves