You are not logged in.

#1 2019-01-07 16:20:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 9,667
Website

Need to autostart gdb and enable debugging to a file

Currently, I have an autostart entry in lxde:

xfce4-terminal --geometry 120x30 -e "gdb -ex run /usr/lib/kodi/kodi-x11"

When the bug manifests itself, I will need to:
1) alt+TAB to the xterm
2) physically type `ctrl+c`
3) physically type `thread apply all bt`
4) save the contents of the terminal to a file

Is there any method to automate some or all of those steps?

Last edited by graysky (2019-01-07 17:32:42)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2019-01-07 18:01:52

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,853

Re: Need to autostart gdb and enable debugging to a file

Is your question just about how to bash script with redirection to a dynamic file? Because you can just redirect >$variable or >$(command substitution).

As for the question you didn't ask, why are you trying to run gdb in the background, since if you're not doing an interactive session while running the program and trying to modify its state, then you can just print information about an existing dump using coredumpctl.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2019-01-07 22:43:13

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 9,667
Website

Re: Need to autostart gdb and enable debugging to a file

It wasn't clear to me how to save a dump using the method I outlined.  Perhaps something like this would be better:

gdb /usr/lib/kodi/kodi.bin --core=filename --batch -ex "thread apply all bt" 2>/dev/null >> /path/to/trace.log

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2019-01-08 00:10:48

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,853

Re: Need to autostart gdb and enable debugging to a file

I'm very confused, systemd-coredump is automatically configured by default to acquire and save coredumps for a program that terminates with the relevant signals.

So asking for help in your original post "how do I background a process run indirectly using gdb to automatically save a coredump" was a bit... confusing. Your edits have not exactly cleared things up, though you've now obscured the meaning of my initial response.

"When the bug manifests itself" -- nice, you never even mentioned there was a bug in the first place, now it is this well-known thing.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB