You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Debugging

Logs / Print Statements

A typical debugging technique is to make use of prints and/or logging entries. This is no more than adding debug lines in the preferred programming language:

C++ Print / Logging
printf("A log message: %d - %s\n", num, msg);
std::cout << "A log message: " << num << " - " << msg << std::endl;
ACS_SHORT_LOG((LM_INFO, "A log message %d - %s", num, msg));
Java Print / Logging
System.out.println("A log message: " + num +" - " + msg);
m_logger.info("A log message: " + num +" - " + msg);
C++ Print / Logging
print("A log message: %d - %s\n" % (num, msg))
print("A log message: " + str(num) + " - " + msg)
print("A log message: ", num, msg)
logger.logInfo("A log message: %d - %s" % (num, msg)
logger.logInfo("A log message: " + str(num) + " - " + msg)

C++

GDB

A more advanced debugging technique is the use of gdb. The use is the same as with a normal process; it could be used with a core dump, attaching to a running (client/container) process or start your client/container with appropriate parameters.

Opening a core dump with GDB
> gdb maciContainer core.gas03.maciContainer.31215
#Or
> gdb -c core.gas03.maciContainer.31215 maciContainer
Attaching to a running process
> ps aux |grep maciContainer
almamgr   106852  1.8  0.2 1159516 43512 pts/2   Sl+  01:09   0:00 maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager

> gdb -p 106852
#Or
> gdb -p $(ps aux |grep maciContainer | grep bilboContainer | awk '{print $2}')
Start a container in GDB
#It is usually better to inspect the parameters used by the container started by ACS / ACS Daemons
> ps aux |grep maciContainer |grep bilboContainer
almamgr   106852  1.8  0.2 1159516 43512 pts/2   Sl+  01:09   0:00 maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager

# We then simply copy the part starting from maciContainer:
> gdb --args maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager
(gdb) r


Valgrind

  • No labels