在 free() 中:错误:垃圾指针,太高而没有意义分段错误:11(核心已转储)gprof
我正在尝试分析我的应用程序。为此,我使用 -pg 和 -lc_p 选项编译了代码,它编译成功
在运行时我收到以下错误。 在 free() 中:错误:垃圾指针,太高而没有意义 分段错误:11(核心已转储)
执行 GDB 会出现错误:
(gdb) b main
Breakpoint 1 at 0x5124d4:
(gdb) r
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100085]
cacheIp in free(): error: junk pointer, too high to make sense
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 100085]
0x00000000006c3a1f in pthread_sigmask ()
我的应用程序是多线程的,并且是 C 和 C++ 代码的组合。
uname -a
FreeBSD 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008 [email protected]:/usr/obj/usr/src/sys/SMP amd64
没有 -pg 选项,代码可以正常工作。为什么使用 -pg 时代码会崩溃?我是不是错过了什么。
I am trying to profile my application. For this I compiled my code with -pg and -lc_p option, it compiled successfully
During run time I am getting the following error.
in free(): error: junk pointer, too high to make sense
Segmentation fault: 11 (core dumped)
Doing GDB gives error as.
(gdb) b main
Breakpoint 1 at 0x5124d4:
(gdb) r
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100085]
cacheIp in free(): error: junk pointer, too high to make sense
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 100085]
0x00000000006c3a1f in pthread_sigmask ()
My application is multi threaded and is a combination of C and C++ code.
uname -a
FreeBSD 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008 [email protected]:/usr/obj/usr/src/sys/SMP amd64
The code is working fine without the -pg option. Why is the code crashing with -pg. Am I missing something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码中可能存在一个或多个潜在错误,这些错误只有在您尝试使用 gprof 进行分析时才会显现出来。尝试在
valgrind
下运行代码以清除任何错误 - 修复这些错误 - 然后再次尝试分析。You probably have one or more latent bugs in your code which are only manifesting themselves now that you are trying to profile with gprof. Try running your code under
valgrind
to flush out any bugs - fix those bugs - and then try profiling again.Valgrind 当然可以在 amd64 上运行,它是一个主要的开发平台。
所以在 valgrind 下运行它肯定会有帮助。
Valgrind certainly does work on amd64, it's a primary development platform.
So running it under valgrind will certainly help.