* Automatically modifying the gud-gdb command line
@ 2020-06-23 20:21 Patrick Mahan
2020-06-23 20:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Mahan @ 2020-06-23 20:21 UTC (permalink / raw)
To: help-gnu-emacs
Before wandering off into the bowels of the GUD lisp code, I was wonder if
anyone has ever done what I want (I could not find anything on the Emacs
Wiki site nor via google-fu).
Basically, when I am starting a debug session, I enter the command 'gud-gdb
<ENTER>' which then prompts me with 'Run gud-gdb (like this): gdb
--fullname <image>'. Now I have code that breaks apart a core dump into
its core file and the image that dumped and creates a gdb init file. I
then modify the command line that gud-gdb prompted me with by adding '-x
gdbinit' and 'core.XXXX' to that line and starting the debug session.
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 that I can then give to our tech-support guys to do the
preliminary phase 1 analysis. I like the way emacs presents the output,
especially since they will have sources to dump and it is easier in emacs
to walk up the backtrace display source.
Any pointers would be appreciated.
Thanks,
Patrick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
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
0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-06-23 20:34 UTC (permalink / raw)
To: help-gnu-emacs
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
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
2020-06-23 20:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-06-23 21:25 ` Patrick Mahan
2020-06-23 21:36 ` tomas
2020-06-23 21:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 7+ messages in thread
From: Patrick Mahan @ 2020-06-23 21:25 UTC (permalink / raw)
To: Emanuel Berg, help-gnu-emacs
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
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
2020-06-23 21:25 ` Patrick Mahan
@ 2020-06-23 21:36 ` tomas
2020-06-24 2:26 ` Patrick Mahan
2020-06-23 21:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 7+ messages in thread
From: tomas @ 2020-06-23 21:36 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Tue, Jun 23, 2020 at 02:25:22PM -0700, Patrick Mahan wrote:
[...]
> 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.
FWIW, gud-gdb takes an optional argument, COMMAND-LINE. So perhaps
all you've to do is to call gud-gdb with an argument?
Alternatively, there's the (configurable) variable gud-gud-gdb-command-name.
HTH
-- tomás
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
2020-06-23 21:25 ` Patrick Mahan
2020-06-23 21:36 ` tomas
@ 2020-06-23 21:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-06-23 21:43 UTC (permalink / raw)
To: help-gnu-emacs
Patrick Mahan wrote:
> 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'.
Aha, gotcha, then it is `gud-gud-gdb-command-name' !
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
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
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Mahan @ 2020-06-24 2:26 UTC (permalink / raw)
To: tomas; +Cc: help-gnu-emacs
On Tue, Jun 23, 2020 at 2:37 PM <tomas@tuxteam.de> wrote:
> On Tue, Jun 23, 2020 at 02:25:22PM -0700, Patrick Mahan wrote:
>
> [...]
>
> > 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.
>
> FWIW, gud-gdb takes an optional argument, COMMAND-LINE. So perhaps
> all you've to do is to call gud-gdb with an argument?
>
>
Hmmm, I overlooked that, let me investigate this.
> Alternatively, there's the (configurable) variable
> gud-gud-gdb-command-name.
>
>
No, that is what I originally attempted to modify but I cannot insert the
core file *after* the image file. Let me play with setting the
COMMAND-LINE.
Thanks,
Patrick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Automatically modifying the gud-gdb command line
2020-06-24 2:26 ` Patrick Mahan
@ 2020-06-24 4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-06-24 4:19 UTC (permalink / raw)
To: help-gnu-emacs
Patrick Mahan wrote:
>> Alternatively, there's the (configurable) variable
>> gud-gud-gdb-command-name.
>
> No, that is what I originally attempted to modify
> but I cannot insert the core file *after* the
> image file.
???
Maybe you can just write a simple defun and bind that
to a key in the minor mode, and have it it insert
anything you'd tell it to?
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-06-24 4:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).