From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] [PR gdb/27614] gdb-add-index fails on symlinks.
Date: Fri, 26 Mar 2021 19:44:28 +0000 [thread overview]
Message-ID: <YF45nGUWMdHZAkUg@Plymouth> (raw)
In-Reply-To: <1b31f1e8-9379-d6f7-afb6-40a6ce7fb379@polymtl.ca>
Le Fri, Mar 26, 2021 at 02:53:12PM -0400, Simon Marchi a écrit :
> BSDs' readlink doesn't have the -e option, so it would probably derail
> from here (should we also check the exit status of readlink to make sure
> it worked? did you try with a symlink pointing to a non-existent file /
> with a non-existent component?).
>
> Would it work with just `readlink <file>`?
This would fail if $file is a symlink to a symlink. This is what
ldconfig usually does (libfoo.so -> libfoo.so.x -> libfoo.so.x.y).
I guess the most robust approach will be something like:
${GDB} --batch -nx -iex 'set auto-load no' \
-iex "file '$file'" -iex 'maint info bfds' | \
awk -F/ '{ fname=$NF } END { print fname }'
This rely on how 'maint info bfds' formats its output and I am not
sure how stable shit will be in time, but hopefully the new test case
will catch any breackage.
This will require few more tweaks along the way but nothing too fanncy.
I’ll do that unless there is a simpler and as portable approach
available.
Lancelot.
>
> Simon
>
prev parent reply other threads:[~2021-03-26 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 17:11 Lancelot SIX via Gdb-patches
2021-03-26 18:53 ` Simon Marchi via Gdb-patches
2021-03-26 19:44 ` Lancelot SIX via Gdb-patches [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=YF45nGUWMdHZAkUg@Plymouth \
--to=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
--cc=simon.marchi@polymtl.ca \
/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