callstack

c++ stack trace from unhandled exception?

六眼飞鱼酱① 提交于 2019-12-17 15:27:46
问题 This question has been asked before and there have been windows-specific answers but no satisfactory gcc answer. I can use set_terminate() to set a function that will be called (in place of terminate() ) when an unhandled exception is thrown. I know how to use the backtrace library to generate a stack trace from a given point in the program. However, this won't help when my terminate-replacement is called since at that point the stack has been unwound. Yet if I simply allow the program to

List of all function calls made in an application

不羁岁月 提交于 2019-12-17 15:25:55
问题 How can we list all the functions being called in an application. I tried using GDB but its backtrace list only upto the main function call. I need deeper list i.e list of all the functions being called by the main function and the function being called from these called functions and so on. Is there a way to get this in gdb? Or could you give me suggestions on how to get this? 回答1: How can we list all the functions being called in an application For any realistically sized application, this

Stack overflow C++

99封情书 提交于 2019-12-17 14:47:27
问题 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] =

Stack overflow C++

﹥>﹥吖頭↗ 提交于 2019-12-17 14:45:52
问题 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] =

Does calling setTimeout clear the callstack?

末鹿安然 提交于 2019-12-17 12:49:08
问题 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

How can I increase the maximum call stack size in Node.js

二次信任 提交于 2019-12-17 07:20:16
问题 This is different to other questions regarding an error message in Node that reads RangeError: Maximum call stack size exceeded in that I know exactly why I'm getting this error message. It's happening because I'm recursing, recursing quite a lot in fact. Thanks. 回答1: From node --help : node --max-stack-size=val Update: as the comments indicate, even though the help text still lists the --max-stack-size option, in node v0.10.x you need to use --stack-size instead. node --stack-size=val 回答2:

Explain the concept of a stack frame in a nutshell

Deadly 提交于 2019-12-17 02:40:33
问题 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. 回答1: 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

Can somebody give me a hand about this stacktrace in iPhone app?

有些话、适合烂在心里 提交于 2019-12-14 03:08:24
问题 Program received signal: “EXC_BAD_ACCESS”. (gdb) bt #0 0x30011940 in objc_msgSend () #1 0x30235f24 in CFRelease () #2 0x308f497c in -[UIImage dealloc] () #3 0x30236b78 in -[NSObject release] () #4 0x30a002a0 in FlushNamedImage () #5 0x30250a26 in CFDictionaryApplyFunction () #6 0x30a001a4 in _UISharedImageFlushAll () #7 0x30a00738 in +[UIImage(UIImageInternal) _flushCacheOnMemoryWarning:] () #8 0x3054dc80 in _nsnote_callback () #9 0x3024ea58 in _CFXNotificationPostNotification () #10

In PhantomJS, what is the function call stack limit?

蹲街弑〆低调 提交于 2019-12-13 19:45:37
问题 How many times can a function recursively call itself before breeching PhantomJS javascript engine's call stack limit? Said another way, what is the last possible n printed here for PhantomJS: var n = 0; function f() { console.log(++n); f(); } f(); 回答1: I've used your code and ran it in different PhantomJS versions on my PC and my Raspberry Pi 1 running Raspbian. Platform | Version | Maximum callstack -------------------------------------- Win 8.1 | 2.0.0 | 65277 Win 8.1 | 1.9.8 | 65534 Win 8

General way to reset a member variable to its original value using the stack?

三世轮回 提交于 2019-12-12 17:25:10
问题 I came across a class instance function that needed to temporarily change a class instance variable, and then restore it when the function completed. The function had return statements all over the place, and before each return there was a restoring statement. That seemed messy to me, not to mention scary when a exception is thrown. As an improvement I came up with this generalization using a inner class definition. Here is a sample driver program (class restorer). class Unwind { private: