I’m new to this field.
I’ve installed Fiware-orion via source on my VM (centOS), by following the link below:
https://fiware-orion.readthedocs.io/en/master/admin/build_source/index.html
.
Currently I’m working on a Fiware-Orion issue, but I don’t know how to debug Fiware-Orion. I’ve searched on google and Official documentation of Fiware-Orion but I don’t find any relative documentation/material related to Fiware-Orion debugging.
I’ve find some commands related to Orion debugging (but I don’t know whether these commands are correct or not) and I’m following these commands:
-> First installed orion from source and mongoDB then,
- make di
./BUILD_DEBUG/src/app/contextBroker/contextBroker -port 1026
curl localhost:1026/version
- gdb
./BUILD_DEBUG/src/app/contextBroker/contextBroker -tui
- b (lineNo)
-
run
[root@localhost fiware-orion]# gdb ./BUILD_DEBUG/src/app/contextBroker/contextBroker
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /root/workingDir/fiware-orion/BUILD_DEBUG/src/app/contextBroker/contextBroker...done. (gdb) b 101 Breakpoint 1 at 0x6033c9: file /root/workingDir/fiware-orion/src/app/contextBroker/contextBroker.cpp, line 101. (gdb) run Starting program: /root/workingDir/fiware-orion/./BUILD_DEBUG/src/app/contextBroker/contextBroker [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, fileExists (path=0xbfc380 <pidPath> "/tmp/contextBroker.pid") at /root/workingDir/fiware-orion/src/app/contextBroker/contextBroker.cpp:371 371 if (access(path, F_OK) == 0) Missing separate debuginfos, use: debuginfo-install boost-filesystem-1.53.0-27.el7.x86_64 boost-regex-1.53.0-27.el7.x86_64 boost-system-1.53.0-27.el7.x86_64 boost-thread-1.53.0-27.el7.x86_64 cyrus-sasl-lib-2.1.26-23.el7.x86_64 glibc-2.17-292.el7.x86_64 gmp-6.0.0-15.el7.x86_64 gnutls-3.3.29-9.el7_6.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_7.2.x86_64 libcom_err-1.42.9-16.el7.x86_64 libcurl-7.29.0-54.el7_7.1.x86_64 libffi-3.0.13-18.el7.x86_64 libgcc-4.8.5-39.el7.x86_64 libgcrypt-1.5.3-14.el7.x86_64 libgpg-error-1.12-3.el7.x86_64 libicu-50.1.2-15.el7.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 libssh2-1.8.0-3.el7.x86_64 libstdc++-4.8.5-39.el7.x86_64 libtasn1-4.10-1.el7.x86_64 libuuid-2.23.2-61.el7_7.1.x86_64 nettle-2.7.1-8.el7.x86_64 nspr-4.21.0-1.el7.x86_64 nss-3.44.0-7.el7_7.x86_64 nss-softokn-freebl-3.44.0-8.el7_7.x86_64 nss-util-3.44.0-4.el7_7.x86_64 openldap-2.4.44-5.el7.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 p11-kit-0.23.5-3.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64 (gdb) list 366 * 367 * fileExists - 368 */ 369 static bool fileExists(char* path) 370 { 371 if (access(path, F_OK) == 0) 372 { 373 return true; 374 } 375 (gdb) n 376 return false; (gdb) n 377 } (gdb) n pidFile (justCheck=true) at /root/workingDir/fiware-orion/src/app/contextBroker/contextBroker.cpp:397 397 if (justCheck == true) (gdb) print justCheck $1 = true (gdb) list 876 { 877 LM_X(1, ("Fatal Error (when option '-https' is used, option '-cert' is mandatory)")); 878 } 879 } 880 881 notificationModeParse(notificationMode, ¬ificationQueueSize, ¬ificationThreadNum); // This should be called before contextBrokerInit() 882 LM_T(LmtNotifier, ("notification mode: '%s', queue size: %d, num threads %d", notificationMode, notificationQueueSize, notificationThreadNum)); 883 LM_I(("Orion Context Broker is running")); 884 885 if (fg == false) (gdb) n 882 LM_T(LmtNotifier, ("notification mode: '%s', queue size: %d, num threads %d", notificationMode, notificationQueueSize, notificationThreadNum)); (gdb) step 883 LM_I(("Orion Context Broker is running")); (gdb)
While I’m using skip(i.e. ‘s’) command to enter into the function but it moves to the next line. I don’t know where I’m making mistakes.
Actually I wanted to debug the files present inside https://github.com/telefonicaid/fiware-orion/blob/master/src/lib/
folders but I’m not able to reach there. Even, I’m not able to move out of fiware-orion/src/app/contextBroker/contextBroker.cpp
class.
Can anyone suggest me correct commands for debugging Fiware-Orion, or tell me where I’m making mistakes, please.
Is there any proper documentation available regarding to debugging the Fiware-Orion?
3
Answers
To debug Orion you would need it compiled in DEBUG mode. The release that you have installed is not. To get a debuggable Orion, you’ll have to build it from source, and compile it for debugging.
To build Orion from sources, check out the documentation here: https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/admin/build_source.md.
Build Orion using the make target “di”, which stands for “debug install”.
Good luck!
If you simply want to increase the debug level of Orion itself, the command line arguments are simply:
For example, when using a Dockerized Orion, the following
docker-compose
could be used:In my case, I use QtCreator as IDE (in particular, version 3.5.1, a bit old but it works :). QtCreator integrates nicely with gdb, so it is easy to run Orion in debug mode, set breakpoints in the graphical code editor, then stimulate Orion with requests and see how it goes (breakpoint reached, etc.).