Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC] New option -B: simplify running gdb from build directory
Date: Fri, 27 Dec 2013 19:54:00 -0000	[thread overview]
Message-ID: <CADPb22QJiypSbSRb4ZMKbXOUVOW3gTGPe6U9sT_mzpz-cxuUXw@mail.gmail.com> (raw)
In-Reply-To: <yjt2lhz6t716.fsf@ruffy.mtv.corp.google.com>

On Fri, Dec 27, 2013 at 11:42 AM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> The "make run" Makefile rule simplifies running gdb from the shell,
> but it doesn't simplify running gdb from gdb: I'm always typing
> "--data-directory=$(pwd)/data-directory".
> And since we can't agree on a way to let gdb auto-detect being run
> from the build directory, how about this?
>
> This patch provides a new option, -B, which if provided tells gdb
> it *may* have been run from the build directory.  If -B was provided
> and --data-directory was not provided, use a heuristic to determine
> if gdb was run from the build directory and if so set gdb_datadir
> appropriately.
>
> We can certainly discuss what's the best heuristic to use here.
> We don't, IMO, have to employ too complicated a heuristic because
> the user has explicitly passed -B.
> OTOH, I'm sure one can improve a bit on the heuristic that's here.
> One thought I have is to have the Makefile create a file with a name that
> is reasonably obscure (maybe even pseudo-cryptographically secure and encode
> the name in gdb?), and then simplify the test by just checking for that file.
>
> If we can agree on this approach, I'll add NEWS and docs.
>
> 2013-12-27  Doug Evans  <dje@google.com>
>
>         * main.c (maybe_run_from_builddir): New global.
>         (get_builddir): New function.
>         (captured_main): New option enum OPT_BATCH_SILENT, use it for
>         --batch-silent instead of 'B'.  Add option -B: If -B is provided
>         and --data-directory is not, see if being run from build directory
>         and use that for gdb_datadir if so.

Blech, I shouldn't assume gdb_program_name is an absolute path.  I'll
fix that in the next revision.

[OTOH, the caller could be the one to ensure gdb_datadir is an
absolute path since we don't do that yet if a relative path is passed
to --data-directory.]


  reply	other threads:[~2013-12-27 19:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27 19:42 Doug Evans
2013-12-27 19:54 ` Doug Evans [this message]
2013-12-27 20:15 ` Eli Zaretskii
2013-12-27 20:51   ` Doug Evans
2014-03-06 21:41 ` [PATCH, doc RFA] " Doug Evans
2014-03-07  7:10   ` Eli Zaretskii
     [not found]     ` <CADPb22RKaBx1p2vF4-wGODZVe-QqdGc93Ax-bD82xb9Adr5EJw@mail.gmail.com>
2014-03-07 18:41       ` Eli Zaretskii
2014-03-07 18:54         ` Doug Evans
2014-03-25  1:02           ` Doug Evans
2014-03-25  1:20             ` Doug Evans
2014-03-25  1:28               ` Doug Evans
2014-04-28 22:35                 ` [PATCH, doc RFA] New option -D: alias for --data-directory Doug Evans
2014-04-29  2:37                   ` Eli Zaretskii
2014-05-16 19:17                     ` Doug Evans

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=CADPb22QJiypSbSRb4ZMKbXOUVOW3gTGPe6U9sT_mzpz-cxuUXw@mail.gmail.com \
    --to=dje@google.com \
    --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