ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.14k stars 127 forks source link

Use default `max_lines` when calling `up` & `down` #1094

Open HeyNonster opened 7 months ago

HeyNonster commented 7 months ago

Description

Both up and down only show 1 source line when called, I think it would be more useful if they provided more context. This removes the max_lines: 1 kwarg when they call show_src. max_lines in show_src will default to CONFIG[:show_src_lines]^1.

Big thanks to @st0012 for showing me and @bquorning where this behavior is defined.

st0012 commented 7 months ago

I want to second this proposal as I also often need to chain whereami after moving to a different frame, which IMO is not the best user experience in most cases.

HeyNonster commented 7 months ago

Also probably useful to note that byebug displays more lines by default making it quite a difference switching from byebug to debug:

https://github.com/ruby/debug/assets/47484308/5f2174b9-1264-4753-be71-14203977c69f

launchable-app[bot] commented 6 months ago

Launchable Report

:x: Test session #2907805 failedos:ubuntu-latest test_task:test_protocoldetails on CI
:bell: no issues :heavy_multiplication_x:1 test failed :heavy_check_mark:63 tests passed

:x: Test session #2907807 failedos:ubuntu-latest test_task:test_protocoldetails on CI
:bell: no issues :heavy_multiplication_x:1 test failed :heavy_check_mark:63 tests passed

Passed test sessions :white_check_mark: Test session [#2907791](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907791) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907791) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907791) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907792](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907792) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907792) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907792) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907793](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907793) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907793) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907793) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907794](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907794) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907794) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907794) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907796](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907796) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907796) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907796) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907798](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907798) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907798) [![test_task:test_test](https://img.shields.io/badge/test__task-test__test-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907798) [details on CI](https://github.com/ruby/debug/actions/runs/9106425073) :white_check_mark: Test session [#2907799](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907799) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907799) [![test_task:test_protocol](https://img.shields.io/badge/test__task-test__protocol-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907799) [details on CI](https://github.com/ruby/debug/actions/runs/9106425063) :white_check_mark: Test session [#2907800](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907800) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907800) [![test_task:test_protocol](https://img.shields.io/badge/test__task-test__protocol-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907800) [details on CI](https://github.com/ruby/debug/actions/runs/9106425063) :white_check_mark: Test session [#2907801](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907801) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907801) [![test_task:test_protocol](https://img.shields.io/badge/test__task-test__protocol-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907801) [details on CI](https://github.com/ruby/debug/actions/runs/9106425063) :white_check_mark: Test session [#2907803](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907803) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907803) [![test_task:test_protocol](https://img.shields.io/badge/test__task-test__protocol-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907803) [details on CI](https://github.com/ruby/debug/actions/runs/9106425063) :white_check_mark: Test session [#2907815](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907815) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907815) [![test_task:test_protocol](https://img.shields.io/badge/test__task-test__protocol-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907815) [details on CI](https://github.com/ruby/debug/actions/runs/9106425063) :white_check_mark: Test session [#2907818](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907818) passed [![os:macos-latest](https://img.shields.io/badge/os-macos--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907818) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907818) [details on CI](https://github.com/ruby/debug/actions/runs/9106425066) :white_check_mark: Test session [#2907822](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907822) passed [![os:macos-latest](https://img.shields.io/badge/os-macos--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907822) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907822) [details on CI](https://github.com/ruby/debug/actions/runs/9106425066) :white_check_mark: Test session [#2907823](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907823) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907823) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907823) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907824](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907824) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907824) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907824) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907825](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907825) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907825) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907825) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907826](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907826) passed [![os:macos-latest](https://img.shields.io/badge/os-macos--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907826) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907826) [details on CI](https://github.com/ruby/debug/actions/runs/9106425066) :white_check_mark: Test session [#2907829](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907829) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907829) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907829) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907831](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907831) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907831) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907831) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907834](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907834) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907834) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907834) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069) :white_check_mark: Test session [#2907857](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907857) passed [![os:ubuntu-latest](https://img.shields.io/badge/os-ubuntu--latest-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907857) [![test_task:test_console](https://img.shields.io/badge/test__task-test__console-blue.svg)](https://app.launchableinc.com/organizations/ruby/workspaces/debug/data/test-sessions/2907857) [details on CI](https://github.com/ruby/debug/actions/runs/9106425069)

Build: refs_pull_1094_merge_b1963e7b72554c9672900ba046c3088598955488

HeyNonster commented 6 months ago

Seems the protocol tests are flaky: https://github.com/ruby/debug/pull/1060