From: Max Yvon Zimmermann <max.yvon.zimmermann@campus.tu-berlin.de>
To: Guinevere Larsen <blarsen@redhat.com>, Eli Zaretskii <eliz@gnu.org>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Add wildcard matching to substitute-path rules
Date: Fri, 5 Apr 2024 07:58:08 +0200 [thread overview]
Message-ID: <7ef1913e-c578-4416-bf2a-162588bb24e8@campus.tu-berlin.de> (raw)
In-Reply-To: <58bcd451-6cec-4f11-9428-79d9b3037e88@campus.tu-berlin.de>
Sorry, I need to make a correction. This topic can be a bit more confusing at times than I initially thought.
>>> Also, in the example I stated in my last reply, no file name that matches '/foo/include' would ever match '/bar/include'. The point I was trying to get across was that two unrelated files can already be mapped onto the same file (accidentally).
>>
>> Well, two wrongs don't make a right.
>
> This is a very fair point. Having different files map to the same file in the local source directory could be annoying.
> Because this isn't a new issue per se, I thought about implementing a separate patch that would warn the user if two different files get mapped onto the same source file.
> But after some thought I realized that there are actually valid use-cases for this multi-mapping.
>
> Let's say we have the following directory structure:
>
> /inc.h
> /foo.c
> /dir/bar.c
>
> '/foo.c' includes '/inc.h' via #include "inc.h".
> '/dir/bar.c' includes '/inc.h' via #include "../inc.h"
>
> With GCC this will result in two entries in the debug info: '/inc.h' and '/dir/../inc.h'.
> For GDB these entries are two separate files. (Maybe this could changed with another patch though)
> But with the help of the following two rules we can tell GDB to treat them the same:
>
> set substitute-path /from /to
> set substitute-path /from/dir/../ /to
>
> I therefore don't know if multi-mapping should be considered wrong here.
> Also I don't think that glob matching would make this more common due to the aforementioned direction of the mapping.
> For me, this is a completely separate issue.
The rule
set substitute-path /from/dir/../ /to
would actually never match because '/dir/../inc.h' (inside '/from') would also match '/from' which is defined first.
Also you could make the case that this is not really a multi-mapping, because '/inc.h' and '/dir/../inc.h' are, of course, the same file.
But it makes implementing a usable warning more tedious.
Maybe a warning to the user is actually the right solution here but I'm not entirely sure.
What are your thoughts on this?
prev parent reply other threads:[~2024-04-05 5:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 21:26 Max Yvon Zimmermann
2024-04-02 11:46 ` Eli Zaretskii
2024-04-04 0:05 ` Max Yvon Zimmermann
2024-04-04 5:53 ` Eli Zaretskii
2024-04-04 8:52 ` Max Yvon Zimmermann
2024-04-04 11:52 ` Eli Zaretskii
2024-04-04 12:42 ` Guinevere Larsen
2024-04-04 22:52 ` Max Yvon Zimmermann
2024-04-05 5:58 ` Max Yvon Zimmermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ef1913e-c578-4416-bf2a-162588bb24e8@campus.tu-berlin.de \
--to=max.yvon.zimmermann@campus.tu-berlin.de \
--cc=blarsen@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).