Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up/Down commands don't work in post mortem mode #93

Closed
deivid-rodriguez opened this issue Nov 4, 2014 · 8 comments
Closed

Up/Down commands don't work in post mortem mode #93

deivid-rodriguez opened this issue Nov 4, 2014 · 8 comments
Labels

Comments

@deivid-rodriguez
Copy link
Owner

Reported in #92

@deivid-rodriguez
Copy link
Owner Author

@torbiak It should be fixed now. Could you try?

deivid-rodriguez pushed a commit that referenced this issue Nov 29, 2014
Use the actual number of items in the backtraces as the backtrace size
instead of the (less reliable) calculated value.
@torbiak
Copy link

torbiak commented Dec 2, 2014

It kinda works. Here's something weird, though: if I post-mortem an exception two calls deep I can navigate to the topmost call, but as I post-mortem deeper calls I find I can only go up at most two levels.

01:18|~/code/ruby/jt$ cat test_byebug.rb 
def a; raise 'omg' end
def b; a end
def c; b end
def d; c end
d
01:18|~/code/ruby/jt$ byebug --post-mortem test_byebug.rb                                            

[1, 5] in /Users/torbiak/code/ruby/jt/test_byebug.rb
=> 1: def a; raise 'omg' end
   2: def b; a end
   3: def c; b end
   4: def d; c end
   5: d
(byebug) c

[1, 5] in /Users/torbiak/code/ruby/jt/test_byebug.rb
=> 1: def a; raise 'omg' end
   2: def b; a end
   3: def c; b end
   4: def d; c end
   5: d
The program finished.
(byebug:post-mortem) up

[1, 5] in /Users/torbiak/code/ruby/jt/test_byebug.rb
   1: def a; raise 'omg' end
=> 2: def b; a end
   3: def c; b end
   4: def d; c end
   5: d
(byebug:post-mortem) up

[1, 5] in /Users/torbiak/code/ruby/jt/test_byebug.rb
   1: def a; raise 'omg' end
   2: def b; a end
=> 3: def c; b end
   4: def d; c end
   5: d
(byebug:post-mortem) up
*** Can't navigate beyond the oldest frame

@torbiak
Copy link

torbiak commented Dec 2, 2014

Crap, sorry. For the previous message I was accidentally testing with 3.5.1. Running the same test with master (972cb7a) I'm just getting a stack trace array printed out:

02:34|~/code/ruby/jt$ byebug --post-mortem test_byebug.rb 
omg
["/Users/torbiak/code/ruby/jt/test_byebug.rb:1:in `a'", "/Users/torbiak/code/ruby/jt/test_byebug.rb:2:in `b'", "/Users/torbiak/code/ruby/jt/test_byebug.rb:3:in `c'", "/Users/torbiak/code/ruby/jt/test_byebug.rb:4:in `d'", "/Users/torbiak/code/ruby/jt/test_byebug.rb:5:in `<top (required)>'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/runner.rb:27:in `debug_load'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/runner.rb:27:in `debug_program'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/runner.rb:86:in `block in run'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/runner.rb:85:in `loop'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/runner.rb:85:in `run'", "/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/bin/byebug:5:in `<top (required)>'", "/Users/torbiak/.rbenv/versions/2.1.2/bin/byebug:23:in `load'", "/Users/torbiak/.rbenv/versions/2.1.2/bin/byebug:23:in `<main>'"]

Maybe I'm doing something wrong building it?

@deivid-rodriguez
Copy link
Owner Author

No, I actually forgot to test this behaviour when running byebug's script, I just fixed it when dropping a byebug call inside the program. I'll push a proper fix soon.

deivid-rodriguez pushed a commit that referenced this issue Dec 5, 2014
Instead of exposing the stacksize, we expose the whole backtrace from
the C-extension so we can properly filter byebug internal frames. This
way we don't need to resort to Thread.current.backtrace_locations which
doesn't solve the problem in post_mortem mode.
@deivid-rodriguez
Copy link
Owner Author

@torbiak Can you try again now?

@torbiak
Copy link

torbiak commented Dec 6, 2014

I get a NoMethodError for stack_size if I use the byebug method:

$ cat test_byebug.rb
require 'byebug'
def a; raise 'omg' end
def b; a end
def c; b end
def d; c end
byebug
d
$ ruby test_byebug.rb
test_byebug.rb: NoMethodError/Users/torbiak/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/attacher.rb:24:in `byebug': undefined method `stack_size' for Byebug::Context:Class (NoMethodError)
        from test_byebug.rb:6:in `<main>'

And if I remove the byebug call and try to run it with the byebug script it hangs and doesn't respond to SIGTERM, only to SIGKILL.

@deivid-rodriguez
Copy link
Owner Author

@torbiak I think your environment is misconfigured somehow, the output you pasted seems to be using byebug 3.5.1 and not the one from master.

I get the right results in both cases using last master. Could you check your environment and try again?

@torbiak
Copy link

torbiak commented Dec 26, 2014

Yeah, my environment was messed up and the native extension wasn't loading. It's working fine now. Thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants