Hi VALGRIND developers and users, I'm planning to modify a part of your product, VALGRIND,to integrate it with a middleware for robots called ROS.
In order to do this, I'm considering two ways to implement the massif component of VALGRIND: (1) to implement it in C and call it in another program as a Python library, and (2) to convert it into a ROS/ROS2 component (nodes) in C++. The reason for these implementations plan is that I want to retrieve the values of heap_szB and stack_szB defined in the Snapshot structure in ms_main.c of massif via VALGRIND and use them in a timely manner in an external Python-based program. As far as I read the raw source code, the way to get the data is to specify the last struct element of Snapshot* snapshot and extract it (if I'm wrong, please let me know).However, I'm struggling with the implementation of the part that passes to the external application. Please advise me on the implementation, including which method is more feasible. As for (1), I tried to build the source code to see if I could include Python.h correctly, and it failed, so I'll keep a log of this. ======== << Environment >> $ uname -a Linux [HOSTNAME] 5.4.0-1026-raspi #29-Ubuntu SMP PREEMPT Mon Dec 14 17:01:16 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux $ cat /etc/lsb-release* DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS" << What I did during the build and the log >> I made the following changes to the DEFAULTS_INCLEDES variable in the massif/Makefile. DEFAULT_INCLUDES = -I. -I$(top_builddir) -I/usr/include/python3.8 I also inserted the following two lines in the first line of massif/ms_main.c. The following two lines are inserted in the first line of massif/ms_main.c. No functions using PyObject* are implemented in the file. #define PY_SSIZE_T_CLEAN #include <Python.h>. When I ran make and make install, I got the following error message. Making all in massif make[2]: Entering directory '/home/[username]/[work directory]/valgrind-3.16.1/massif' Making all in . make[3]: Entering directory '/home/[username]/[work directory]/valgrind-3.16.1/massif' gcc -DHAVE_CONFIG_H -I. -I... -I/usr/include/python3.8 -I.. -I.. /include -I.. /include -I. /VEX/pub -I. /VEX/pub -DVGA_arm64=1 -DVGO_linux=1 -DVGP_arm64_linux=1 -DVGPV_arm64_linux_vanilla=1 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer- arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-signedness Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wimplicit-fallthrough=2 -Wold-style-declaration -finline- functions -fno-stack-protector -fno-strict-aliasing -fno-builtin -MT massif_arm64_linux-ms_main.o -MD -MP -MF .deps/massif_arm64_linux-ms_ Tpo -c -o massif_arm64_linux-ms_main.o `test -f 'ms_main.c' || echo '. /'`ms_main.c In file included from /usr/include/aarch64-linux-gnu/sys/stat.h:101, From /usr/include/python3.8/pyport.h:245, from /usr/include/python3.8/Python.h:63, from ms_main.c:6: ... /include/vki/vki-arm64-linux.h:316:25: error: expected ':', ',', '. ;', '}' or '__attribute__' before '. token 316 | long st_atime; | ^~~~~~~~ make[3]: *** [Makefile:1087: massif_arm64_linux-ms_main.o] Error 1 make[3]: Leaving directory '/home/[username]/[my work directory]/valgrind-3.16.1/massif' make[2]: *** [Makefile:1121: all-recursive] Error 1 make[2]: Leaving directory '/home/[username]/[my work directory]/valgrind-3.16.1/massif' make[1]: *** [Makefile:849: all-recursive] Error 1 make[1]: Leaving directory '/home/[username]/[my work directory]/valgrind-3.16.1' Make: *** [Makefile:718: all] Error 2 Best regards, Koki
_______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users