search for: set_trace_func

Displaying 6 results from an estimated 6 matches for "set_trace_func".

2012 Oct 17
2
autolog: set_trace_func without all the typing
If it helps anyone developing Rails, apps, or gems, I wrote a shortcut for set_trace_func, so next time you want to just add a line before and after some function you are trying to debug you can have Ruby temporarily output every line, method, etc. executed. Also, it lets you define the format, use other loggers, etc. via a proc/lambda define, since you might not like the default fo...
2012 Mar 08
0
Safari Version 5.1.3 (7534.53.10) Browser problem --- removing cookie on OS X Lion 10.7.3 (11D50b) when still valid
...e steps leading to Safari dropping of the cookie 1) signin and set the cookie[:remember_user_token] to User.id 2) get /index_stats for user --- cookie still valid 3) get /show_stats : rendering the view showed that the cookie value returned was nil How to debug the problem?: 1) Use the Ruby method set_trace_func to see the source code being executed a) U must be judicious in turning on / off the set_trace_func method as it blows out a lot of source tracing. b) Use of Unix split utility helped at the beginning to pare down the size of file to edit as u could blow up your editor due to size 2) from th...
2012 Oct 17
2
autolog: easily debug-like logging on the fly in your Rails app
If it helps anyone developing Rails apps or gems, I wrote a shortcut for set_trace_func, so next time you want to just add a line before and after some function you are trying to debug you can have Ruby temporarily output every line, method, etc. executed. Also, it lets you define the format, use other loggers, etc. via a proc/lambda define, since you might not like the default fo...
2006 Jul 05
2
Rails debugging - a (slightly) better approach?
...39;'t particularly like) there is no reasonable debugging support for Rails. I know about breakpointer which - while useful - does not help me understand how things hang together. I had a look at the source code of the core ruby debugger (debug.rb) and tried to make sense of it. Debug.rb uses set_trace_func to install a hook that gets executed on every line, call, return, def, etc. and runs a fair bit of conditional code on it (tracing the stack frames, checking for breakpoints, etc.). The reason that it is unuseably slow with rails is that there are a LOT of statements to process in this way until th...
2012 Oct 18
0
unexpected return (LocalJumpError) only when executing this code within autoloaded classes?
...cause-unexpected-return-l The following is a generified part of the code in a gem I''m working on: module SomeModule class << self attr_accessor :procedure def log_events(*args) args.flatten! if args.size == 1 eval "set_trace_func proc {|event, file, line, id, binding, classname| begin; SomeModule.procedure.call(event, file, line, id, binding, classname) if event == #{args[0].inspect}; rescue SystemExit, Interrupt; raise; rescue Exception; end}" elsif args.size > 1 eval "set_trace_func p...
2008 Dec 31
0
How can I listen the events of module/class defined
In our project, I need to listen the events of module/class defined, and record the events that include the context of the module/class defined. In ruby, I cannot add a listener for the module/class defined, only i can set a proc with set_trace_func, in the proc, I cannot get the module/class name from the parameters. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA3...