Client/Server pthreads 程序未在 Valgrind 下执行。正常运行
Client/Server pthreads program not executing under Valgrind. Runs fine normally
我有一个 C 服务器程序,它创建并打开命名管道的写入端(在 /var/run 中),并中断 tty uart 的 SIGIO 信号,将数据从该接口推送到管道中.
这个程序还产生了一个辅助 pthread,它打开一个单独管道的读取端(同样,在 /var/run 中),从中读取(阻塞),并将该数据传回我的主线程在我的 tty 上写出来。
使用互斥锁定结构在它们之间共享数据。我还有一个测试客户端程序来处理另一端。 Permissions/file访问有效。
这似乎在 运行bash 中非常有效。
不过,我想对 Valgrind 进行双重确认,特别是使用 memcheck 和 helgrind 工具,以防止内存泄漏和线程错误。但是当我在 valgrind 中启动我的服务器程序时,它挂起并且在我的客户端启动时不会 运行。在程序开始时,我什至没有从服务器看到我的初始启动 printf。 Valgrind 就坐在那里,直到我杀死它。
我运行以下选项:
valgrind --tool=helgrind ./server
和
valgrind --undef-value-errors=no ./server
输出如下(两条命令):
==7577== Memcheck, a memory error detector
==7577== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==7577== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==7577== Command: ./server
==7577==
--7577-- WARNING: Serious error when reading debug info
--7577-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.24.so:
--7577-- Ignoring non-Dwarf2/3/4 block in .debug_info
--7577-- WARNING: Serious error when reading debug info
--7577-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.24.so:
--7577-- Last block truncated in .debug_info; ignoring
抑制 undef-value-errors 因为 ld.so 有很多,它淹没了我的输出。
你能想到我做错了什么吗?也许 ld 库中缺少调试信息?如果需要,我可以转储代码,或者进一步阐述。
谢谢。
看来你的 valgrind 版本比较旧:
==7577== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==7577== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
假设 ld-2.24.so
来自 glibc,那是大约五年的工具链开发,谁知道在用于编译 glibc 的 gcc 和 binutils 版本中会有什么样的改进。
我有一个 C 服务器程序,它创建并打开命名管道的写入端(在 /var/run 中),并中断 tty uart 的 SIGIO 信号,将数据从该接口推送到管道中.
这个程序还产生了一个辅助 pthread,它打开一个单独管道的读取端(同样,在 /var/run 中),从中读取(阻塞),并将该数据传回我的主线程在我的 tty 上写出来。
使用互斥锁定结构在它们之间共享数据。我还有一个测试客户端程序来处理另一端。 Permissions/file访问有效。
这似乎在 运行bash 中非常有效。
不过,我想对 Valgrind 进行双重确认,特别是使用 memcheck 和 helgrind 工具,以防止内存泄漏和线程错误。但是当我在 valgrind 中启动我的服务器程序时,它挂起并且在我的客户端启动时不会 运行。在程序开始时,我什至没有从服务器看到我的初始启动 printf。 Valgrind 就坐在那里,直到我杀死它。
我运行以下选项:
valgrind --tool=helgrind ./server
和
valgrind --undef-value-errors=no ./server
输出如下(两条命令):
==7577== Memcheck, a memory error detector
==7577== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==7577== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==7577== Command: ./server
==7577==
--7577-- WARNING: Serious error when reading debug info
--7577-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.24.so:
--7577-- Ignoring non-Dwarf2/3/4 block in .debug_info
--7577-- WARNING: Serious error when reading debug info
--7577-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.24.so:
--7577-- Last block truncated in .debug_info; ignoring
抑制 undef-value-errors 因为 ld.so 有很多,它淹没了我的输出。
你能想到我做错了什么吗?也许 ld 库中缺少调试信息?如果需要,我可以转储代码,或者进一步阐述。
谢谢。
看来你的 valgrind 版本比较旧:
==7577== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==7577== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
假设 ld-2.24.so
来自 glibc,那是大约五年的工具链开发,谁知道在用于编译 glibc 的 gcc 和 binutils 版本中会有什么样的改进。