...
Code Block |
---|
language | bash |
---|
title | 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}') |
Code Block |
---|
language | bash |
---|
title | 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
Valgrind is used in a very similar fashion to the GDB command to start a container:
Code Block |
---|
language | bash |
---|
title | Simple Valgrind command |
---|
|
#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:
valgrind maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager |
Of course it would make more sense to define what we actually expect from Valgrind like finding memory leaks:
Code Block |
---|
language | bash |
---|
title | Detailed Valgrind command |
---|
|
valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --show-mismatched-frees=yes maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager |
Components load and unload their definitions, leading to unknown pieces of code being analyzed sometimes:
Code Block |
---|
==115999== by 0x171DB80D: ???
==115999== by 0x171EA621: ???
==115999== by 0x1C1469AD: ??? |
This can easily be fixed if you know the libraries that you're interested in using LD_PRELOAD:
Code Block |
---|
LD_PRELOAD="$ACSROOT/lib/libacstimer.so $ACSROOT/lib/libacsclock.so" valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --show-mismatched-frees=yes maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager |
Or configure them in autoload:
Code Block |
---|
language | xml |
---|
title | CDB/MACI/Containers/bilboContainer/bilboContainer.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
|
...
<Autoload>
<cdb:e string="baci" />
<cdb:e string="acstimer" />
<cdb:e string="acsclock" />
</Autoload>
... |
Another alternative if you happen to have a new-enough version of Valgrind (after 2018), is to use the '--track-origins=yes' flag:
Code Block |
---|
valgrind --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all --show-mismatched-frees=yes maciContainer bilboContainer -ORBEndpoint iiop://127.0.1.1:4002 -m corbaloc::127.0.1.1:3000/Manager |
In the 3 scenarios you will get this instead:
Code Block |
---|
==116118== by 0xBD6980D: baci::CharacteristicModelImpl::CharacteristicModelImpl(ACE_String_Base<char> const&, maci::ContainerServices*) (baciCharacteristicModelImpl.cpp:55)
==116118== by 0xBD78621: baci::CharacteristicComponentImpl::CharacteristicComponentImpl(ACE_String_Base<char> const&, maci::ContainerServices*, bool) (baciCharacteristicComponentImpl.cpp:54)
==116118== by 0x50859AD: ClockImpl::ClockImpl(ACE_String_Base<char> const&, maci::ContainerServices*) (acstimeClockImpl.cpp:34) |