comparison Sphinx/source/faq/crash.rst @ 1009:b7835da59750

updated instructions for gdb/cgdb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jan 2024 18:42:52 +0100
parents 2e103fb1fa11
children
comparison
equal deleted inserted replaced
1008:23a54088d604 1009:b7835da59750
53 GNU/Linux system using gdb 53 GNU/Linux system using gdb
54 -------------------------- 54 --------------------------
55 55
56 .. highlight:: bash 56 .. highlight:: bash
57 57
58 The Orthanc project provides precompiled debug binaries that can be 58 The Orthanc project provides precompiled binaries with debug symbols
59 run on almost any recent GNU/Linux system (generated thanks to the 59 for the mainline that can run on almost any recent GNU/Linux system
60 `LSB - Linux Standard Base SDK 60 (generated thanks to the `LSB - Linux Standard Base SDK
61 <https://en.wikipedia.org/wiki/Linux_Standard_Base>`__). This allows 61 <https://en.wikipedia.org/wiki/Linux_Standard_Base>`__). This allows
62 to generate a backtrace (the famous "core dumped" message) that can be 62 to generate a backtrace (the famous "core dumped" message) that can be
63 analyzed by any developer of Orthanc. Assuming that the :ref:`plugin 63 analyzed by any developer of Orthanc. Assuming that the :ref:`plugin
64 above <segfault-plugin>` is available as the ``crash.cpp`` file, here 64 above <segfault-plugin>` is available as the ``crash.cpp`` file, here
65 is a sample debug session:: 65 is a sample debug session::
66 66
67 $ wget https://lsb.orthanc-server.com/orthanc/debug/1.12.2/Orthanc 67 $ wget https://orthanc.uclouvain.be/downloads/linux-standard-base/orthanc/mainline-debug/Orthanc
68 $ chmod +x ./Orthanc 68 $ chmod +x ./Orthanc
69 $ gcc -fPIC -shared ./crash.cpp -I ~/orthanc/Plugins/Include -o crash.so 69 $ g++ -fPIC -shared ./crash.cpp -I ~/orthanc/OrthancServer/Plugins/Include -o crash.so
70 $ ulimit -c unlimited 70 $ ulimit -c unlimited
71 $ echo '{ "Plugins" : ["crash.so"] }' > Configuration.json 71 $ echo '{ "Plugins" : ["./crash.so"] }' > Configuration.json
72 $ rm -f core ; ./Orthanc Configuration.json 72 $ rm -f core ; ./Orthanc Configuration.json
73 W0427 15:43:24.215783 main.cpp:1436] Orthanc version: 1.12.2 73 W0103 18:05:01.661466 MAIN main.cpp:2041] Orthanc version: mainline (20240103T170440)
74 W0427 15:43:24.215910 main.cpp:1279] Performance warning: Non-release build, runtime debug assertions are turned on 74 W0103 18:05:01.661583 MAIN main.cpp:1775] Performance warning: Non-release build, runtime debug assertions are turned on
75 W0427 15:43:24.217585 OrthancConfiguration.cpp:61] Reading the configuration from: "Configuration.json" 75 W0103 18:05:01.661800 MAIN OrthancConfiguration.cpp:57] Reading the configuration from: "Configuration.json"
76 W0427 15:43:24.254733 main.cpp:700] Loading plugin(s) from: crash.so 76 W0103 18:05:01.864783 MAIN main.cpp:912] Loading plugin(s) from: ./crash.so
77 W0427 15:43:24.254866 PluginsManager.cpp:269] Registering plugin 'crash' (version 0.0) 77 W0103 18:05:01.864883 MAIN PluginsManager.cpp:261] Registering plugin 'crash' (version 0.0)
78 Segmentation fault (core dumped) 78 Segmentation fault (core dumped)
79 79
80 80
81 .. highlight:: text 81 .. highlight:: text
82 82
83 This session creates a file called ``core`` in the current working 83 This session creates a file called ``core`` in the current working
84 directory. You can analyze it by running ``gdb`` as follows:: 84 directory. If you don't see this file, it probably means that your
85 GNU/Linux distribution customizes the name of core files (this is for
86 instance the case of Ubuntu 22.04 that sends core files to
87 ``apport``). You can temporarily disable this behavior by typing::
85 88
86 $ gdb -c ./core ./Orthanc 89 $ echo core | sudo tee /proc/sys/kernel/core_pattern
90
91
92 You can then analyze the ``core`` file by running ``gdb`` as follows::
93
94 $ gdb -c ./core.424217 ./Orthanc
87 (gdb) bt 95 (gdb) bt
88 #0 0x00007f7b1aa3d739 in OrthancPluginInitialize () from crash.so 96 #0 0x00007f5943308111 in OrthancPluginInitialize () from ./crash.so
89 #1 0x00000000008632f0 in Orthanc::CallInitialize (plugin=..., context=...) 97 #1 0x00000000005e1cbc in Orthanc::CallInitialize (plugin=..., context=...)
90 at /home/jodogne/BuildBotWorker/Orthanc_1_5_6_-_LSB_Debug/build/Plugins/Engine/PluginsManager.cpp:98 98 at /home/jodogne/BuildBotWorker/Orthanc_mainline_-_LSB_Debug/build/OrthancServer/Plugins/Engine/PluginsManager.cpp:87
91 #2 0x0000000000864496 in Orthanc::PluginsManager::RegisterPlugin (this=0x4314f90, path="crash.so") 99 #2 0x00000000005e2f14 in Orthanc::PluginsManager::RegisterPlugin (this=0x2edc220, path="./crash.so")
92 at /home/jodogne/BuildBotWorker/Orthanc_1_5_6_-_LSB_Debug/build/Plugins/Engine/PluginsManager.cpp:272 100 at /home/jodogne/BuildBotWorker/Orthanc_mainline_-_LSB_Debug/build/OrthancServer/Plugins/Engine/PluginsManager.cpp:264
93 ...
94 101
95 If you are unable to analyze such a backtrace by yourself, feel free 102 If you are unable to analyze such a backtrace by yourself, feel free
96 to post your ``core`` file on the `Orthanc Users discussion forum 103 to post your ``core`` file on the `Orthanc Users discussion forum
97 <https://discourse.orthanc-server.org>`__. 104 <https://discourse.orthanc-server.org>`__. Do not forget to indicate
105 the content of
106 `<https://orthanc.uclouvain.be/downloads/linux-standard-base/orthanc/mainline-debug/revision.txt>`__
107 so that we can find the version of Orthanc that generated the core
108 file.
109
98 110
99 **Important:** The Orthanc developers will only be able to analyze the 111 **Important:** The Orthanc developers will only be able to analyze the
100 ``core`` files generated by our own precompiled binaries! 112 ``core`` files generated by our own precompiled binaries!
101
102
103 Docker
104 ------
105
106 To be written.