- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
主要.cpp
#include <iostream>
int main() {
int* x = new int;
std::cout << x[3] << std::endl;
return 0;
}
命令行:
$ g++ -g main.cpp -o main
$ valgrind ./main
valgrind 输出
==27732== Memcheck, a memory error detector
==27732== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==27732== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==27732== Command: ./main
==27732==
==27732== Invalid read of size 4
==27732== at 0x1091A3: ??? (in /home/rofl/test_program/main)
==27732== by 0x57FDE76: (below main) (libc-start.c:308)
==27732== Address 0x5bb7c8c is 8 bytes after a block of size 4 alloc'd
==27732== at 0x4C2F4FF: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27732== by 0x109196: ??? (in /home/rofl/test_program/main)
==27732== by 0x57FDE76: (below main) (libc-start.c:308)
==27732==
0
==27732==
==27732== HEAP SUMMARY:
==27732== in use at exit: 4 bytes in 1 blocks
==27732== total heap usage: 3 allocs, 2 frees, 73,732 bytes allocated
==27732==
==27732== LEAK SUMMARY:
==27732== definitely lost: 4 bytes in 1 blocks
==27732== indirectly lost: 0 bytes in 0 blocks
==27732== possibly lost: 0 bytes in 0 blocks
==27732== still reachable: 0 bytes in 0 blocks
==27732== suppressed: 0 bytes in 0 blocks
==27732== Rerun with --leak-check=full to see details of leaked memory
==27732==
==27732== For counts of detected and suppressed errors, rerun with: -v
==27732== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
如果我运行 gdb ./main
,我可以中断 main 函数并逐行执行,所以我很确定二进制文件中存在调试符号。
使用 g++ -fno-omit-frame-pointer
和 valgrind -v
g++ -g -fno-omit-frame-pointer main.cpp -o main
valgrind -v ./main
Valgrind 输出:
==20116== Memcheck, a memory error detector
==20116== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==20116== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==20116== Command: ./main
==20116==
--20116-- Valgrind options:
--20116-- -v
--20116-- Contents of /proc/version:
--20116-- Linux version 4.14.65-gentoo (root@KILLINGMACHINE) (gcc version 7.3.0 (Gentoo 7.3.0-r3 p1.4)) #1 SMP Mon Apr 15 05:45:45 -00 2019
--20116--
--20116-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-avx-avx2-bmi
--20116-- Page sizes: currently 4096, max supported 4096
--20116-- Valgrind library directory: /usr/lib64/valgrind
--20116-- Reading syms from /home/rofl/test_program/main
--20116-- ELF section outside all mapped regions
--20116-- Reading syms from /lib64/ld-2.28.so
--20116-- ELF section outside all mapped regions
--20116-- Reading syms from /usr/lib64/valgrind/memcheck-amd64-linux
--20116-- ELF section outside all mapped regions
--20116-- Scheduler: using generic scheduler lock implementation.
--20116-- Reading suppressions file: /usr/lib64/valgrind/default.supp
==20116== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-20116-by-rofl-on-???
==20116== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-20116-by-rofl-on-???
==20116== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-20116-by-rofl-on-???
==20116==
==20116== TO CONTROL THIS PROCESS USING vgdb (which you probably
==20116== don't want to do, unless you know exactly what you're doing,
==20116== or are doing some strange experiment):
==20116== /usr/lib64/valgrind/../../bin/vgdb --pid=20116 ...command...
==20116==
==20116== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==20116== /path/to/gdb ./main
==20116== and then give GDB the following command
==20116== target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=20116
==20116== --pid is optional if only one valgrind process is running
==20116==
--20116-- Reading syms from /usr/lib64/valgrind/vgpreload_core-amd64-linux.so
--20116-- ELF section outside all mapped regions
--20116-- Reading syms from /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so
--20116-- ELF section outside all mapped regions
--20116-- Reading syms from /usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/libstdc++.so.6.0.25
--20116-- Reading syms from /lib64/libm-2.28.so
--20116-- ELF section outside all mapped regions
--20116-- Reading syms from /usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/libgcc_s.so.1
--20116-- Reading syms from /lib64/libc-2.28.so
--20116-- ELF section outside all mapped regions
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A65EA: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:874)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116== Use of uninitialised value of size 8
==20116== at 0x49A60BE: int std::__int_to_char<char, unsigned long>(char*, unsigned long, char const*, std::_Ios_Fmtflags, bool) (locale_facets.tcc:803)
==20116== by 0x49A6613: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:876)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A60CB: int std::__int_to_char<char, unsigned long>(char*, unsigned long, char const*, std::_Ios_Fmtflags, bool) (locale_facets.tcc:806)
==20116== by 0x49A6613: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:876)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A6646: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:896)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
0
==20116==
==20116== HEAP SUMMARY:
==20116== in use at exit: 0 bytes in 0 blocks
==20116== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==20116==
==20116== All heap blocks were freed -- no leaks are possible
==20116==
==20116== Use --track-origins=yes to see where uninitialised values come from
==20116== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
==20116==
==20116== 1 errors in context 1 of 4:
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A6646: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:896)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116==
==20116== 1 errors in context 2 of 4:
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A60CB: int std::__int_to_char<char, unsigned long>(char*, unsigned long, char const*, std::_Ios_Fmtflags, bool) (locale_facets.tcc:806)
==20116== by 0x49A6613: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:876)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116==
==20116== 1 errors in context 3 of 4:
==20116== Use of uninitialised value of size 8
==20116== at 0x49A60BE: int std::__int_to_char<char, unsigned long>(char*, unsigned long, char const*, std::_Ios_Fmtflags, bool) (locale_facets.tcc:803)
==20116== by 0x49A6613: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:876)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116==
==20116== 1 errors in context 4 of 4:
==20116== Conditional jump or move depends on uninitialised value(s)
==20116== at 0x49A65EA: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (locale_facets.tcc:874)
==20116== by 0x49B3671: put (locale_facets.h:2371)
==20116== by 0x49B3671: std::ostream& std::ostream::_M_insert<long>(long) (ostream.tcc:73)
==20116== by 0x1091B2: ??? (in /home/rofl/test_program/main)
==20116== by 0x503D45A: ??? (in /lib64/libc-2.28.so)
==20116== by 0x51E7407: ???
==20116== by 0x1FFF0001F7: ???
==20116== by 0x1051E7407: ???
==20116== by 0x109184: ??? (in /home/rofl/test_program/main)
==20116==
==20116== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
最佳答案
这很可能已经修复了读取调试信息时的 Valgrind 错误:https://bugs.kde.org/show_bug.cgi?id=395682 .根据release notes ,此修复自 3.14 版本开始提供。
关于g++ - Valgrind 显示 ???对于行号,尽管 -g 标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55770344/
我的Angular-Component位于一个flexbox(id =“log”)中。可以显示或隐藏flexbox。 我的组件内部有一个可滚动区域,用于显示日志消息。 (id =“message-li
我真的很困惑 有一个 phpinfo() 输出: MySQL 支持 启用 客户端 API 版本 5.5.40 MYSQL_MODULE_TYPE 外部 phpMyAdmin 显示: 服务器类型:Mar
我正在研究这个 fiddle : http://jsfiddle.net/cED6c/7/我想让按钮文本在单击时发生变化,我尝试使用以下代码: 但是,它不起作用。我应该如何实现这个?任何帮助都会很棒
我应该在“dogs_cats”中保存表“dogs”和“cats”各自的ID,当看到数据时显示狗和猫的名字。 我有这三个表: CREATE TABLE IF NOT EXISTS cats ( id
我有一个字符串返回到我的 View 之一,如下所示: $text = 'Lorem ipsum dolor ' 我正在尝试用 Blade 显示它: {{$text}} 但是,输出是原始字符串而不是渲染
我无法让我的链接(由图像表示,位于页面左侧)真正有效地显示一个 div(包含一个句子,位于中间)/单击链接时隐藏。 这是我的代码: Practice
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
最初我使用 Listview 来显示 oracle 结果,但是最近我不得不切换到 datagridview 来处理比 Listview 允许的更多的结果。然而,自从切换到数据网格后,我得到的结果越来越
我一直在尝试插入一个 Unicode 字符 ∇ 或 ▽,所以它显示在 Apache FOP 生成的 PDF 中。 这是我到目前为止所做的: 根据这个基本帮助 Apache XSL-FO Input,您
我正在使用 node v0.12.7 编写一个 nodeJS 应用程序。 我正在使用 pm2 v0.14.7 运行我的 nodejs 应用程序。 我的应用程序似乎有内存泄漏,因为它从我启动时的大约 1
好的,所以我有一些 jQuery 代码,如果从下拉菜单中选择了带有前缀 Blue 的项目,它会显示一个输入框。 代码: $(function() { $('#text1').hide();
当我试图检查 Chrome 中的 html 元素时,它显示的是 LESS 文件,而 Firefox 显示的是 CSS 文件。 (我正在使用 Bootstrap 框架) 如何在 Chrome 中查看 c
我是 Microsoft Bot Framework 的新手,我正在通过 youtube 视频 https://youtu.be/ynG6Muox81o 学习它并在 Ubuntu 上使用 python
我正在尝试转换从 mssql 生成的文件到 utf-8。当我打开他的输出 mssql在 Windows Server 2003 中使用 notepad++ 将文件识别为 UCS-2LE我使用 file
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我正在尝试执行单击以打开/关闭一个 div 的功能。 这是基本的,但是,点击只显示 div,当我点击“关闭”时,没有任何反应。 $(".inscricao-email").click(function
假设我有 2 张卡片,屏幕上一次显示一张。我有一个按钮可以用其他卡片替换当前卡片。现在假设卡 1 上有一些数据,卡 2 上有一些数据,我不想破坏它们每个上的数据,或者我不想再次重建它们中的任何一个。
我正在使用 Eloquent Javascript 学习 Javascript。 我在 Firefox 控制台上编写了以下代码,但它返回:“ReferenceError:show() 未定义”为什么?
我正在使用 Symfony2 开发一个 web 项目,我使用 Sonata Admin 作为管理面板,一切正常,但我想要做的是,在 Sonata Admin 的仪表板菜单上,我需要显示隐藏一些菜单取决
我试图显示一个div,具体取决于从下拉列表中选择的内容。例如,如果用户从列表中选择“现金”显示现金div或用户从列表中选择“检查”显示现金div 我整理了样本,但样本不完整,需要接线 http://j
我是一名优秀的程序员,十分优秀!