backtrace

Rails backtrace silencers do not work, while filters do

泄露秘密 提交于 2019-12-01 16:28:38
Fresh Rails 4.2 set up. I want to suppress long error backtraces. In the following backtrace log first line would be enough for me, and next 4 could be removed ActionController::RoutingError (No route matches [GET] "/user"): actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' web-console (2.1.2) lib/web_console/middleware.rb:37:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app' I've added a new silencer to backtrace_silencers.rb # config/initializers/backtrace

Rails backtrace silencers do not work, while filters do

血红的双手。 提交于 2019-12-01 15:47:21
问题 Fresh Rails 4.2 set up. I want to suppress long error backtraces. In the following backtrace log first line would be enough for me, and next 4 could be removed ActionController::RoutingError (No route matches [GET] "/user"): actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' web-console (2.1.2) lib/web_console/middleware.rb:37:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.1) lib/rails/rack/logger.rb:38

How can iterate the stack frames manually in C?

允我心安 提交于 2019-12-01 00:56:55
While handling signals in applications I can correctly see the backtrace in the debugger.But the backtrace system call is not showing the stack frames correctly.Is there a difference in how gdb stores stack frames and how the backtrace system call dumps them? You cannot portably iterate through the stack frames in C99 or C11 . First because there is no guarantee of any call stack in the C standard. (one could imagine some C compiler doing whole program analysis and avoiding the stack if it is useless, e.g. if recursion cannot occur; I know no such C compiler). See e.g. this C FAQ question for

Alternative to backtrace() on Linux that can find symbols for static functions

橙三吉。 提交于 2019-11-30 20:31:48
In the man page, the backtrace() function on Linux says: Note that names of "static" functions are not exposed, and won't be available in the backtrace. However, with debugging symbols enabled ( -g ), programs like addr2line and gdb can still get the names of static functions. Is there a way to get the names of static functions programmatically from within the process itself? If your executable (and linked libraries) are compiled with debugging information (i.e. with -g flag to gcc or g++ ) then you could use Ian Taylor's libbacktrace (announced here ) from inside GCC - see its code here That

Is there a cheaper way to find the depth of the call stack than using backtrace()?

↘锁芯ラ 提交于 2019-11-30 16:44:30
My logging code uses the return value of backtrace() to determine the current stack depth (for pretty printing purposes), but I can see from profiling that this is a pretty expensive call. I don't suppose there's a cheaper way of doing this? Note that I don't care about the frame addresses, just how many of them there are. edit: These logging functions are used all over a large code-base, so manually tracking the stack depth isn't really an option. Walking the stack yourself is pretty quick - most of the slowness in backtrace() is from looking up symbol names. On x86, you can do the following:

Backtrace from SQL query to application code?

柔情痞子 提交于 2019-11-30 14:32:46
Is there a way to find which line of code generated a MySQL statement in a Rails development log? In order to do some performance optimization, I would like to find which part of my app is creating which MySQL queries. When I take a look at my log, I see hundres of queries flashing around on each web request I do, and I need to find out where they come from. I'm thinking about adding some variables like ____FILE____ and ____LINE____ to the log output. Is that possible? Bryan Larsen https://github.com/lightyear/sql-logging gives you a backtrace for every SQL query plus a bunch of useful

How do I shorten the backtrace for a test failure in RSpec 2?

社会主义新天地 提交于 2019-11-30 11:09:24
When my specs hit an error, I get a message like this: Vendor should reject duplicate names Failure/Error: user_with_duplicate_email.should_not be_valid expected valid? to return false, got true # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with' # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/handler.rb:44:in `handle_matcher' # /home/kevin/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/gems/rspec-expectations-2.3.0/lib/rspec/expectations/extensions

set rails console stack backtrace limit permanently

无人久伴 提交于 2019-11-30 09:05:59
问题 rails console by default boots with context.back_trace_limit=16 , which can be changed to whatever you want simply by typing context.back_trace_limit=n . The problem is you have to type it each time you boot rails c . Where do I change the context.back_trace_limit permanently? Some more reading on rails console configuration appreciated. 回答1: You have to create/edit your ~/.irbrc with the following: IRB.conf[:BACK_TRACE_LIMIT]= 20 To be taken into account: The options must be uppercased This

gdb weird backtrace

混江龙づ霸主 提交于 2019-11-30 09:03:18
My program is statically compiled with dietlibc. It is compiled on ubuntu x64 (compiled for x86 using the -m32 flag) and is run on a centos x86. The compiled size is only about 100KB. I compile it with -ggdb3 and no optimization flags. My program uses signal.h to handle a SIGSEGV signal and then calls abort(). The program runs without problems for days but sometimes segfaults. This is when I get weird backtraces that I do not understand: username@ubuntu:~/Desktop$ gdb -c core.28569 program-name GNU gdb (GDB) 7.2 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version

How to include C backtrace in a kernel module code?

我的梦境 提交于 2019-11-30 06:32:37
问题 So I am trying to find out what kernel processes are calling some functions in a block driver. I thought including backtrace() in the C library would make it easy. But I am having trouble to load the backtrace. I copied this example function to show the backtrace: http://www.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/063/6391/6391l1.html All attempts to compile have error in one place or another that a file cannot be found or that the functions are not defined. Here is what