callstack

Allocating a new call stack

百般思念 提交于 2019-12-10 04:12:27
问题 (I think there's a high chance of this question either being a duplicate or otherwise answered here already, but searching for the answer is hard thanks to interference from "stack allocation" and related terms.) I have a toy compiler I've been working on for a scripting language. In order to be able to pause the execution of a script while it's in progress and return to the host program, it has its own stack: a simple block of memory with a "stack pointer" variable that gets incremented

Javascript backtrace

匆匆过客 提交于 2019-12-10 03:26:14
问题 How to I get a backtrace in Javascript? Ideal features: entry function name, or some meaningful identifier for anonymous functions, argument list at each level, line numbers. Can this be done in standard ECMAScript? If not, can it be done in the common web browser dialects? Thanks. Edit -- Thanks for your suggestions. My dialect doesnot support arguments.caller or arguments.callee . I can do this: try { let x = null; x .foo (); } catch (e) { debug (dump (e.stack)); } Which gets me the

How to Inspect Call Stack

坚强是说给别人听的谎言 提交于 2019-12-10 02:23:56
问题 Would it be possible to see the CallStack in VBA for MS Access 2003? That is to say, would it be possible to see from what procedure or function another function was called? 回答1: There is no programmatic way in VBA to view the call stack that I know of. The usual solution to this problem is to use some structure to track calling of functions, but it always seems like a kludge to me, and really of use only when programming (not at runtime), in which case it seems to me that the VBE's built-in

Async recursion. Where is my memory actually going?

隐身守侯 提交于 2019-12-09 03:09:25
问题 This is asked more out of curiosity than with regards to any real-world problem. Consider the following code: void Main() { FAsync().Wait(); } async Task FAsync() { await Task.Yield(); await FAsync(); } In the synchronous world, this would ultimately cause a stackoverflow. In the async world, this simply consumes a lot of memory (which I assume is related to something that I might loosely call the "asynchronous stack"?) What precisely is this data, and how is it held? 回答1: Good question. The

Warnings from caller's perspective (aka Python-equivalent of Perl's carp)?

痞子三分冷 提交于 2019-12-08 18:39:44
问题 Short version: Is there way to achieve in Python the same effect achieved by Perl's Carp::carp utility? Long version (for those unfamiliar with Carp::carp ): Suppose we are implementing some library API function (i.e., it is meant to be used by other programmers in their code), say spam , and suppose that spam includes some code to check the validity of the arguments passed to it. Of course, this code is supposed to raise an exception if any problem with these arguments is detected. Let's say

Is it safe to use the StackTrace class to find the caller of the current method

只谈情不闲聊 提交于 2019-12-08 07:18:52
问题 I would like to know if it is safe to use the following code to determine the name (and possibly more information) about the method or object that called the current executing code: StackTrace stackTrace = new StackTrace(); // get call stack StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) More particularly, are there any special/corner cases where accessing the frames would not work or throw exceptions? I have looked in the MSDN page of StackTrace but found no

In C# (or .NET in general) can you mask the call stack level where an exception was thrown via attributes?

痴心易碎 提交于 2019-12-07 08:11:33
问题 The title may be a little confusing so I'll explain. Say you had this call chain... public DoWork(index) >> private DoWorkHelper(index) >> private CheckIndex(index) Now if you call DoWork , it traverses the calls down to CheckIndex , adding each deeper call to the call stack. Now if someone calls DoWork with a bad value for index , it throws the exception all the way down at CheckIndex , and currently, that's where the debugger breaks. You then have to walk back up the call stack to see the

in javascript get the callstack that lead to error

爷,独闯天下 提交于 2019-12-07 04:11:56
问题 The problem is not getting the callstack in general, which can be done as described here: http://eriwen.com/javascript/js-stack-trace/ but rather in accessing the callstack that triggered the event, from the handler of the event. In particular I'm interested in logging the callstack from the window error event window.onerror = function(msg, url, line) { //callstack // would be nice to have. //log callstack or whatever. (note this can be done w/ ajax and service, and is not the question at

Is it safe to use the StackTrace class to find the caller of the current method

余生颓废 提交于 2019-12-06 20:08:29
I would like to know if it is safe to use the following code to determine the name (and possibly more information) about the method or object that called the current executing code: StackTrace stackTrace = new StackTrace(); // get call stack StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) More particularly, are there any special/corner cases where accessing the frames would not work or throw exceptions? I have looked in the MSDN page of StackTrace but found no reference to any possible issues. Methods may be inlined by the compiler providing a different view

Does a stack frame really get pushed onto the stack when a function is called?

馋奶兔 提交于 2019-12-06 13:55:39
问题 The way I've been taught for quite some time is that when I run a program, the first thing that immediately goes on the stack is a stack frame for the main method. And if I call on a function called foo() from within main, then a stack frame that is the size of the local variables ( automatic objects) and the parameters gets pushed onto the stack as well. However, I've ran into a couple things that contradict this. And I'm hoping someone can clear up my confusion or explain why there really