[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically modifying the gud-gdb command line

From: Patrick Mahan
Subject: Re: Automatically modifying the gud-gdb command line
Date: Tue, 23 Jun 2020 14:25:22 -0700

On Tue, Jun 23, 2020 at 1:35 PM Emanuel Berg via Users list for the GNU
Emacs text editor <> 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
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

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

So I am looking for suggestions ;-)



> --
> underground experts united

reply via email to

[Prev in Thread] Current Thread [Next in Thread]