icinga2/doc/8-development.md

2.7 KiB

Icinga 2 Development

You can follow Icinga 2's development closely by checking out these resources:

For general support questions, please refer to [https://www.icinga.org/support/].

Debug Icinga 2

Make sure that the debug symbols are available for Icinga 2. The Icinga 2 packages provide a debug package which must be installed seperately for all involved binaries, like icinga2-bin or icinga2-ido-mysql.

# yum install icinga2-bin-debuginfo icinga2-ido-mysql-debuginfo

Compiled binaries require the -DCMAKE_BUILD_TYPE=RelWithDebInfo or -DCMAKE_BUILD_TYPE=Debug cmake build flags.

GDB

Call GDB with the binary and all arguments and run it in foreground.

# gdb --args /usr/sbin/icinga2 -c /etc/icinga2/icinga2.conf -x

GDB Run

Run the application.

(gdb) r

Kill the running application.

(gdb) k

Continue after breakpoint.

(gdb) c

GDB Backtrace

If Icinga 2 aborted its operation abnormally, generate a backtrace.

(gdb) bt
(gdb) bt full

Tip

If you're opening an issue at [https://dev.icinga.org] make sure to attach as much details as possible.

GDB Backtrace Stepping

Identifying the problem may require stepping into the backtrace analysing the current scope, attributes and possible unmet requirements. p prints the value of the selected variable or function call result, if applicable.

(gdb) up
(gdb) down
(gdb) p checkable
(gdb) p checkable-GetName()

GDB Breakpoints

Set a breakpoint to a specific function call, or file specific line.

(gdb) b checkable.cpp:125
(gdb) b icinga::Checkable::SetEnablePerfdata

GDB will ask about loading the required symbols later, select yes instead of no.

Then run Icinga 2 until it reaches the first breakpoint. Continue with c afterwards.

(gdb) run
(gdb) c

If you want to delete all breakpoints, use d and select yes.

(gdb) d