|
From: Trevor S. <tsp...@ie...> - 2011-05-19 17:54:03
|
On 19/05/2011 18:28, Timur Iskhodzhanov wrote: >> Is there a way to omit the parameters from the demangled C++ function >> names in valgrind? Templates cause long lines, which then become >> difficult to read, and using --demangle=no doesn't help much, mangled >> function names are still long and not much easier to read. For example, >> if function foo takes a reference to vector of int as an argument, >> valgrind shows something like: >> >> foo(std::vector<int, std::allocator<int> > const&) (filename.cpp:100) >> >> This will become much worse for more complicated templates. So my >> question is, is there any way to reduce the output to something like this? >> >> foo(...) (filename.cpp:100) >> > I think there's no such functionality in Valgrind atm. > However, recently I wrote a function which goes almost exactly what > you want in ThreadSanitizer for both Valgrind and PIN > You can look at the source code here: > http://code.google.com/p/data-race-test/source/browse/trunk/tsan/ts_util.cc?spec=svn3464&r=3442#417 > and the current set of tests here: > http://code.google.com/p/data-race-test/source/browse/trunk/tsan/thread_sanitizer_test.cc?spec=svn3464&r=3355#259 > > I'd be happy if someone cleans up the code and upstreams it. > FTR, I drop the "(...)" part as well because Intel PIN doesn't give us > the list of arguments on Windows and we wanted to have cross-platform > suppressions for Chromium. Hence, we've decided to drop it on > Linux/Mac too. Thanks for that, though I do not have time to try that. As a workaround to the problem I wrote a simple emacs function which mostly works for me, since I usually call valgrind from emacs shell. I'm reproducing it here in case anyone finds it useful. (defun valgrind-cleanup-cpp () (interactive) (replace-regexp "\\(.*(\\)[^)]*\\().*([^)]*)\\)" "\\1...\\2" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))) |