callstack

Get function callers' information in python

折月煮酒 提交于 2019-11-30 13:21:27
I want to get information about the callers of a specific function in python. For example: class SomeClass(): def __init__(self, x): self.x = x def caller(self): return special_func(self.x) def special_func(x): print "My caller is the 'caller' function in an 'SomeClass' class." Is it possible with python? Yes, the sys._getframe() function let's you retrieve frames from the current execution stack, which you can then inspect with the methods and documentation found in the inspect module ; you'll be looking for specific locals in the f_locals attribute, as well as for the f_code information:

Split stacks unneccesary on amd64

独自空忆成欢 提交于 2019-11-30 11:22:51
There seems to be an opinion out there that using a "split stack" runtime model is unnecessary on 64-bit architectures. I say seems to be, because I haven't seen anyone actually say that, only dance around it: The memory usage of a typical multi-threaded program can decrease significantly, as each thread does not require a worst-case stack size. It becomes possible to run millions of threads (either full NPTL threads or co-routines) in a 32-bit address space. -- Ian Lance Taylor ...implying that a 64-bit address space can already handle it. And... ... the constant overhead of split stacks and

Obtain a callstack in Clojure

一笑奈何 提交于 2019-11-30 11:03:01
When I run my Clojure programs and get an error during execution, I notice that the message printed by the REPL only contains the top level line number from the script I executed. Can I get it to dump a call stack (which references the various line numbers of Clojure code)? For example: user=> (load-file "test.clj") java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$eval134$fn (test.clj:206) user=> It would be nicer if I knew more than just the top level call (line 206). The last Exception thrown is available in the *e var. You can print a stack trace by calling

Stack resident buffer overflow on 64-bit?

被刻印的时光 ゝ 提交于 2019-11-30 10:15:05
I'm studying some security related things and right now I'm playing around with my own stack. What I'm doing should be very trivial, I'm not even trying to execute the stack, simply to show that I can get control over the instruction pointer on my 64-bit system. I have turned off all protection mechanisms I'm aware of just to be able to play with it (NX-bit, ASLR, also compiling with -fno-stack-protector -z execstack). I don't have that much experience with 64-bit assembly and after spending some time searching and experimenting myself I'm wondering if anyone could shed some light on an issue

Show special primitive functions in call stack

强颜欢笑 提交于 2019-11-30 08:28:43
问题 This question prompted the following question: Is there a way to view the special primitive functions that are in the call stack? For example, create a function that returns the call stack on exit: myFun <- function(obj){ on.exit(print(sys.calls())) return(obj) } Calling this function and assigning its result to an object using assign avoids using special primitive functions: > assign("myObj",myFun(4)) [[1]] assign("myObj", myFun(4)) [[2]] myFun(4) But using the assignment operator, this gets

Get objects involved in Java stacktrace

只愿长相守 提交于 2019-11-30 05:16:15
问题 I can retreive the current stacktrace using Thread.currentThread().getStackTrace() but this gives me only the classes involved in the call. Is it possible to retreive the object instances involved in the call trace? Maybe some kind of library which allows me to retreive the objects from the heap? I have a problem which requires me to trace back to a Spring bean which indirectly created the object where i'm requesting the stack trace. UPDATE If there's no builtin tool for this in Java i'm

Understanding the execution order of subsequent then() handlers of an resolved promise

て烟熏妆下的殇ゞ 提交于 2019-11-30 04:37:13
问题 I am learning Promise, in order to understand it I read a bit about Event loop of JavaScript. This article briefly introduced the working of event loop such as call stack, event table and message queue. But I don't know how the call stack deal with the line containing 'return', and what happens thereafter. Below is an example that I wrote to hopefully understand how Promise works based on event loop. Also see http://jsbin.com/puqogulani/edit?js,console if you want to give it a go. var p1 =

How do I debug a difficult-to-reproduce crash with no useful call stack?

孤街醉人 提交于 2019-11-30 03:35:57
I am encountering an odd crash in our software and I'm having a lot of trouble debugging it, and so I am seeking SO's advice on how to tackle it. The crash is an access violation reading a NULL pointer: First chance exception at $00CF0041. Exception class $C0000005 with message 'access violation at 0x00cf0041: read of address 0x00000000'. It only happens 'sometimes' - I haven't managed to figure out any rhyme or reason, yet, for when - and only in the main thread. When it occurs, the call stack contains one incorrect entry: For the main thread, which this is, it should show a large stack full

GAS: Explanation of .cfi_def_cfa_offset

时光毁灭记忆、已成空白 提交于 2019-11-29 19:51:52
I would like an explanation for the values used with the .cfi_def_cfa_offset directives in assembly generated by GCC. I know vaguely that the .cfi directives are involved in call frames and stack unwinding, but I would like a more detailed explanation of why, for example, the values 16 and 8 are used in the assembly outputted by GCC in compiling the following C program on my 64-bit Ubuntu machine. The C program: #include <stdio.h> int main(int argc, char** argv) { printf("%d", 0); return 0; } I invoked GCC on the source file test.c as follows: gcc -S -O3 test.c . I know that -O3 enables

Profiling JavaScript Code on nodejs - Possible Approaches

青春壹個敷衍的年華 提交于 2019-11-29 17:54:34
My aim is to develop a java script profiler for nodejs . The requirements are as under : Should be able to fetch call stack . Get Time stamp information. Get number of iterations. My chief concern is that i should not modify the source file ( .js file ) . I have seen all the available profiling options for JavaScript code on node js . The problem i face is that most of them require manual injection of the profiling specific code into my source code. Here is an example var profiler = new Profiler() // Need to create profiler in my .js file profiler.startProfiling() // My Code profiler