noob-sys-dev
noob-sys-dev

Reputation: 1

--trace-children-skip option is not having any impact with Valgrind

I have a run.sh with: ./opt/exm/bin/exm_daemon

exm_daemon spawns many process.

I run valgrind with options:

sudo valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes --trace-children-skip=process1,process2 --fair-sched=yes ./run.sh

I see valgrind profiles for all the processes including process1 and process2 I have checked the name of the process that are given to the skip list and there is no typo error.

Environment: I am running run.sh via CTest

enable_testing()

add_test(NAME TestExmCOMMAND valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes --trace-children-skip=process1,process2 --fair-sched=yes ./run.sh WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/install/")

include(CTest)

set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes --fair-sched=yes --error-exitcode=1")

set(CTEST_MEMORYCHECK_TYPE "Valgrind")

I tried adding all the process that are spawned by exm_daemon to the skip list. But it didnt work too.

Upvotes: 0

Views: 54

Answers (1)

Paul Floyd
Paul Floyd

Reputation: 6906

The processing for this does the following:

   if (VG_(clo_trace_children_skip)) {
      HChar const* last = VG_(clo_trace_children_skip);
      HChar const* name = child_exe_name;
      while (*last) {
         Bool   matches;
         HChar* patt;
         HChar const* first = consume_commas(last);
         last = consume_field(first);
         if (first == last)
            break;
         vg_assert(last > first);
         /* copy the candidate string into a temporary malloc'd block
            so we can use VG_(string_match) on it. */
         patt = VG_(calloc)("m_options.swttc.1", last - first + 1, 1);
         VG_(memcpy)(patt, first, last - first);
         vg_assert(patt[last-first] == 0);
         matches = VG_(string_match)(patt, name);
         VG_(free)(patt);
         if (matches)
            return False;
      }
   }

consume_commas just skips over commas. And consume_field skips over non-commas. VG_(string_match) is more compliceted and implements globbing pattern matching.

The only way to get more from that would be to debug or modify the code.

Upvotes: 0

Related Questions