From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by sourceware.org (Postfix) with ESMTPS id 01E783857C46 for ; Mon, 18 Apr 2022 19:22:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01E783857C46 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id r4-20020a05600c35c400b0039295dc1fc3so101501wmq.3 for ; Mon, 18 Apr 2022 12:22:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=zhBmSwgzXtZ2kFbraNsTFjZFjvsuOdspGhdYxCdT//8=; b=qIqyKvwG6ipZ1AHdeD2iERg4kEE3Cf7CyuWUtiSJLqdsEmcBozY6YOuCueIt7Pp/zZ oqKiDdu2Ux2GMwT4zW0D4txpv8vhso6wJAa4lhvJUyU9kbm8TRVSdyxgHovC4QJpk7w0 E5lDjTQsydjVAqx4M/jvhRxM+5avpNdazUXEoEgCZN+WBWBFLssXYYkGFQT7a6a16F8m tEqN9VKueLC1zSXHq4UWDnGqE6qku+QFdRBujopYeKX5Nlrs3f2ULXODQM4zf+n3UEWd dSFjSIBlBsCO1DMEhglO1zkBOXRAUPNh387IfCGqW75mZwGgYJOazBx3s4UmVvyXguTS BBcQ== X-Gm-Message-State: AOAM531FG/VIMBbhHn9LMWSZxoz/a1aCj56jtgPCkl54FkGkYu5PEth2 lxVy6K8zGSLZCLzL+Px7MBxkn/lcP6o= X-Google-Smtp-Source: ABdhPJzmdNRVbxJm9oc3XfWGz4c6WGDu12iLkLk4Olz3zXQ2/IurD0RM3iHkujOA/6apdqWhM0aqPw== X-Received: by 2002:a7b:c5d6:0:b0:381:4127:84d3 with SMTP id n22-20020a7bc5d6000000b00381412784d3mr16290007wmk.24.1650309745832; Mon, 18 Apr 2022 12:22:25 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id p3-20020a5d59a3000000b0020a83f00487sm8400548wrr.9.2022.04.18.12.22.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Apr 2022 12:22:24 -0700 (PDT) Message-ID: <47f30ec4-db20-e15e-4b0c-d287ca2140ba@palves.net> Date: Mon, 18 Apr 2022 20:22:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 5/5] gdbsupport: add path_join function Content-Language: en-US To: Simon Marchi , Lancelot SIX Cc: Simon Marchi , gdb-patches@sourceware.org References: <20220414200137.3479373-1-simon.marchi@polymtl.ca> <20220414200137.3479373-5-simon.marchi@polymtl.ca> <20220415143827.t2nlcfhmh2pondev@ubuntu.lan> From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2022 19:22:28 -0000 On 2022-04-18 19:43, Simon Marchi via Gdb-patches wrote: > > So, IMO, the behavior I implemented makes more sense for us. I just > don't know what it would mean on Windows. What would this give? > > path_join ("C:/hello", "D:/hi", nullptr); In solib_find_1, we have_ /* Note, we're interested in IS_TARGET_ABSOLUTE_PATH, not IS_ABSOLUTE_PATH. The latter is for host paths only, while IN_PATHNAME is a target path. For example, if we're supposed to be handling DOS-like semantics we want to consider a 'c:/foo/bar.dll' path as an absolute path, even on a Unix box. With such a path, before giving up on the sysroot, we'll try: 1st attempt, c:/foo/bar.dll ==> /sysroot/c:/foo/bar.dll 2nd attempt, c:/foo/bar.dll ==> /sysroot/c/foo/bar.dll 3rd attempt, c:/foo/bar.dll ==> /sysroot/foo/bar.dll */ ... /* If the search in gdb_sysroot failed, and the path name has a drive spec (e.g, c:/foo), try stripping ':' from the drive spec, and retrying in the sysroot: c:/foo/bar.dll ==> /sysroot/c/foo/bar.dll. */ if (found_file < 0 && sysroot != NULL && HAS_TARGET_DRIVE_SPEC (fskind, in_pathname)) { If you're going to convert the path concating here to use path_join, then you'd want to just leave the D: in the path. Or maybe this here wouldn't be converted, not sure... Ideally we'd have the same logic where we prepend debug paths to source paths, I think.