all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Patrick Mahan <plmahan@gmail.com>
To: Emanuel Berg <moasenwood@zoho.eu>, help-gnu-emacs@gnu.org
Subject: Re: Automatically modifying the gud-gdb command line
Date: Tue, 23 Jun 2020 14:25:22 -0700	[thread overview]
Message-ID: <CAFDHx1Ko4Vb=ONL07TZXKc0b7zX=rQ33JZL5uaXpFqDTmRkQxg@mail.gmail.com> (raw)
In-Reply-To: <87o8p95xo9.fsf@ebih.ebihd>

On Tue, Jun 23, 2020 at 1:35 PM Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Patrick Mahan wrote:
>
> > I would like to automate this process (can
> > I pre-config the command line used by gud-gdb?) so
> > I can possibly turn this into a simple turnkey
> > procedure
>
> Can't you do it with gdb aliases?
>
>   (info "(gdb) Aliases")
>
> or
>
>
> https://www.zeuthen.desy.de/dv/documentation/unixguide/infohtml/gdb/Aliases.html
>
>
No, that is not what I am looking to do.  I am looking to change the actual
gdb invocation command automatically as opposed to manually.

For example, if I have a crash report from a customer, it consists of
(among other things) the image that crashed and the core file.  I have a
shell script that pulls some symbols (using nm) from the image to determine
which source release branch, etc, and uses this information to generate a
gdb init script.

Say I am debugging our routerd process, I would have the routerd ELF image
and the core file.

I then invoke gdb from inside emacs using 'M-x gud-gdb <ENTER>'.  This
produces the prompt: 'Run gud-gdb (like this): gdb --fullname routerd'

I then manually modify that to be 'Run gud-gdb (like this): gdb --fullname
-x routerd.gdbinit routerd core.1234' hit enter and gdb is launched with
the GUD front-end and my symbols are loaded, all .so are found, etc.  I can
then begin my debugging, usually by first doing a 'info threads'.

But what I am trying to achieve is a way to just have 'M-x gud-gdb <ENTER>'
prompt with 'Run gud-gdb (like this): gdb --fullname routerd.gdbinit
routerd core.1234'.

The caveat being that I only want the changes if those files exist in the
local directory.  Looking at the gud-gdb command in I see that the prompt
is coming from gud-query-cmdline: '(interactive (list (gud-query-cmdline
'gud-gdb)))'.

I see there is a global variable I can customize 'gud-gud-gdb-command-name'
that is initially set to "gdb --fullname".  I do not see any hooks
available to change that value on the fly, so I was planning to mod it
before invoking gud-gdb.  However, there does not seem to be a mechanism to
add the 'core.1234' to the line as well short of modifying
'gud-query-cmdline'.

So I am looking for suggestions ;-)

Thanks,

Patrick

> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>


  reply	other threads:[~2020-06-23 21:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 20:21 Automatically modifying the gud-gdb command line Patrick Mahan
2020-06-23 20:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-06-23 21:25   ` Patrick Mahan [this message]
2020-06-23 21:36     ` tomas
2020-06-24  2:26       ` Patrick Mahan
2020-06-24  4:19         ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-06-23 21:43     ` Emanuel Berg via Users list for the GNU Emacs text editor

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='CAFDHx1Ko4Vb=ONL07TZXKc0b7zX=rQ33JZL5uaXpFqDTmRkQxg@mail.gmail.com' \
    --to=plmahan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.