简体   繁体   English

运行时错误检查/ RTC

[英]Run-Time Error Checks /RTCs

I enabled in /RTCs in my application to detect stack corruption issues. 我在应用程序的/ RTC中启用了检测堆栈损坏的问题。 The application has many components(dlls) and the total LOC is about 40K. 该应用程序具有许多组件(dll),总LOC约为40K。 It has many threads. 它有很多线程。

Initially I was getting the crash after executing 18000 cycles. 最初,我在执行18000次循环后就崩溃了。 But after enabling the /RTCs option, I am getting the carsh within 100 cyles. 但是启用/ RTCs选项后,我得到的范围是100 cyles。 The crash always occurs in a thread called Reciever Thread. 崩溃总是发生在称为“接收方线程”的线程中。 But it crashes consistently at 3 or 4 locations. 但是它在3个或4个位置始终崩溃。 When the crash occurs almost all local variables looks like corrupted in some cases. 当崩溃发生时,在某些情况下几乎所有局部变量看起来都已损坏。 But I am not able to identify the root cause as I cannot see any issues around the points at which the crash occurs. 但是我无法确定根本原因,因为我看不到崩溃发生时的任何问题。

What things can I do to narrow down the point where the stack is corrupting? 我该怎么办才能缩小堆栈损坏的程度?
The code has try catch statements, will it prevent identifying the cause? 该代码具有try catch语句,是否会阻止查明原因?

Please help me 请帮我

Thanks! 谢谢!

Edit: Are you using optimisatons: 编辑:您是否正在使用优化:

If you compile your program at the command line using any of the /RTC compiler options, any pragma optimize instructions in your code will silently fail. 如果使用/ RTC编译器选项中的任何一个在命令行上编译程序,则代码中的任何编译指示优化指令都将无提示地失败。 This is because run-time error checks are not valid in a release (optimized) build. 这是因为运行时错误检查在发行版(优化)版本中无效。

You should use /RTC for development builds; 您应该使用/ RTC进行开发; /RTC should not be used for a retail build. / RTC不应用于零售版本。 /RTC cannot be used with compiler optimizations (/O Options (Optimize Code)). / RTC不能与编译器优化一起使用(/ O选项(优化代码))。 A program image built with /RTC will be slightly larger and slightly slower than an image built with /Od (up to 5 percent slower than an /Od build). 用/ RTC构建的程序映像比用/ Od构建的映像要大一些,也要慢一些(比/ Od构建要慢5%)。

Without you posting any code I can only suggest general tools. 如果不发布任何代码,我只能建议通用工具。

I use valgrind --tool=helgrind on Linux for this kind of thing, but I am guessing from your question that you are on Windows. 我在Linux上使用valgrind --tool=helgrind进行这种操作,但是从您的问题中我猜测您在Windows上。

You might find the answers to this question useful: Is there a good Valgrind substitute for Windows? 您可能会发现以下问题的答案很有用: 是否有Windows的Valgrind替代品?

(It might help if you post the code where you are getting problems or indicate what methods you have used to protect the variables that seem to be corrupted (mutexes and the like...) ) (如果将代码发布到您遇到问题的地方,或者指出您使用了哪些方法来保护似乎已损坏的变量(互斥变量等),这可能会有所帮助)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM