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

Crashed when hit breakpoint #4683

Closed
Hasnayeen opened this issue Nov 9, 2022 · 1 comment · Fixed by #9632
Closed

Crashed when hit breakpoint #4683

Hasnayeen opened this issue Nov 9, 2022 · 1 comment · Fixed by #9632
Labels
A-debug-adapter Area: Debug adapter client C-bug Category: This is a bug

Comments

@Hasnayeen
Copy link

Hasnayeen commented Nov 9, 2022

Summary

I'm trying to use XDebug (PHP Debugger) in Helix but as soon I hit a breakpoint it is crashing. (Full backtrace is included in reproduction steps)

Here is my debuggger config in ~/.config/helix/languages.toml

[[language]]
name = "php"
language-server = { command = "phpactor", args = ["language-server", "-vvv"] }

[language.debugger]
name = "xdebug"
command = "node"
args = ["/home/hasnayeen/.vscode/extensions/xdebug.php-debug-1.29.0/out/phpDebug.js"]
transport = "tcp"
port-arg = "--server={}"

[[language.debugger.templates]]
name = "listen"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { log = "true" }

I'm using vscode-php-debug vscode extension for XDebug.

The panic is happening at this line

breakpoint.line.unwrap().saturating_sub(1); // TODO: no unwrap

Let me know if any more info is needed

Reproduction Steps

I tried this:

  1. Opened a php app in helix
  2. Launched debug target
  3. Set breakpoint
  4. Visit the app in the browser

I expected this to happen:
Execution paused at the breakpoint

Instead, this happened:
Editor crashed with this backtrace

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /mnt/work/projects/rust/helix/helix-view/src/handlers/dap.rs:230:57
stack backtrace:
   0:     0x55c190a99d64 - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55c190a99d64 - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55c190a99d64 - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x55c190a99d64 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x55c19026c84c - core::fmt::write::hba4337c43d992f49
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0x55c190a93745 - std::io::Write::write_fmt::heb73de6e02cfabed
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0x55c190a9bc0e - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x55c190a9bc0e - std::sys_common::backtrace::print::h426700d6240cdcc2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x55c190a9bc0e - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0x55c190a9b93d - std::panicking::default_hook::h2e88d02087fae196
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0x55c190a9c29b - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  11:     0x55c190a9c09c - std::panicking::begin_panic_handler::{{closure}}::he054b2a83a51d2cd
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:586:13
  12:     0x55c190a9a294 - std::sys_common::backtrace::__rust_end_short_backtrace::ha48b94ab49b30915
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x55c190a9be2d - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  14:     0x55c1901e3d73 - core::panicking::panic_fmt::h366d3a309ae17c94
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  15:     0x55c1901e3c3d - core::panicking::panic::h8705e81f284be8a5
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
  16:     0x55c19091772c - helix_view::handlers::dap::<impl helix_view::editor::Editor>::handle_debugger_message::{{closure}}::h1a40edccacdbfd2d
  17:     0x55c19092bc0d - hx::main_impl::{{closure}}::hc4296afb22b7c56f
  18:     0x55c19091a332 - std::thread::local::LocalKey<T>::with::haf8391dd8bdf4720
  19:     0x55c19090e1b8 - tokio::park::thread::CachedParkThread::block_on::h536f4e114212371d
  20:     0x55c1908e4978 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::hf90aec8f2d5f48d3
  21:     0x55c19093cca5 - tokio::runtime::Runtime::block_on::h73022252afc446f2
  22:     0x55c1908fd975 - hx::main::haeb9b655d5f08cde
  23:     0x55c1909011d3 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd0d0e78c124d4950
  24:     0x55c190930ead - std::rt::lang_start::{{closure}}::h6726582d114e8e4c
  25:     0x55c190a8e03b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::had4f69b3aefb47a8
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
  26:     0x55c190a8e03b - std::panicking::try::do_call::hf2ad5355fcafe775
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  27:     0x55c190a8e03b - std::panicking::try::h0a63ac363423e61e
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  28:     0x55c190a8e03b - std::panic::catch_unwind::h18088edcecb8693a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  29:     0x55c190a8e03b - std::rt::lang_start_internal::{{closure}}::ha7dad166dc711761
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
  30:     0x55c190a8e03b - std::panicking::try::do_call::hda0c61bf3a57d6e6
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  31:     0x55c190a8e03b - std::panicking::try::hbc940e68560040a9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  32:     0x55c190a8e03b - std::panic::catch_unwind::haed0df2aeb3fa368
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  33:     0x55c190a8e03b - std::rt::lang_start_internal::h9c06694362b5b80c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
  34:     0x55c1908fda82 - main
  35:     0x7f4b9c614d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  36:     0x7f4b9c614e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  37:     0x55c19021ace5 - _start
  38:                0x0 - <unknown>

