[systemd-devel] Tips for using GDB to analyze systemd init process (`/sbin/init`)
Lennart Poettering
lennart at poettering.net
Thu Apr 9 04:36:48 PDT 2015
On Sat, 14.03.15 09:14, Paul Menzel (paulepanter at users.sourceforge.net) wrote:
> Dear systemd folks,
>
>
> using Debian Sid/unstable with systemd 215-12, I attached to it with GDB
> to analyze some things. Attached with `gdb --pid 1` worked.
>
> But continuing the execution and then hitting Ctrl + c to stop and
> analyze it again, systemd caught that command and shut the system down.
>
> How do you accomplish the goal to analyze systemd with GDB?
All programs that use signalfd() are really nasty to debug in gdb,
since gdb doesn't catch the Ctl-C then anymore via ptrace, but it gets
delivered to the signalfd instead, and thus handled by the app anyway.
To work around this: keep a second terminal open and send SIGTRAP from
there.
I usually carefully set break points though so that I never have to
deal with PID 1 running uncontrolled in gdb though...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list