- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在分析程序时,我遇到了valgrind报告的奇怪错误。你能帮我找到他们的来源吗?
最小示例
main.cpp:
#define BOOST_ASIO_ENABLE_HANDLER_TRACKING
#include "foo.h"
#include <iostream>
int main()
{
boost::asio::io_service ioService;
Foo foo(ioService);
ioService.run();
return EXIT_SUCCESS;
}
#include <boost/asio.hpp>
class Foo
{
private:
boost::asio::ip::tcp::resolver resolver_;
public:
Foo(boost::asio::io_service & ioService);
virtual ~Foo()
{}
};
#include "foo.h"
Foo::Foo(boost::asio::io_service & ioService) : resolver_(ioService)
{
}
g++ -g3 -O0 -lboost_system -lpthread -o main ./main.cpp ./foo.cpp
编译并用
valgrind ./main
执行时,valgrind报告类型无效的
5 errors。
==14905== Memcheck, a memory error detector
==14905== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==14905== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==14905== Command: ./main
==14905==
==14905== Invalid write of size 1
==14905== at 0x406724: boost::asio::detail::scheduler::scheduler(boost::asio::execution_context&, int) (scheduler.ipp:103)
==14905== by 0x40CBF6: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905== Address 0x5f06110 is 0 bytes after a block of size 240 alloc'd
==14905== at 0x4C2E94F: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14905== by 0x40CBE1: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905==
==14905== Invalid write of size 1
==14905== at 0x40672F: boost::asio::detail::scheduler::scheduler(boost::asio::execution_context&, int) (scheduler.ipp:103)
==14905== by 0x40CBF6: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905== Address 0x5f06111 is 1 bytes after a block of size 240 alloc'd
==14905== at 0x4C2E94F: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14905== by 0x40CBE1: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905==
==14905== Invalid write of size 4
==14905== at 0x40673D: boost::asio::detail::scheduler::scheduler(boost::asio::execution_context&, int) (scheduler.ipp:103)
==14905== by 0x40CBF6: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905== Address 0x5f06114 is 4 bytes after a block of size 240 alloc'd
==14905== at 0x4C2E94F: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14905== by 0x40CBE1: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905==
@asio|1589278153.511608|0|resolver@0x1ffefff910.cancel
==14905== Invalid write of size 1
==14905== at 0x406D20: boost::asio::detail::scheduler::stop_all_threads(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&) (scheduler.ipp:543)
==14905== by 0x406A9E: boost::asio::detail::scheduler::stop() (scheduler.ipp:257)
==14905== by 0x40CC67: boost::asio::io_context::stop() (io_context.ipp:121)
==14905== by 0x40CF79: boost::asio::detail::resolver_service_base::base_shutdown() (resolver_service_base.ipp:58)
==14905== by 0x40DFD9: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::shutdown() (resolver_service.hpp:65)
==14905== by 0x405335: boost::asio::detail::service_registry::shutdown_services() (service_registry.ipp:44)
==14905== by 0x40568C: boost::asio::execution_context::shutdown() (execution_context.ipp:41)
==14905== by 0x405630: boost::asio::execution_context::~execution_context() (execution_context.ipp:34)
==14905== by 0x4070A1: boost::asio::io_context::~io_context() (io_context.ipp:55)
==14905== by 0x402DA2: main (main.cpp:9)
==14905== Address 0x5f06110 is 0 bytes after a block of size 240 alloc'd
==14905== at 0x4C2E94F: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14905== by 0x40CBE1: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905==
==14905== Invalid write of size 1
==14905== at 0x4067E2: boost::asio::detail::scheduler::shutdown() (scheduler.ipp:111)
==14905== by 0x405335: boost::asio::detail::service_registry::shutdown_services() (service_registry.ipp:44)
==14905== by 0x40568C: boost::asio::execution_context::shutdown() (execution_context.ipp:41)
==14905== by 0x405630: boost::asio::execution_context::~execution_context() (execution_context.ipp:34)
==14905== by 0x4070A1: boost::asio::io_context::~io_context() (io_context.ipp:55)
==14905== by 0x40D37A: boost::asio::detail::scoped_ptr<boost::asio::io_context>::reset(boost::asio::io_context*) (scoped_ptr.hpp:63)
==14905== by 0x40CFD5: boost::asio::detail::resolver_service_base::base_shutdown() (resolver_service_base.ipp:64)
==14905== by 0x40DFD9: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::shutdown() (resolver_service.hpp:65)
==14905== by 0x405335: boost::asio::detail::service_registry::shutdown_services() (service_registry.ipp:44)
==14905== by 0x40568C: boost::asio::execution_context::shutdown() (execution_context.ipp:41)
==14905== by 0x405630: boost::asio::execution_context::~execution_context() (execution_context.ipp:34)
==14905== by 0x4070A1: boost::asio::io_context::~io_context() (io_context.ipp:55)
==14905== Address 0x5f06111 is 1 bytes after a block of size 240 alloc'd
==14905== at 0x4C2E94F: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14905== by 0x40CBE1: boost::asio::io_context::io_context(int) (io_context.ipp:44)
==14905== by 0x40CE22: boost::asio::detail::resolver_service_base::resolver_service_base(boost::asio::io_context&) (resolver_service_base.ipp:40)
==14905== by 0x40DC6A: boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolver_service(boost::asio::io_context&) (resolver_service.hpp:58)
==14905== by 0x40DA56: boost::asio::execution_context::service* boost::asio::detail::service_registry::create<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, boost::asio::io_context>(void*) (service_registry.hpp:87)
==14905== by 0x40C88F: boost::asio::detail::service_registry::do_use_service(boost::asio::execution_context::service::key const&, boost::asio::execution_context::service* (*)(void*), void*) (service_registry.ipp:132)
==14905== by 0x40D86D: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::detail::service_registry::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (service_registry.hpp:39)
==14905== by 0x40D6A0: boost::asio::detail::resolver_service<boost::asio::ip::tcp>& boost::asio::use_service<boost::asio::detail::resolver_service<boost::asio::ip::tcp> >(boost::asio::io_context&) (io_context.hpp:39)
==14905== by 0x40D596: boost::asio::basic_io_object<boost::asio::detail::resolver_service<boost::asio::ip::tcp>, true>::basic_io_object(boost::asio::io_context&) (basic_io_object.hpp:224)
==14905== by 0x40D498: boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::basic_resolver(boost::asio::io_context&) (basic_resolver.hpp:101)
==14905== by 0x40C544: Foo::Foo(boost::asio::io_context&) (foo.cpp:3)
==14905== by 0x402D79: main (main.cpp:10)
==14905==
==14905==
==14905== HEAP SUMMARY:
==14905== in use at exit: 1 bytes in 1 blocks
==14905== total heap usage: 18 allocs, 17 frees, 79,744 bytes allocated
==14905==
==14905== LEAK SUMMARY:
==14905== definitely lost: 0 bytes in 0 blocks
==14905== indirectly lost: 0 bytes in 0 blocks
==14905== possibly lost: 0 bytes in 0 blocks
==14905== still reachable: 1 bytes in 1 blocks
==14905== suppressed: 0 bytes in 0 blocks
==14905== Rerun with --leak-check=full to see details of leaked memory
==14905==
==14905== For lists of detected and suppressed errors, rerun with: -s
==14905== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
BOOST_ASIO_ENABLE_HANDLER_TRACKING
,则不会报告任何错误。 Foo()
的主体位于foo.h中(即,整个代码位于一个编译单元中),则不会报告任何错误。 resolver_
不会报告任何错误。 BOOST_ASIO_ENABLE_HANDLER_TRACKING
,并且它开始崩溃(反复发生),并且valgrind开始报告“无效的写入”错误(随后是“跳转到无效的地址”类型的错误)。
BOOST_ASIO_ENABLE_HANDLER_TRACKING
揭示了boost::asio中的一个错误,该错误导致我的信号成为某些没有宏就被忽略的例程。 最佳答案
我没有看到不可原谅的错误。
我确实看到了可能的ODR违规。全局定义BOOST_ASIO_ENABLE_HANDLER_TRACKING
或根本不定义。就目前而言,您有一个定义它的TU,一个(或多个)没有定义。这是UB。
由于我以前在自己的代码库中遇到过这种特殊情况,因此我已经看过UB,因此,我很确定这是您的问题。
关于c++ - 来自boost::asio的Valgrind错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61750073/
我希望 valgrind 在发现第一个错误时停止并退出。 请勿推荐 --vgdb-error=1 :它不会退出 valgrind。您必须连接 gdb 并从那里终止。 --db-attach : 在最近
有人可以快速解释 Valgrind 的工作原理吗?一个例子:它如何知道内存何时被分配和释放? 最佳答案 Valgrind 基本上在“沙箱”中运行您的应用程序。在此沙箱中运行时,它能够插入自己的指令来进
我有一个因 SIGSEGV 而崩溃的应用程序。 --20183-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) -
我有一个因 SIGSEGV 而崩溃的应用程序。 --20183-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) -
我想使用 valgrind 检查长时间运行的进程是否存在内存泄漏。我怀疑我所追求的内存泄漏可能仅在执行几个小时后才会发生。我可以在 valgrind 下运行应用程序并获取 valgrind 日志,但这
我想用 valgrind 检查一个长时间运行的进程是否有内存泄漏。我怀疑我所追求的内存泄漏可能仅在执行数小时后才会发生。我可以在 valgrind 下运行应用程序并获得 valgrind 日志,但这样
如何在不通过 valgrind 命令选项启动它的情况下对每个 Process 实例执行 valgrind memcheck。 有没有办法将监控选项保存在进程中,而不是每次都使用 valgrind 命令
我使用了“--trace-children=yes”选项,我还使用了“--trace-children-skip=patt1,patt2,...”选项(过滤掉噪音过程)。但它对我来说仍然很慢,我的多进
我从 Valgrind 得到以下日志: MPK ==5263== 4 bytes in 1 blocks are still reachable in loss record 1 of 84 ==52
如何在 Valgrind 抑制文件中添加注释? 我需要为一个大型项目维护一个 Valgrind 抑制文件。我们从我们链接到的工具中过滤无法修复的错误。随着工具的新版本发布,此文件可能需要随着时间的推移
我有一个大程序要运行。使用 valgrind 需要几个小时才能运行。我听说有一些东西可以让我们为程序中的特定函数调用 valgrind。其余程序将正常执行(没有 valgrind env)。 任何人都
我可以用 valgrind 检测整数溢出缺陷吗?里面的哪个工具可以做到这一点? 最佳答案 Valgrind 没有可以检测整数溢出的工具。 您可能会使用 gcc 选项捕获这些错误: -ftrapv Th
我有一个简单的程序: int main(void) { const char sname[]="xxx"; sem_t *pSemaphor; if ((pSemaphor = sem_o
如何让 Valgrind 准确显示错误发生的位置?我编译了我的程序(通过 PuTTy 在 Windows 机器上通过 Linux 终端)添加了 -g 调试选项。 当我运行 Valgrind 时,我得到
或者最好是全部,而不仅仅是我的代码?我的程序使用 Gtk、Loudmouth 和其他一些东西,而这两个(以及它们背后的一些,libgcrypto、libssl)本身导致了如此多的错误,以至于我无法检测
我想尝试使用 valgrind 进行一些堆损坏检测。通过以下腐败“单元测试”: #include #include #include int main() { char * c = (ch
我看过类似的问题here ,但我的问题是我没有编辑 default.supp 文件的权限。例如,Valgrind 中是否有任何忽略所有抑制文件的命令行选项? 最佳答案 在 Valgrind 3.10.
我在一个运行无限循环的程序上使用 valgrind。 由于memcheck在程序结束后显示内存泄漏,但由于我的程序有无限循环,它永远不会结束。 那么有什么方法可以强制从 valgrind 时不时地转储
我一直在尝试使用 valgrind 查找一些可疑的内存错误。 在被分析的程序甚至到达我希望分析的点之前,它会因为对 mmap 的调用开始失败而退出。当它不在 valgrind 下时,这些调用会成功。
由于 OpenSSL 使用未初始化的内存,因此对使用 openldap2 的 libldap 的程序进行 Valgrind 是一件苦差事。存在一个 --ignore-fn选项,但仅适用于 Valgri
我是一名优秀的程序员,十分优秀!