public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org, tom@tromey.com
Subject: Re: [PATCH v2] gdb/configure.ac: Add option --with-additional-debug-dirs
Date: Thu, 05 Oct 2023 20:12:17 -0300	[thread overview]
Message-ID: <87y1ggll4e.fsf@linaro.org> (raw)
In-Reply-To: <831qe964lt.fsf@gnu.org>


Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: Tom Tromey <tom@tromey.com>
>> Date: Wed,  4 Oct 2023 15:31:02 -0300
>> From: Thiago Jung Bauermann via Gdb-patches <gdb-patches@sourceware.org>
>> 
>> If you want to install GDB in a custom prefix, have it look for debug info
>> in that prefix but also in the distro's default location (typically,
>> /usr/lib/debug) and run the GDB testsuite before doing "make install", you
>> have a bit of a problem:
>> 
>> Configuring GDB with '--prefix=$PREFIX' sets the GDB 'debug-file-directory'
>> parameter to $PREFIX/lib/debug.  Unfortunately this precludes GDB from
>> looking for distro-installed debug info in /usr/lib/debug.  For regular GDB
>> use you could set debug-file-directory to $PREFIX:/usr/lib/debug in
>> $PREFIX/etc/gdbinit so that GDB will look in both places, but if you want
>> to run the testsuite then that doesn't help because in that case GDB runs
>> with the '-nx' option.
>> 
>> There's the configure option '--with-separate-debug-dir' to set the default
>> value for 'debug-file-directory', but it accepts only one directory and not
>> a list.  I considered modifying it to accept a list, but it's not obvious
>> how to do that because its value is also used by BFD, as well as processed
>> for "relocatability".
>> 
>> I thought it was simpler to add a new option to specify a list of
>> additional directories that will be appended to the debug-file-directory
>> setting.
>
> Thanks, the documentation parts are okay.

Thank you!

> However, I wonder: on MS-Windows, the "colon-separated list" becomes
> "semi-colon separated list", and I have an old and annoying problem
> with 2 similar configure-time options, --with-auto-load-safe-path= and
> --with-auto-load-dir=, which fail to communicate semi-colon separated
> lists to gdb/configure, and require me to manually edit gdb/config.h
> and rebuild.  So I wonder whether this new option will have the same
> problem, and whether we could perhaps take this opportunity for fixing
> this?
>
> This is https://sourceware.org/bugzilla/show_bug.cgi?id=18898, btw.

I looked a bit into this, and I don't see an easy solution. The problem
is that shell scripting language is notoriously bad at keeping data from
leaking into the code.

If I do:

$ ~/src/binutils-gdb/configure \
    --disable-{binutils,ld,gold,gas,sim,gprof,gprofng} \
    --with-auto-load-dir='foo;bar' && make

I get:

checking for default auto-load directory... /home/bauermann/src/binutils-gdb/gdb/configure: line 18004: bar: command not found
foo;bar
checking for default auto-load safe-path... /home/bauermann/src/binutils-gdb/gdb/configure: line 18031: bar: command not found
foo;bar

Line 18004 is:

ac_define_dir=`eval echo $escape_dir`

Line 18031 is identical.

If the configure script could use bash features instead of having to
assume a POSIX shell, we could use "printf %q" to escape the input. Is
there an equivalent solution that's in POSIX shell?

In any case, any solution would be in an autoconf macro, not in GDB.

As a workaround, I was able to get away with some escaping:

$ ~/src/binutils-gdb/configure \
    --disable-{binutils,ld,gold,gas,sim,gprof,gprofng} \
    --with-auto-load-dir='foo\\\;bar\\\;baz' && make
    ⋮
checking for default auto-load directory... foo\\\;bar\\\;baz
checking for default auto-load safe-path... foo\\\;bar\\\;baz
    ⋮
$ grep AUTO_LOAD gdb/config.h
#define AUTO_LOAD_DIR "foo;bar;baz"
#define AUTO_LOAD_SAFE_PATH "foo;bar;baz"


> Reviewed-By: Eli Zaretskii <eliz@gnu.org>


-- 
Thiago

  reply	other threads:[~2023-10-05 23:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 18:31 Thiago Jung Bauermann
2023-10-05  5:05 ` Eli Zaretskii
2023-10-05 23:12   ` Thiago Jung Bauermann [this message]
2023-10-07  7:01     ` Eli Zaretskii
2023-10-26 11:58       ` Eli Zaretskii
2023-10-26 23:48         ` Thiago Jung Bauermann
2023-10-27  5:59           ` Eli Zaretskii
2023-10-05 15:16 ` Tom Tromey
2023-10-06  2:03   ` Thiago Jung Bauermann

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=87y1ggll4e.fsf@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).