callstack

Stack overflow C++

老子叫甜甜 提交于 2019-11-27 16:09:44
This is my code. When I access dtr array in initImg function it gives a stack overflow exception. What might be the reason? #define W 1000 #define H 1000 #define MAX 100000 void initImg(int img[], float dtr[]) { for(int i=0;i<W;i++) for(int j=0;j<H;j++) img[i*W+j]=255; for(int j=0;j<H;j++) { img[j] = 0; img[W*(W-1)+j] = 0; } for(int i=0;i<W;i++) { img[i*W] = 0; img[i*W+H-1] = 0; } for(int i=0;i<W;i++) for(int j=0;j<H;j++) { if(img[i*W+j]==0) dtr[i*W+j] = 0; // <------here else dtr[i*W+j] = MAX; // <------here } } int main() { int image[W*H]; float dtr[W*H]; initImg(image,dtr); return 0; } This

Is it possible to retrieve the call stack programmatically in VB6?

早过忘川 提交于 2019-11-27 15:30:50
When an error occurs in a function, I'd like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is there any way to retrieve the call stack in VB6, or do I have to do it the hard way (e.g., log entries in every function and error handler, etc.)? I'm pretty sure you have to do it the hard way. At a previous job of mine, we had a very elegant error handling process for VB6 with DCOM components. However, it was a lot redundant code that had to be added to every method, so much that we had home-grown tools to insert it all for

Does calling setTimeout clear the callstack?

大城市里の小女人 提交于 2019-11-27 15:04:34
Can a stack overflow be avoided in javascript by using the setTimeout method to call a function instead of calling it directly? My understanding of setTimeout is that it should start a new callstack. When i look in the callstack of both chrome and IE it seems that the setTimeout calls are waiting for the function call to return. Is this just a property of the debugger or is my understanding flawed? EDIT While the answers provided below are correct, the actual problem I was having was related to the fact that I was calling setTimeout(aFunction(), 10) which was evaluating aFunction immediately

Call-stack for exceptions in C++

倾然丶 夕夏残阳落幕 提交于 2019-11-27 12:48:31
问题 Today, in my C++ multi-platform code, I have a try-catch around every function. In every catch block I add the current function's name to the exception and throw it again, so that in the upmost catch block (where I finally print the exception's details) I have the complete call stack, which helps me to trace the exception's cause. Is it a good practice, or are there better ways to get the call stack for the exception? 回答1: No, it is deeply horrible, and I don't see why you need a call stack

What are the ESP and the EBP registers?

[亡魂溺海] 提交于 2019-11-27 12:46:42
问题 I found that the ESP register is the current stack pointer and EBP is the base pointer for the current stack frame. However, I don't understand these definitions (I am just starting to learn how to code in assembler). What I understand is that ESP points towards the stack itself and EBP points towards whatever is on top of the stack 1 . But these are just my guesses and they are most likely incorrect. Otherwise, what would a statement like the following mean? MOV EBP, ESP Footnote 1: Editor's

How to filter call stack in Eclipse debug view for Java

偶尔善良 提交于 2019-11-27 12:19:21
While debugging, the Debug view in Eclipse shows the call stack. Which is great. But I'd love to be able to filter out all the call that I definitely don't care about, such as Spring and the JUnit runner. Here's an example of my call stack right now. I'd like to keep the entries in bold, while hiding all the rest. Is it possible to do in any way? (plugin, next Eclipse release, configuration, ...) com.myproject.mymodule.MyFinderObject.fetchDestinationSettings com.myproject.mymodule.MyFinderObject.compareCurrentSettings com.myproject.mymodule.MyFinderObject.compareSettings sun.reflect

How can I get a call stack listing in Perl?

烂漫一生 提交于 2019-11-27 11:00:46
Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls preceding a current position in a Perl script? I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects ending in the module where I need to use the data. Somewhere along the line the data got changed and I need to find out where. You can use Devel::StackTrace . use Devel::StackTrace; my $trace = Devel::StackTrace->new; print $trace->as_string; # like carp It behaves like Carp's trace, but you

Why don't Minidumps give good call stacks?

廉价感情. 提交于 2019-11-27 10:35:07
问题 I've used minidumps on many game projects over the years and they seem to have about a 50% chance of having a valid call stack. What can I do to make them have better call stacks? I've tried putting the latest dbghelp.dll in the exe directory. That seems to help some. Is Visual Studio 2008 or 2010 any better? (I'm still on VS 2005). The code I use looks like this sample. 回答1: One thing you can do to improve the accuracy of call stacks found in dumps is to use a debugger other than Visual

Android Studio - Where can I see callstack while debugging an android app?

喜你入骨 提交于 2019-11-27 10:03:25
问题 While on a break point, how do I see the call stack to find the callee method/function? 回答1: At the bottom panel you should have "5: Debug". Click on it and select "Debugger -> Threads" You may need to find the "Threads" icon on the far right, or even click the "Restore Layout" button on the left to restore this window. 回答2: Seems like there is an UI-Bug in the Android Studio (1.x, 2.x and 3.x). For me the "Frames/Threads" Panel was completely hidden behind the toolbar, so I had to change the

Increase stack size when compiling with mingw?

旧街凉风 提交于 2019-11-27 09:18:19
I'm writing a recursive flood-fill algorithm to find connected components in an image, my code compiles and runs well with MSVC 2008 compiler; but the mingw-compiled binary crashed at runtime. After I converted the algorithm to non-recursive with std::stack, everything goes well. But what if I must use recursive algorithm in some case, and mingw cannot handle it? How can I increased stack size of a binary, is there any compilation options? Thanks Use gcc -Wl,--stack,N where N is stack size. E.g. gcc -Wl,--stack,4194304 probably the best bet is to use pthreads to start a new thread and run your