backtrace

After the Ruby interpreter segfaults, is it possible to get the Ruby backtrace from the corefile?

别说谁变了你拦得住时间么 提交于 2019-12-04 07:42:23
Note: I'm using a segfault that I encountered whilst using the libxml-ruby gem to illustrate the question, but I've since fixed my problem with said gem. What this question is really about is viewing the Ruby backtrace (i.e. the same thing the interpreter prints when Ruby code fails to handle an exception) from gdb with a corefile the interpreter itself encounters a segmentation fault. I'm getting an odd segfault while generating an XML document, of all things: /railsroot/vendor/isolated/ruby-1.8/gems/libxml-ruby-1.1.2/lib/libxml/node.rb:123: [BUG] Segmentation fault ruby 1.8.7 (2011-02-18

can a program read its own elf section?

馋奶兔 提交于 2019-12-04 05:47:21
I would like to use ld's --build-id option in order to add build information to my binary. However, I'm not sure how to make this information available inside the program. Assume I want to write a program that writes a backtrace every time an exception occurs, and a script that parses this information. The script reads the symbol table of the program and searches for the addresses printed in the backtrace (I'm forced to use such a script because the program is statically linked and backtrace_symbols is not working). In order for the script to work correctly I need to match build version of the

Android _Unwind_Backtrace inside sigaction

两盒软妹~` 提交于 2019-12-04 05:02:04
I am trying to catch signals such as SIGSEGV in my Android NDK app for debugging purpose. For that, I have set up a sigaction that is called. I am now trying to get the stack of the call. The problem is that _Unwind_Backtrace only works on current stack and sigaction runs inside its own stack. So, is there a way to get the stack of the execution pointer that received the signal? (Basically tell _Unwind_Backtrace to unwind another stack than the current?) I should point out that : Using backtrace() and backtrace_symbols() is not an option since those functions are not delivered in the Android

x86_64 calling conventions and stack frames

跟風遠走 提交于 2019-12-03 17:31:03
问题 I am trying to make sense out of the executable code that GCC (4.4.3) is generating for an x86_64 machine running under Ubuntu Linux. In particular, I don't understand how the code keeps track of stack frames. In the old days, in 32-bit code, I was accustomed to seeing this "prologue" in just about every function: push %ebp movl %esp, %ebp Then, at the end of the function, there would come an "epilogue," either sub $xx, %esp # Where xx is a number based on GCC's accounting. pop %ebp ret or

Getting the current stack trace on Mac OS X

半城伤御伤魂 提交于 2019-12-03 07:49:55
I'm trying to work out how to store and then print the current stack in my C++ apps on Mac OS X. The main problem seems to be getting dladdr to return the right symbol when given an address inside the main executable. I suspect that the issue is actually a compile option, but I'm not sure. I have tried the backtrace code from Darwin/Leopard but it calls dladdr and has the same issue as my own code calling dladdr. Original post: Currently I'm capturing the stack with this code: int BackTrace(Addr *buffer, int max_frames) { void **frame = (void **)__builtin_frame_address(0); void **bp = ( void *

How to extract debugging information from a crash

会有一股神秘感。 提交于 2019-12-03 06:10:20
问题 If my C++ app crashes on Windows I want to send useful debugging information to our server. On Linux I would use the GNU backtrace() function - is there an equivalent for Windows? Is there a way to extract useful debugging information after a program has crashed? Or only from within the process? (Advice along the lines of "test you app so it doesn't crash" is not helpful! - all non-trivial programs will have bugs) 回答1: The function Stackwalk64 can be used to snap a stack trace on Windows. If

x86_64 calling conventions and stack frames

无人久伴 提交于 2019-12-03 05:35:06
I am trying to make sense out of the executable code that GCC (4.4.3) is generating for an x86_64 machine running under Ubuntu Linux. In particular, I don't understand how the code keeps track of stack frames. In the old days, in 32-bit code, I was accustomed to seeing this "prologue" in just about every function: push %ebp movl %esp, %ebp Then, at the end of the function, there would come an "epilogue," either sub $xx, %esp # Where xx is a number based on GCC's accounting. pop %ebp ret or simply leave ret which accomplishes the same thing: Set the Stack Pointer to the top of the current frame

How can I save a PHP backtrace to the error log?

☆樱花仙子☆ 提交于 2019-12-03 04:14:38
问题 I'm using this right now: error_log(serialize(debug_backtrace())); But I have to unserialize it every time. Is there a better way to store backtraces? 回答1: This should generate a readable string: error_log(print_r(debug_backtrace(), true)); Additionally, debug_print_backtrace() prints the back trace as string and its output can be captured with regular output buffer functions: ob_start(); debug_print_backtrace(); error_log(ob_get_clean()); 回答2: From my perspective the best approach is using

How can I save a PHP backtrace to the error log?

二次信任 提交于 2019-12-02 17:39:49
I'm using this right now: error_log(serialize(debug_backtrace())); But I have to unserialize it every time. Is there a better way to store backtraces? This should generate a readable string: error_log(print_r(debug_backtrace(), true)); Additionally, debug_print_backtrace() prints the back trace as string and its output can be captured with regular output buffer functions: ob_start(); debug_print_backtrace(); error_log(ob_get_clean()); Pramendra Gupta $log = var_export(debug_backtrace(), true); Then use the variable $log to log in file or what ever. From my perspective the best approach is

PHP - I want to know how to get function trace

…衆ロ難τιáo~ 提交于 2019-12-02 09:51:49
Is there any way to know all previous functions were called before a point in my code? For example: I set a point in abc.php in my project, and I want to get all functions that were called before that point was reached. debug_backtrace() does not help here. Thanks so much :) xdebug can generate function traces for you. See: http://xdebug.org/docs/execution_trace use xdebug it will show trace and much more useful info Use xdebug for trace and webgrind for vizualization this one. 来源: https://stackoverflow.com/questions/6758486/php-i-want-to-know-how-to-get-function-trace