Bug 424530 - kdev-valgrind uses the wrong syntax
Summary: kdev-valgrind uses the wrong syntax
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: Plugin: Valgrind integration (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL: https://github.com/KDE/kdev-valgrind
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-22 08:54 UTC by Chris de CLAVERIE
Modified: 2020-07-28 14:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris de CLAVERIE 2020-07-22 08:54:20 UTC
This is my first bug report on this platform. Feel free to let me know how to improve it.

SUMMARY
https://github.com/KDE/kdev-valgrind has been unmaintained for 8 months according to the Github page. I tried it on my Meson project, and it failed to run Valgrind.


STEPS TO REPRODUCE
1. Open a Meson project. I didn't try any other project type, but I suspect the bug would show up with any project
2. Configure Valgrind settings in Run > Configure Launches menu
3. Run your executable using the Run > Run Valgrind Analysis > Run Memcheck menu 

OBSERVED RESULT
It tries to run the following command :

    /usr/bin/valgrind --tool=memcheck --xml=yes --xml-socket=127.0.0.1:46421 --num-callers=12 --max-stackframe=2000000 --error-limit=yes --leak-resolution=high --show-leak-kinds=definite,possible --leak-check-heuristics=all --keep-stacktraces=alloc-and-free --freelist-vol=20000000 --freelist-big-blocks=1000000 --undef-value-errors=yes --show-mismatched-frees=yes --partial-loads-ok=yes --track-origins=no --expensive-definedness-checks=no '' -a .

This throws a simple "valgrind: : command not found" error, because I suspect the Valgrind syntax used by the plugin is outdated.

EXPECTED RESULT
Valgrind runs and its output is displayed in the appropriate panel

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8

ADDITIONAL INFORMATION
It is interesting to note the plugin is not packaged in ubuntu repositories and the installation instructions are lacking
Comment 1 Milian Wolff 2020-07-23 09:00:23 UTC
The >''< seems to be the issue - it doesn't use the binary of your executable properly - can you check why? this is actually a value that comes from the project builder, so potentially it is a fault in meson after all?

The valgrind command itself looks fine. If you replace the >''< with e.g. >'ls'< it will "work":

/usr/bin/valgrind --tool=memcheck --xml=yes --xml-socket=127.0.0.1:46421 --num-callers=12 --max-stackframe=2000000 --error-limit=yes --leak-resolution=high --show-leak-kinds=definite,possible --leak-check-heuristics=all --keep-stacktraces=alloc-and-free --freelist-vol=20000000 --freelist-big-blocks=1000000 --undef-value-errors=yes --show-mismatched-frees=yes --partial-loads-ok=yes --track-origins=no --expensive-definedness-checks=no 'ls' -a .
==19563== Failed to connect to XML logging server '127.0.0.1:46421'.
==19563== XML output will be sent to stderr instead.
Comment 2 Chris de CLAVERIE 2020-07-23 09:22:51 UTC
I see. I tried everything in the settings to force the use of the right executable path (I have multiple launch targets, changed them from project target to executable, changed working directories, etc...) but nothing seems to influence the Valgrind plugin. I'm not sure why. I tried looking at the code but having no experience of KDev plugins I had no success.

A nice workaround is to use Valgrind "extra parameters" to input the full path to the executable (for example, in meson, "./build/tests/my_unit_test")
Comment 3 Milian Wolff 2020-07-26 12:14:46 UTC
Can you check and see if it works with a trivial CMake-based project?

thanks
Comment 4 Chris de CLAVERIE 2020-07-28 14:06:23 UTC
When trying with a basic template CMake project, I am greeted with a crash. The crash stdout doesn't lead anywhere ("/usr/bin/cat: /home/ubuntu/.local/share/kdevelop/session/{uuid}/default.sh: no such file or directory") and unfortunately I don't have a version with the debugging symbols enabled at hand.