callstack

How are exceptions allocated on the stack caught beyond their scope?

别说谁变了你拦得住时间么 提交于 2019-11-27 02:06:42
问题 In the following code, the stack-based variable 'ex' is thrown and caught in a function beyond the scope in which ex was declared. This seems a bit strange to me, since (AFAIK) stack-based variables cannot be used outside the scope in which they were declared (the stack is unwound). void f() { SomeKindOfException ex(...); throw ex; } void g() { try { f(); } catch (SomeKindOfException& ex) { //Handling code... } } I've added a print statement to SomeKindOfException's destructor and it shows

How to get Java Call Stack of a running application

我们两清 提交于 2019-11-27 01:38:21
问题 I am working on very huge java web based application. As there is no proper logging done while development so its very difficult for me to put break point and debug the app as i dont know execution order. Is there any mechanism to get complete Call Stack of the the running java application after I perform some actions. I searched it on net for long time but cannot came to concrete solution. Please suggest me if something is there for it. Thanks 回答1: Method 1: Use jstack utility from command

Need a way to periodically log the call stack/stack trace for EVERY method/procedure/function called

感情迁移 提交于 2019-11-27 01:23:38
问题 I'm working on a very large application where periodically I'd like to log the ENTIRE call stack up until the current execution point (not on an exception). The idea here is that I want a map of the exact code path that led me to the point that I am. I have been working with madExcept, tooled around with jclDebug and while I can get some of the call stack, I can't seem to get EVERY method/procedure/function call that is made in the application to show up in the log. I've got stack frames

How to Log Stack Frames with Windows x64

℡╲_俬逩灬. 提交于 2019-11-27 00:04:28
问题 I am using Stackdumps with Win32, to write all return adresses into my logfile. I match these with a mapfile later on (see my article [Post Mortem Debugging][1]). EDIT:: Problem solved - see my own answer below. With Windows x64 i do not find a reliable way to write only the return adresses into the logfile. I tried several ways: Trial 1: Pointer Arithmetic: CONTEXT Context; RtlCaptureContext(&Context); char *eNextBP = (char *)Context.Rdi; for(ULONG Frame = 0; eNextBP ; Frame++) { char *pBP =

Is there any way to set a breakpoint in gdb that is conditional on the call stack?

时光毁灭记忆、已成空白 提交于 2019-11-26 22:50:07
I am debugging C++ in gdb 7.1 on Linux. I have a function a() that is called in many places in the code. I want to set a breakpoint in it, but only if it was called from b() . Is there any way to do it? Is there any way to do it only if b() was called from c() , and so on ad infinitum? Update: There is now a better answer to this question: use GDB _is_caller convenience function. The need you describe comes up quite often, usually in the context of some_utility_fn being called a lot, but you only are interested in the call which comes from some_other_fn . You could probably script this entire

Why does calling setTimeout with parenthesis not start a new callstack?

匆匆过客 提交于 2019-11-26 21:42:13
问题 The following code has a new callstack when the debugger fires in d (jsfiddle here) function c() { setTimeout( d, 1000 ); } function d() { debugger; } c(); If we modify the code to use setTimeout( d(), 1000 ); which has brackets (parenthesis:) function c() { setTimeout( d(), 1000 ); } function d() { debugger; } c(); then the callstack has both c() and d() (jsfiddle here). Why? 回答1: You are not passing setTimeout the function d in the second example; you are instead passing d() , which is the

What is the purpose of the _chkstk() function?

 ̄綄美尐妖づ 提交于 2019-11-26 20:48:26
问题 I recently used the /FAsu Visual C++ compiler option to output the source + assembly of a particularly long member function definition. In the assembly output, after the stack frame is set up, there is a single call to a mysterious _chkstk() function. The MSDN page on _chkstk() does not explain the reason why this function is called. I have also seen the Stack Overflow question Allocating a buffer of more a page size on stack will corrupt memory?, but I do not understand what the OP and the

Increase stack size when compiling with mingw?

戏子无情 提交于 2019-11-26 17:05:26
问题 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 回答1: Use gcc -Wl,--stack,N where N is stack

How to filter call stack in Eclipse debug view for Java

我与影子孤独终老i 提交于 2019-11-26 15:58:00
问题 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

Explain the concept of a stack frame in a nutshell

跟風遠走 提交于 2019-11-26 14:52:56
It seems that I get the idea of call stack in programming language design. But I cannot find (probably, I just don't search hard enough) any decent explanation of what stack frame is. So I would like to ask someone to explain it to me in a few words. Tony R A stack frame is a frame of data that gets pushed onto the stack. In the case of a call stack, a stack frame would represent a function call and its argument data. If I remember correctly, the function return address is pushed onto the stack first, then the arguments and space for local variables. Together, they make the "frame," although