Skip to content

Fix no available capacity error and other minor fixes. #1274

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ssttuu
Copy link

@ssttuu ssttuu commented May 2, 2025

Changes

  • This PR increases the debug event channel size to avoid dropping events in large code bases.
  • Fixes the extension.js exit handler when the process segfaults.
  • Removes unsafe impl Send from all SB* cpp structs.
  • Fixes the drop_pyobject function signature to return void since that's what the rust signature expects when calling std::mem::transmute.
  • Adds null pointer checks to the python interface.

This should resolve #1273, #1140, and #1010.

Fixes #1273.

Verification Evidence

I made my changes, then ran the following:

$ mkdir build
$ cd build
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-aarch64-apple-darwin.cmake -DLLDB_PACKAGE=/Users/stu/Downloads/lldb--aarch64-apple-darwin.zip
$ make vsix_full
Archive:  /Users/stu/Downloads/lldb--aarch64-apple-darwin.zip
[  0%] Built target lldb
[  3%] Built target extension
[ 11%] Built target lang_support
[ 15%] Performing build step for 'cargo_build'
   Compiling codelldb v1.0.0 (/Users/stu/dev/vadimcn/codelldb/adapter/codelldb)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.02s
[ 19%] No install step for 'cargo_build'
[ 23%] Completed 'cargo_build'
[ 42%] Built target cargo_build
[ 42%] Built target codelldb_exe
[ 76%] Built target codelldb_scripts
[ 76%] Built target adapter

> [email protected] vsce
> vsce package --baseContentUrl https://github.com/vadimcn/codelldb/blob/v1.11.4-dev.2505021902 --baseImagesUrl https://github.com/vadimcn/codelldb/raw/v1.11.4-dev.2505021902 --target darwin-x64 -o /Users/stu/dev/vadimcn/codelldb/build/codelldb-full.vsix

 WARNING  LICENSE.md, LICENSE.txt or LICENSE not found
Do you want to continue? [y/N] Y
 DONE  Packaged: /Users/stu/dev/vadimcn/codelldb/build/codelldb-full.vsix (992 files, 43.46MB)
[100%] Built target vsix_full

I opened vscode and loaded the extension directly from the .vsix file.

Running the debugger now works as expected!

Screenshot 2025-05-02 at 12 28 48 PM

@ssttuu ssttuu changed the title Fix 'no available capacity' error by increasing queue size. Fix no available capacity error by increasing queue size. May 2, 2025
Copy link
Author

@ssttuu ssttuu May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied the latest version from here:
https://microsoft.github.io/debug-adapter-protocol/debugAdapterProtocol.json

It's just slight documentation changes.

@@ -113,6 +113,14 @@ pub fn initialize(debugger: &SBDebugger, adapter_dir: &Path) -> Result<Arc<Pytho
session_id: c_int,
event: *const c_char,
) {
if interface.is_null() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add null pointer checks to ensure there are no issues here during evaluation.

@@ -2,7 +2,7 @@ use super::*;

cpp_class!(pub unsafe struct SBAddress as "SBAddress");

unsafe impl Send for SBAddress {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, none of the SB* structs should be Send. Everything continues working with these removed. Let me know what you think @vadimcn.

@@ -239,10 +257,9 @@ def handle_message(body_ptr, body_len):
return True


@CFUNCTYPE(c_bool, py_object)
@CFUNCTYPE(None, py_object)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change because the type signature for drop_pyobject returns void.

drop_pyobject: unsafe extern "C" fn(obj: *mut c_void)

@ssttuu ssttuu changed the title Fix no available capacity error by increasing queue size. Fix no available capacity error and other minor fixes. May 5, 2025
Repository owner deleted a comment from ssttuu May 7, 2025
@vadimcn
Copy link
Owner

vadimcn commented May 7, 2025

Thanks!

However, this PR contains a lot of unrelated changes. Based on the error message, the only channel that needs its capacity increased is the DAP output queue here (which I’ve already updated in my dev branch).

You make a valid point about drop_pyobject and adapterProcess.on('exit', ...), so I’ll fix those.

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

Successfully merging this pull request may close these issues.

Setting breakpoint briefly pauses but then continues execution
2 participants