--trace-children-skip 选项对 Valgrind 没有任何影响

问题描述 投票:0回答:1

我有一个 run.sh :

./opt/exm/bin/exm_daemon

exm_daemon
产生许多进程。

我使用选项运行 valgrind:

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

我看到所有进程的 valgrind 配置文件,包括 process1 和 process2 我检查了提供给跳过列表的进程名称,没有拼写错误。

环境: 我正在通过 CTest 运行 run.sh

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")

我尝试将 exm_daemon 生成的所有进程添加到跳过列表中。但也没有成功。

c++11 cmake valgrind ctest
1个回答
0
投票

对此的处理执行以下操作:

   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
只是跳过逗号。并且
consume_field
会跳过非逗号。
VG_(string_match)
更复杂,实现了通配模式匹配。

从中获取更多信息的唯一方法是调试或修改代码。

© www.soinside.com 2019 - 2024. All rights reserved.