mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 23:54:07 +02:00
parent
8d0db56f33
commit
85af84c9fb
@ -252,17 +252,17 @@ Compiled binaries require the `-DCMAKE_BUILD_TYPE=RelWithDebInfo` or
|
|||||||
Install gdb:
|
Install gdb:
|
||||||
|
|
||||||
# yum install gdb
|
# yum install gdb
|
||||||
|
|
||||||
# zypper install gdb
|
# zypper install gdb
|
||||||
|
|
||||||
# apt-get install gdb
|
# apt-get install gdb
|
||||||
|
|
||||||
Install the `boost`, `python` and `icinga2` pretty printers. Absolute paths are required,
|
Install the `boost`, `python` and `icinga2` pretty printers. Absolute paths are required,
|
||||||
so please make sure to update the installation paths accordingly (`pwd`).
|
so please make sure to update the installation paths accordingly (`pwd`).
|
||||||
|
|
||||||
Boost Pretty Printers:
|
Boost Pretty Printers:
|
||||||
|
|
||||||
$ mkdir ~/.gdb_printers && cd ~/.gdb_printers
|
$ mkdir -p ~/.gdb_printers && cd ~/.gdb_printers
|
||||||
$ git clone https://github.com/ruediger/Boost-Pretty-Printer.git && cd Boost-Pretty-Printer
|
$ git clone https://github.com/ruediger/Boost-Pretty-Printer.git && cd Boost-Pretty-Printer
|
||||||
$ pwd
|
$ pwd
|
||||||
/home/michi/.gdb_printers/Boost-Pretty-Printer
|
/home/michi/.gdb_printers/Boost-Pretty-Printer
|
||||||
@ -272,41 +272,35 @@ Python Pretty Printers:
|
|||||||
$ cd ~/.gdb_printers
|
$ cd ~/.gdb_printers
|
||||||
$ svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
|
$ svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
|
||||||
|
|
||||||
Icinga 2 Pretty Printers:
|
Icinga 2 Pretty Printers:
|
||||||
|
|
||||||
$ mkdir -p ~/.gdb_printers/icinga2 && ~/.gdb_printers/icinga2
|
$ mkdir -p ~/.gdb_printers/icinga2 && cd ~/.gdb_printers/icinga2
|
||||||
$ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/icingadbg.py
|
$ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/icingadbg.py
|
||||||
|
|
||||||
Now you'll need to modify/setup your `~/.gdbinit` configuration file.
|
Now you'll need to modify/setup your `~/.gdbinit` configuration file.
|
||||||
You can download the one from Icinga 2 and modify all paths.
|
You can download the one from Icinga 2 and modify all paths.
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> The path to the `pthread` library varies on distributions. Use
|
|
||||||
> `find /usr/lib* -type f -name '*libpthread.so*'` to get the proper
|
|
||||||
> path.
|
|
||||||
|
|
||||||
Example on Fedora 20 x64:
|
Example on Fedora 20 x64:
|
||||||
|
|
||||||
$ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/gdbinit -O ~/.gdbinit
|
$ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/gdbinit -O ~/.gdbinit
|
||||||
$ vim ~/.gdbinit
|
$ vim ~/.gdbinit
|
||||||
|
|
||||||
set env LD_PRELOAD /usr/lib64/libpthread.so
|
set print pretty on
|
||||||
|
|
||||||
python
|
python
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, '/home/michi/.gdb_printers/icinga2')
|
sys.path.insert(0, '/home/michi/.gdb_printers/icinga2')
|
||||||
from icingadbg import register_icinga_printers
|
from icingadbg import register_icinga_printers
|
||||||
register_icinga_printers()
|
register_icinga_printers()
|
||||||
end
|
end
|
||||||
|
|
||||||
python
|
python
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, '/home/michi/.gdb_printers/python')
|
sys.path.insert(0, '/home/michi/.gdb_printers/python')
|
||||||
from libstdcxx.v6.printers import register_libstdcxx_printers
|
from libstdcxx.v6.printers import register_libstdcxx_printers
|
||||||
register_libstdcxx_printers(None)
|
register_libstdcxx_printers(None)
|
||||||
end
|
end
|
||||||
|
|
||||||
python
|
python
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, '/home/michi/.gdb_printers/Boost-Pretty-Printer')
|
sys.path.insert(0, '/home/michi/.gdb_printers/Boost-Pretty-Printer')
|
||||||
@ -314,14 +308,18 @@ Example on Fedora 20 x64:
|
|||||||
register_printer_gen(None)
|
register_printer_gen(None)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
If you are getting the following error when running gdb, the `libstdcxx`
|
||||||
|
printers are already preloaded in your environment and you can remove
|
||||||
|
the duplicate import in your `~/.gdbinit` file.
|
||||||
|
|
||||||
|
RuntimeError: pretty-printer already registered: libstdc++-v6
|
||||||
|
|
||||||
### <a id="development-debug-gdb-run"></a> GDB Run
|
### <a id="development-debug-gdb-run"></a> GDB Run
|
||||||
|
|
||||||
Call GDB with the binary and all arguments and run it in foreground.
|
Call GDB with the binary and all arguments and run it in foreground.
|
||||||
|
|
||||||
# gdb --args /usr/sbin/icinga2 daemon -x debug
|
# gdb --args /usr/sbin/icinga2 daemon -x debug
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> If gdb tells you it's missing debug symbols, quit gdb and install
|
> If gdb tells you it's missing debug symbols, quit gdb and install
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set env LD_PRELOAD /lib/x86_64-linux-gnu/libpthread.so.0
|
set print pretty on
|
||||||
|
|
||||||
python
|
python
|
||||||
import sys
|
import sys
|
||||||
|
Loading…
x
Reference in New Issue
Block a user