https://bugs.kde.org/show_bug.cgi?id=514343
--- Comment #7 from Paul Floyd <[email protected]> --- It's not complicated. I want to be careful to get the interface right. Once people start using it is difficult to change the interface. This just needs two bits of code case VG_USERREQ__VALGRIND_REPLACES_MALLOC: SET_CLREQ_RETVAL(tid, VG_(needs).malloc_replacement); break; and /* Returns 1 if the tool replaces malloc (e.g., memcheck). Returns 0 if the tool does not replace malloc (e.g., cachegrind and callgrind) or if the executable is not running under VALGRIND. */ #define VALGRIND_REPLACES_MALLLOC \ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* if not */, \ VG_USERREQ__VALGRIND_REPLACES_MALLOC, \ 0, 0, 0, 0, 0) \ I'm not sure what default value I should use there. 1 for running on Valgrind and the tool replaces malloc, 0 for running on Valgrind and the tool does not replace malloc. But what about not running on Valgrind? I could make that 0 or -1. I think I prefer 0 since the name does sound like a boolean. Similarly for the tool name, something like #define VALGRIND_GET_TOOLNAME(zzbuf,zzbuflen) \ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \ VG_USERREQ__VALGRIND_GET_TOOLNAME, \ (char*)(zzbuf), \ (zzbuflen) , \ 0, 0, 0) and case VG_USERREQ__VALGRIND_GET_TOOLNAME: { HChar* buf = (HChar *)arg[1]; SizeT buflen = (SizeT)arg[2]; VG_(strncpy)(buf, VG_(clo_toolname), buflen); SET_CLREQ_RETVAL(tid, VG_(strlen)(VG_(clo_toolname))); break; } I need to think a bit more about nul terminating the string. -- You are receiving this mail because: You are watching all bug changes.