Helix log

~/.cache/helix/helix.log
2022-11-10T00:40:40.895 helix_dap::transport [ERROR] err: <- StreamClosed

Platform

Linux

Terminal Emulator

zsh

Helix Version

helix 22.08.1 (ba394dc)

@Hasnayeen Hasnayeen added the C-bug Category: This is a bug label Nov 9, 2022
@the-mikedavis the-mikedavis added the A-debug-adapter Area: Debug adapter client label Nov 9, 2022
@piokud84
Copy link

Crash at breakpoint - Windows 10
(the same file works ok on Windows 10 WSL2 Debian Linux
5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye)

Affected platform:
Windows 10
Helix 22.08.01
Python 3.10.8

LLVM 15.0.4
Features: windows
Platform: x86_64-pc-windows-msvc

Crash output:
thread 'main' panicked at 'called Option::unwrap() on a None value', D:\a\helix\helix\helix-view\src\handlers\dap.rs:230:57
stack backtrace:
0: 0x7ff684822ad4 -
1: 0x7ff683f5e4ea -
2: 0x7ff68481ab19 -
3: 0x7ff6848264bb -
4: 0x7ff684826155 -
5: 0x7ff684826bd2 -
6: 0x7ff68482694a -
7: 0x7ff684824047 -
8: 0x7ff68482662f -
9: 0x7ff6848be0d5 -
10: 0x7ff6848bdf7c -
11: 0x7ff6846ab56e -
12: 0x7ff6846a0551 -
13: 0x7ff6846bcfe0 -
14: 0x7ff684690054 -
15: 0x7ff68467a75b -
16: 0x7ff6846ce75b -
17: 0x7ff684692a34 -
18: 0x7ff684684a26 -
19: 0x7ff6846b1fdc -
20: 0x7ff684813c98 -
21: 0x7ff684692bd7 -
22: 0x7ff6848b825c -
23: 0x7ffda43d74b4 - BaseThreadInitThunk
24: 0x7ffda47226a1 - RtlUserThreadStart

Reproduce steps:
compile helloworld.c (clang or gcc -O0 -g)
open Helix editor
open helloworld.c
set breakpoint at main
Launch debug target -> binary (select compiled program) -> hit enter -> CRASH

pascalkuthe pushed a commit that referenced this issue Feb 16, 2024
* Remove unwrap on line option, preventing DAP crash, ref #4683

* Update to fall back to existing values for option fields
uek-1 pushed a commit to uek-1/helix that referenced this issue Feb 24, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
cosmikwolf pushed a commit to cosmikwolf/helix that referenced this issue Feb 26, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
postsolar pushed a commit to postsolar/helix that referenced this issue Apr 4, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
mtoohey31 pushed a commit to mtoohey31/helix that referenced this issue Jun 2, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
Vulpesx pushed a commit to Vulpesx/helix that referenced this issue Jun 7, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
smortime pushed a commit to smortime/helix that referenced this issue Jul 10, 2024
* Remove unwrap on line option, preventing DAP crash, ref helix-editor#4683

* Update to fall back to existing values for option fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debug-adapter Area: Debug adapter client C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants