textual-debugger 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/PKG-INFO +18 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/README.md +16 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/pyproject.toml +11 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/__init__.py +1 -1
- textual_debugger-0.3.2/src/tdb/_proc.py +90 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/server.py +17 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/session.py +22 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/padwalker.py +81 -15
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/server.py +50 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/session.py +62 -9
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/server.py +7 -19
- textual_debugger-0.3.2/src/tdb/adapters/ruby/ready/tdb_rdbg_ready.rb +49 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ruby/server.py +90 -20
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/server.py +13 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/session.py +47 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app.py +193 -24
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_handlers/dap_events.py +6 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_handlers/inspection.py +2 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_helpers.py +2 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/cli.py +462 -42
- textual_debugger-0.3.2/src/tdb/config_dir.py +52 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/client.py +108 -29
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/messages.py +7 -0
- textual_debugger-0.3.2/src/tdb/detach_relay.py +409 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/automation/json-rpc.md +44 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/automation/mcp.md +2 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/perl.md +5 -3
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/ruby.md +6 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/async-tasks.md +3 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/processes.md +2 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/threads.md +2 -0
- textual_debugger-0.3.2/src/tdb/docs/python/tracing.md +307 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/quickstart.md +4 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/reference/cli.md +39 -12
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/reference/configuration.md +48 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/debugging-controls.md +3 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/keybindings.md +21 -0
- textual_debugger-0.3.2/src/tdb/docs/using/run-detached.md +112 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/run-mode.md +3 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/vim-edit-mode.md +51 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/eval_mode.py +3 -14
- textual_debugger-0.3.2/src/tdb/examples/Python/trace/checkout.yaml +17 -0
- textual_debugger-0.3.2/src/tdb/examples/Python/trace/inventory_service.py +70 -0
- textual_debugger-0.3.2/src/tdb/examples/Python/trace/orders_service.py +89 -0
- textual_debugger-0.3.2/src/tdb/examples/Python/trace/send_orders.py +39 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/info.py +26 -8
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/keybindings/__init__.py +5 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/base.py +36 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/bash.py +1 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/cpp.py +23 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/go.py +4 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/ocaml.py +6 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/perl.py +15 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/powershell.py +3 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/python.py +1 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/python_attach.py +17 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/ruby.py +1 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/tcsh.py +1 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/mcp/__init__.py +5 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/mkdocs.yml +2 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/persist.py +193 -34
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/processes_cache.py +20 -32
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/replay.py +12 -3
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/replay_tui.py +55 -23
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/run_mode.py +32 -4
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/app.py +9 -3
- textual_debugger-0.3.2/src/tdb/server/auth.py +182 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/runner.py +41 -16
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/controller.py +321 -39
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/terminal.py +20 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/source_discovery.py +21 -2
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/source_edit.py +60 -5
- textual_debugger-0.3.2/src/tdb/source_search.py +150 -0
- textual_debugger-0.3.2/src/tdb/tool_env.py +87 -0
- textual_debugger-0.3.2/src/tdb/trace/__init__.py +1 -0
- textual_debugger-0.3.2/src/tdb/trace/agent/_tdb_trace_agent.py +2024 -0
- textual_debugger-0.3.2/src/tdb/trace/agent/sitecustomize.py +156 -0
- textual_debugger-0.3.2/src/tdb/trace/capture.py +364 -0
- textual_debugger-0.3.2/src/tdb/trace/contract.py +87 -0
- textual_debugger-0.3.2/src/tdb/trace/discover.py +327 -0
- textual_debugger-0.3.2/src/tdb/trace/launch.py +810 -0
- textual_debugger-0.3.2/src/tdb/trace/merge.py +101 -0
- textual_debugger-0.3.2/src/tdb/trace/perfetto.py +632 -0
- textual_debugger-0.3.2/src/tdb/trace/spec.py +368 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/bindings.py +2 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/engine.py +29 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/ex.py +16 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/global_cmd.py +3 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/search.py +40 -0
- textual_debugger-0.3.2/src/tdb/vi_app.py +226 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/code_editor.py +76 -3
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/code_view.py +147 -18
- textual_debugger-0.3.2/src/tdb/widgets/key_help.py +171 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/modals.py +77 -22
- textual_debugger-0.3.2/src/tdb/widgets/searchable_markdown.py +480 -0
- textual_debugger-0.3.2/src/tdb/widgets/source_modal.py +220 -0
- textual_debugger-0.3.2/src/tdb/widgets/syntax_themes.py +69 -0
- textual_debugger-0.3.2/src/tdb/widgets/theme_picker.py +86 -0
- textual_debugger-0.3.2/src/tdb/widgets/vi_status_bar.py +156 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/PKG-INFO +18 -1
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/SOURCES.txt +29 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/requires.txt +1 -0
- textual_debugger-0.3.0/src/tdb/widgets/source_modal.py +0 -105
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/LICENSE +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/setup.cfg +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/_timeouts.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/arith_for.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/declares.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/bash/tdb_harness.sh +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/native/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/native/gdb_stl_printers.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/native/tdb.h +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ocaml/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ocaml/lldb_formatters.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/Devel/TdbCompile.pm +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/Devel/TdbRemote.pm +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/helpers.pl +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/padwalker_src/Makefile.PL +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/padwalker_src/PadWalker.pm +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/padwalker_src/PadWalker.xs +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/protocol.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/perl/refs.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/locate.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/output.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/powershell/tdb_launch.ps1 +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ruby/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ruby/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/ruby/tdb.rb +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/seqs.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/breakpoints.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/cli.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/guardian.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/inspect.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/instrumenter.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/models.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/protocol.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/runtime.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/scanner.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/adapters/tcsh/transport.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_handlers/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_handlers/routing.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/app_handlers/ui_panels.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/breakpoint_hook.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/protocol.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/reverse.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/dap/types.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/about.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/automation/record-replay.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/index.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/installation.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/bash.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/c-cpp-fortran.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/go.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/index.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/ocaml.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/powershell.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/rust.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/languages/tcsh.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/attach-to-process.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/breakpoint-hook.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/post-mortem.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/python/pytest.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/tutorial-mcp-debugging.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/breakpoints.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/call-stack.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/console.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/crash-detection.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/eval-mode.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/evaluate-console.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/external-terminal.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/layout.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/remote-attach.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/docs/using/variables.md +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/documentation.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examine.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/C/breakpoint_hook_demo.c +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/C/pi_digits.c +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/C++/breakpoint_hook_demo.cpp +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/C++/pi_digits.cpp +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Fortran/breakpoint_hook_demo.f90 +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Fortran/pi_digits.f90 +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Go/breakpoint_hook_demo/go.mod +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Go/breakpoint_hook_demo/main.go +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Go/pi_digits.go +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/OCaml/breakpoint_hook_demo.ml +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/OCaml/pi_digits.ml +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Perl/breakpoint_hook_demo.pl +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Perl/pi_digits.pl +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/PowerShell/pi_digits.ps1 +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Python/pi_digits.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Ruby/breakpoint_hook_demo.rb +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Ruby/pi_digits.rb +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Rust/breakpoint_hook_demo/Cargo.toml +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Rust/breakpoint_hook_demo/src/main.rs +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/Rust/pi_digits.rs +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/bash/pi_digits.sh +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/examples/tcsh/pi_digits.tcsh +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/go_concurrency/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/go_concurrency/analyzer.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/go_concurrency/classifier.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/go_concurrency/collector.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/go_concurrency/models.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/inspection.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/inspection_full.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/_python_adapter.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/_python_gdb_helper.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/errors.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/native_tools.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/registry.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/languages/rust.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/mcp/__main__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/mcp/server.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/mcp/session.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/post_mortem.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/pytest_debugger.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/analyzer.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/classifier.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/collector.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/models.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/base.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/gdb.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/gdb_script.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/lldb.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/rust_concurrency/probes/lldb_script.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/event_handler.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/handlers.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/server/rpc_types.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/breakpoint_sync.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/child_processes.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/errors.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/event_bus.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/inspect_service.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/messages.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/post_mortem_loader.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/recorder.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/state.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/statement_stepper.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/session/textual_handler.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/source_analysis.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/terminal_text.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/marks.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/substitute.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/textedit.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/vi/textobjects.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/__init__.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/_inspection_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/async_tasks_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/breakpoint_view.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/console_view.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/evaluate_console.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/full_contents_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/goroutines_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/menu_bar.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/processes_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/rust_concurrency_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/stack_view.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/status_bar.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/threads_modal.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/tdb/widgets/variable_view.py +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/dependency_links.txt +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/entry_points.txt +0 -0
- {textual_debugger-0.3.0 → textual_debugger-0.3.2}/src/textual_debugger.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: textual-debugger
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: A TUI debugger for Python, Perl, and other languages. Based on textual.
|
|
5
5
|
Author-email: Al Danial <al.danial@gmail.com>
|
|
6
6
|
License: textual-debugger is licensed to you under the MIT/X Consortium license:
|
|
@@ -54,6 +54,7 @@ Requires-Dist: pygments>=2.17.0
|
|
|
54
54
|
Requires-Dist: fastapi>=0.115.0
|
|
55
55
|
Requires-Dist: uvicorn>=0.30.0
|
|
56
56
|
Requires-Dist: prompt_toolkit<3.1,>=3.0.52
|
|
57
|
+
Requires-Dist: pyyaml>=6.0
|
|
57
58
|
Provides-Extra: edit
|
|
58
59
|
Requires-Dist: textual[syntax]>=8.0.0; extra == "edit"
|
|
59
60
|
Provides-Extra: mcp
|
|
@@ -156,6 +157,22 @@ page for many more examples, and the
|
|
|
156
157
|
[CLI Reference](https://textual-debugger.readthedocs.io/reference/cli/)
|
|
157
158
|
for every option.
|
|
158
159
|
|
|
160
|
+
## Function Tracing
|
|
161
|
+
|
|
162
|
+
`tdb --trace` records calls to the functions you name in a Python program and
|
|
163
|
+
every process it starts, with no breakpoints and no TUI, and writes a
|
|
164
|
+
[Perfetto](https://ui.perfetto.dev) trace with one lane per thread and per
|
|
165
|
+
`asyncio` task. `--trace-merge` weaves the traces of several services into one
|
|
166
|
+
timeline, and `--trace-discover` writes a starter spec.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
tdb --trace checkout.yaml --trace-name orders orders_service.py -- --port 8002
|
|
170
|
+
tdb --trace-merge inv.jsonl ord.jsonl --trace-out all # open all.perfetto.json in ui.perfetto.dev
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
See [Function Tracing](https://textual-debugger.readthedocs.io/python/tracing/)
|
|
174
|
+
for the spec format, a two-service walkthrough, and the limitations.
|
|
175
|
+
|
|
159
176
|
## Acknowledgments
|
|
160
177
|
|
|
161
178
|
`tdb` is built with Will McGugan's [textual](https://github.com/Textualize/textual)
|
|
@@ -83,6 +83,22 @@ page for many more examples, and the
|
|
|
83
83
|
[CLI Reference](https://textual-debugger.readthedocs.io/reference/cli/)
|
|
84
84
|
for every option.
|
|
85
85
|
|
|
86
|
+
## Function Tracing
|
|
87
|
+
|
|
88
|
+
`tdb --trace` records calls to the functions you name in a Python program and
|
|
89
|
+
every process it starts, with no breakpoints and no TUI, and writes a
|
|
90
|
+
[Perfetto](https://ui.perfetto.dev) trace with one lane per thread and per
|
|
91
|
+
`asyncio` task. `--trace-merge` weaves the traces of several services into one
|
|
92
|
+
timeline, and `--trace-discover` writes a starter spec.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
tdb --trace checkout.yaml --trace-name orders orders_service.py -- --port 8002
|
|
96
|
+
tdb --trace-merge inv.jsonl ord.jsonl --trace-out all # open all.perfetto.json in ui.perfetto.dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [Function Tracing](https://textual-debugger.readthedocs.io/python/tracing/)
|
|
100
|
+
for the spec format, a two-service walkthrough, and the limitations.
|
|
101
|
+
|
|
86
102
|
## Acknowledgments
|
|
87
103
|
|
|
88
104
|
`tdb` is built with Will McGugan's [textual](https://github.com/Textualize/textual)
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"fastapi>=0.115.0",
|
|
29
29
|
"uvicorn>=0.30.0",
|
|
30
30
|
"prompt_toolkit>=3.0.52,<3.1",
|
|
31
|
+
"pyyaml>=6.0",
|
|
31
32
|
]
|
|
32
33
|
|
|
33
34
|
# extras needed to run the examples and tests
|
|
@@ -73,7 +74,10 @@
|
|
|
73
74
|
# docs/ and mkdocs.yml; per-directory globs keep docs/superpowers/ out.
|
|
74
75
|
"mkdocs.yml", "docs/*.md", "docs/languages/*.md", "docs/using/*.md",
|
|
75
76
|
"docs/python/*.md", "docs/automation/*.md", "docs/reference/*.md",
|
|
76
|
-
|
|
77
|
+
# The tracing agent: two stdlib-only files, no __init__.py, loaded by
|
|
78
|
+
# path through PYTHONPATH in the traced program, never imported as tdb.
|
|
79
|
+
"trace/agent/*.py",
|
|
80
|
+
"adapters/perl/helpers.pl", "adapters/perl/padwalker_src/PadWalker.pm", "adapters/perl/padwalker_src/PadWalker.xs", "adapters/perl/padwalker_src/Makefile.PL", "adapters/perl/Devel/TdbRemote.pm", "adapters/perl/Devel/TdbCompile.pm", "adapters/ruby/tdb.rb", "adapters/ruby/ready/tdb_rdbg_ready.rb", "adapters/bash/tdb_harness.sh", "adapters/powershell/tdb_launch.ps1", "adapters/native/tdb.h", "rust_concurrency/probes/gdb_script.py", "rust_concurrency/probes/lldb_script.py",
|
|
77
81
|
# Per-language examples, shown by `tdb --info` ("examples dir").
|
|
78
82
|
# src/tdb/examples is a symlink to the repository's examples/;
|
|
79
83
|
# extension globs keep build outputs (Rust target/, binaries) out.
|
|
@@ -81,6 +85,7 @@
|
|
|
81
85
|
"examples/Go/*.go", "examples/Go/breakpoint_hook_demo/go.mod",
|
|
82
86
|
"examples/Go/breakpoint_hook_demo/*.go", "examples/OCaml/*.ml",
|
|
83
87
|
"examples/Perl/*.pl", "examples/PowerShell/*.ps1", "examples/Python/*.py",
|
|
88
|
+
"examples/Python/trace/*.py", "examples/Python/trace/*.yaml",
|
|
84
89
|
"examples/Ruby/*.rb", "examples/Rust/*.rs",
|
|
85
90
|
"examples/Rust/breakpoint_hook_demo/Cargo.toml",
|
|
86
91
|
"examples/Rust/breakpoint_hook_demo/src/*.rs", "examples/bash/*.sh",
|
|
@@ -111,3 +116,8 @@
|
|
|
111
116
|
]
|
|
112
117
|
show_missing = true
|
|
113
118
|
skip_covered = false
|
|
119
|
+
|
|
120
|
+
[dependency-groups]
|
|
121
|
+
dev = [
|
|
122
|
+
"pytest-xdist>=3.8.0",
|
|
123
|
+
]
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Owned process groups: stop a child tdb started in its own session
|
|
2
|
+
together with everything it started, with every wait bounded.
|
|
3
|
+
|
|
4
|
+
A backend that spawns its debugger with ``start_new_session=True`` owns
|
|
5
|
+
that whole process group. Checking only the leader is not enough: the
|
|
6
|
+
leader (rdbg, pwsh, perl) can exit while the debuggee or a helper it
|
|
7
|
+
started lives on holding our pipes, and asyncio's ``Process.wait()``
|
|
8
|
+
waits for those pipes too. So the group is signalled by its id whether
|
|
9
|
+
or not the leader has exited (ESRCH just means it is already empty),
|
|
10
|
+
and each wait has a deadline before escalating to SIGKILL.
|
|
11
|
+
|
|
12
|
+
Windows has no process groups to signal; there the leader alone is
|
|
13
|
+
terminated and then killed, as before.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import asyncio
|
|
19
|
+
import contextlib
|
|
20
|
+
import logging
|
|
21
|
+
import os
|
|
22
|
+
import signal
|
|
23
|
+
|
|
24
|
+
log = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
_POLL = 0.05
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def signal_group(proc: asyncio.subprocess.Process, sig: int) -> None:
|
|
30
|
+
"""Send `sig` to `proc`'s whole process group (POSIX), or to `proc`
|
|
31
|
+
alone on Windows. Never raises for an already-gone target."""
|
|
32
|
+
if os.name == "nt":
|
|
33
|
+
if proc.returncode is None:
|
|
34
|
+
with contextlib.suppress(ProcessLookupError, OSError):
|
|
35
|
+
if sig == signal.SIGTERM:
|
|
36
|
+
proc.terminate()
|
|
37
|
+
else:
|
|
38
|
+
proc.kill()
|
|
39
|
+
return
|
|
40
|
+
with contextlib.suppress(ProcessLookupError, PermissionError, OSError):
|
|
41
|
+
os.killpg(proc.pid, sig)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _group_alive(pgid: int) -> bool:
|
|
45
|
+
if os.name == "nt":
|
|
46
|
+
return False
|
|
47
|
+
try:
|
|
48
|
+
os.killpg(pgid, 0)
|
|
49
|
+
except ProcessLookupError:
|
|
50
|
+
return False
|
|
51
|
+
except (PermissionError, OSError):
|
|
52
|
+
return True
|
|
53
|
+
return True
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
async def _settle(proc: asyncio.subprocess.Process, timeout: float) -> bool:
|
|
57
|
+
"""Wait up to `timeout` for the leader to be reaped and the group to
|
|
58
|
+
empty. True when both happened."""
|
|
59
|
+
loop = asyncio.get_running_loop()
|
|
60
|
+
deadline = loop.time() + timeout
|
|
61
|
+
with contextlib.suppress(asyncio.TimeoutError):
|
|
62
|
+
await asyncio.wait_for(proc.wait(), max(timeout, 0))
|
|
63
|
+
while _group_alive(proc.pid):
|
|
64
|
+
remaining = deadline - loop.time()
|
|
65
|
+
if remaining <= 0:
|
|
66
|
+
return False
|
|
67
|
+
await asyncio.sleep(min(_POLL, remaining))
|
|
68
|
+
if proc.returncode is None:
|
|
69
|
+
# Group is empty, so only the pipes are left: a bounded last look.
|
|
70
|
+
with contextlib.suppress(asyncio.TimeoutError):
|
|
71
|
+
await asyncio.wait_for(proc.wait(), max(deadline - loop.time(), _POLL))
|
|
72
|
+
return proc.returncode is not None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
async def stop_group(
|
|
76
|
+
proc: asyncio.subprocess.Process, *, grace: float = 2.0, kill_grace: float = 2.0
|
|
77
|
+
) -> None:
|
|
78
|
+
"""SIGTERM `proc`'s group, give it `grace` seconds, then SIGKILL what
|
|
79
|
+
is left and wait at most `kill_grace` more. Never raises, never
|
|
80
|
+
waits longer than ``grace + kill_grace`` (plus polling slack)."""
|
|
81
|
+
if os.name == "nt" and proc.returncode is not None:
|
|
82
|
+
return
|
|
83
|
+
signal_group(proc, signal.SIGTERM)
|
|
84
|
+
if await _settle(proc, grace):
|
|
85
|
+
return
|
|
86
|
+
signal_group(proc, signal.SIGKILL)
|
|
87
|
+
if not await _settle(proc, kill_grace):
|
|
88
|
+
log.warning(
|
|
89
|
+
"process group %s still not gone %.1fs after SIGKILL", proc.pid, kill_grace
|
|
90
|
+
)
|
|
@@ -490,3 +490,20 @@ class BashDapServer:
|
|
|
490
490
|
self.send_error(request, str(e))
|
|
491
491
|
return
|
|
492
492
|
self.send_response(request)
|
|
493
|
+
|
|
494
|
+
# ---- Ctrl-C after detach (tdb-private request) ----
|
|
495
|
+
async def _on_tdbSignal(self, request: Request) -> None:
|
|
496
|
+
# Like tdbStdin, not gated on "stopped": the script is running.
|
|
497
|
+
name = request.arguments.get("signal")
|
|
498
|
+
if name != "SIGINT":
|
|
499
|
+
self.send_error(request, f"unsupported signal: {name!r}")
|
|
500
|
+
return
|
|
501
|
+
if self.session is None:
|
|
502
|
+
self.send_error(request, "no debuggee to signal: no launch yet")
|
|
503
|
+
return
|
|
504
|
+
try:
|
|
505
|
+
self.session.send_sigint()
|
|
506
|
+
except BashProtocolError as e:
|
|
507
|
+
self.send_error(request, str(e))
|
|
508
|
+
return
|
|
509
|
+
self.send_response(request)
|
|
@@ -542,6 +542,28 @@ class BashSession:
|
|
|
542
542
|
self.stopped = False
|
|
543
543
|
self._write_line(mode)
|
|
544
544
|
|
|
545
|
+
def send_sigint(self) -> None:
|
|
546
|
+
"""Deliver SIGINT to the script the way a terminal Ctrl-C would.
|
|
547
|
+
|
|
548
|
+
Launched in-process: the whole process group (bash + children), the
|
|
549
|
+
same addressing stop() uses. --terminal mode: the debuggee is not
|
|
550
|
+
our child and shares the emulator's group, so signal its pid only.
|
|
551
|
+
Raises BashProtocolError when there is nothing to signal.
|
|
552
|
+
"""
|
|
553
|
+
try:
|
|
554
|
+
if self._process is not None:
|
|
555
|
+
if self._process.returncode is not None:
|
|
556
|
+
raise BashProtocolError("the script has already exited")
|
|
557
|
+
os.killpg(self._process.pid, signal.SIGINT)
|
|
558
|
+
elif self.debuggee_pid is not None and self.debuggee_pid > 1:
|
|
559
|
+
# Never 0 / 1: os.kill(0|1, ...) would hit tdb's own group
|
|
560
|
+
# or init.
|
|
561
|
+
os.kill(self.debuggee_pid, signal.SIGINT)
|
|
562
|
+
else:
|
|
563
|
+
raise BashProtocolError("no debuggee to signal")
|
|
564
|
+
except (ProcessLookupError, PermissionError) as e:
|
|
565
|
+
raise BashProtocolError(f"cannot signal the script: {e}") from e
|
|
566
|
+
|
|
545
567
|
async def stop(self) -> None:
|
|
546
568
|
for t in self._tasks:
|
|
547
569
|
t.cancel()
|
|
@@ -19,14 +19,18 @@ Resolution order at launch (`ensure_padwalker`):
|
|
|
19
19
|
with our .pm could pair a 2.5 .pm with an older .so and fail the
|
|
20
20
|
XS version check, so we never override one that works.
|
|
21
21
|
2. A cached build for this perl exists and loads -> use it.
|
|
22
|
-
3.
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
3. ExtUtils::MakeMaker is missing (minimal distro perls ship without
|
|
23
|
+
it, and `perl Makefile.PL` needs it) -> don't attempt a build;
|
|
24
|
+
report it, with a short `toast` for the TUI.
|
|
25
|
+
4. Build from the vendored sources (needs perl's CORE headers and a C
|
|
26
|
+
compiler) -> cache, use it.
|
|
27
|
+
5. Otherwise report why, and the adapter degrades to its core-B pad
|
|
25
28
|
walk exactly as it did before PadWalker was bundled.
|
|
26
29
|
|
|
27
30
|
The cache root honours TDB_PADWALKER_CACHE (tests point it at a temp
|
|
28
31
|
dir so real builds never touch ~/.config/tdb) and tolerates a read-only
|
|
29
|
-
config dir by falling back to
|
|
32
|
+
config dir by falling back to a private (0700, owner-checked) directory in
|
|
33
|
+
the system temp dir.
|
|
30
34
|
"""
|
|
31
35
|
|
|
32
36
|
from __future__ import annotations
|
|
@@ -35,6 +39,7 @@ import importlib.resources
|
|
|
35
39
|
import logging
|
|
36
40
|
import os
|
|
37
41
|
import shutil
|
|
42
|
+
import stat
|
|
38
43
|
import subprocess
|
|
39
44
|
import tempfile
|
|
40
45
|
from dataclasses import dataclass
|
|
@@ -67,11 +72,13 @@ class PadWalkerResult:
|
|
|
67
72
|
needed (native install) or nothing is available (failure).
|
|
68
73
|
source: "native" | "cached" | "built" | "unavailable".
|
|
69
74
|
message: one user-facing line worth showing once, or None.
|
|
75
|
+
toast: a short notice to raise prominently (a TUI toast), or None.
|
|
70
76
|
"""
|
|
71
77
|
|
|
72
78
|
lib_dir: str | None
|
|
73
79
|
source: str
|
|
74
80
|
message: str | None = None
|
|
81
|
+
toast: str | None = None
|
|
75
82
|
|
|
76
83
|
|
|
77
84
|
def padwalker_dir() -> str:
|
|
@@ -99,9 +106,9 @@ def cache_root() -> Path:
|
|
|
99
106
|
override = os.environ.get("TDB_PADWALKER_CACHE")
|
|
100
107
|
if override:
|
|
101
108
|
return Path(override)
|
|
102
|
-
from tdb.persist import
|
|
109
|
+
from tdb.persist import config_dir
|
|
103
110
|
|
|
104
|
-
return
|
|
111
|
+
return config_dir() / "padwalker"
|
|
105
112
|
|
|
106
113
|
|
|
107
114
|
def _run(
|
|
@@ -154,6 +161,45 @@ def _cache_candidates() -> list[Path]:
|
|
|
154
161
|
return [primary] if primary == fallback else [primary, fallback]
|
|
155
162
|
|
|
156
163
|
|
|
164
|
+
def _is_private_dir(path: Path) -> bool:
|
|
165
|
+
"""True when `path` is a real directory (not a symlink) owned by us
|
|
166
|
+
that nobody else can write to.
|
|
167
|
+
|
|
168
|
+
The temp-dir fallback lives in a directory every local user can
|
|
169
|
+
create entries in, under a predictable name. Anything found there
|
|
170
|
+
is loaded into perl (`-MPadWalker`), so a directory another user
|
|
171
|
+
planted would run their code as us. Windows' temp dir is per-user.
|
|
172
|
+
"""
|
|
173
|
+
if os.name == "nt":
|
|
174
|
+
return True
|
|
175
|
+
try:
|
|
176
|
+
st = os.lstat(path)
|
|
177
|
+
except OSError:
|
|
178
|
+
return False
|
|
179
|
+
return (
|
|
180
|
+
stat.S_ISDIR(st.st_mode)
|
|
181
|
+
and st.st_uid == os.geteuid()
|
|
182
|
+
and not st.st_mode & 0o022
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _trusted(root: Path, primary: Path) -> bool:
|
|
187
|
+
"""The configured cache root is the user's own choice; the shared
|
|
188
|
+
temp-dir fallback must prove it is private. Entries inside a private
|
|
189
|
+
root can only have been made by us, so they need no check of their own."""
|
|
190
|
+
return root == primary or _is_private_dir(root)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _cached_dirs(name: str) -> list[Path]:
|
|
194
|
+
"""Existing cache entries for `name` that are safe to load from."""
|
|
195
|
+
primary = cache_root()
|
|
196
|
+
return [
|
|
197
|
+
root / name
|
|
198
|
+
for root in _cache_candidates()
|
|
199
|
+
if _trusted(root, primary) and (root / name).is_dir()
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
|
|
157
203
|
def _build(perl: str, env: dict, make: str, dlext: str, dest: Path) -> str | None:
|
|
158
204
|
"""Compile the vendored sources with `perl`; install the two artefacts
|
|
159
205
|
into `dest`. Returns None on success, else a short reason."""
|
|
@@ -200,6 +246,11 @@ def _build(perl: str, env: dict, make: str, dlext: str, dest: Path) -> str | Non
|
|
|
200
246
|
return None
|
|
201
247
|
|
|
202
248
|
|
|
249
|
+
NO_MAKEMAKER_TOAST = (
|
|
250
|
+
"Neither PadWalker nor ExtUtils::MakeMaker are installed. "
|
|
251
|
+
"Perl debugging will be degraded."
|
|
252
|
+
)
|
|
253
|
+
|
|
203
254
|
_INSTALL_HINT = (
|
|
204
255
|
"Lexicals in outer frames will be limited. Either install PadWalker "
|
|
205
256
|
"(`cpanm PadWalker`, or a distro package such as libpadwalker-perl / "
|
|
@@ -255,18 +306,35 @@ def _resolve(perl: str, env: dict) -> PadWalkerResult:
|
|
|
255
306
|
)
|
|
256
307
|
version, archname, make, dlext = cfg
|
|
257
308
|
name = cache_key(version, archname)
|
|
258
|
-
for
|
|
259
|
-
|
|
260
|
-
if cached.is_dir() and _loads(perl, with_perl5lib(env, str(cached))):
|
|
309
|
+
for cached in _cached_dirs(name):
|
|
310
|
+
if _loads(perl, with_perl5lib(env, str(cached))):
|
|
261
311
|
return PadWalkerResult(str(cached), "cached")
|
|
312
|
+
if makemaker_version(perl, env) is None:
|
|
313
|
+
return PadWalkerResult(
|
|
314
|
+
None,
|
|
315
|
+
"unavailable",
|
|
316
|
+
f"tdb: PadWalker unavailable for perl {version} ({archname}): "
|
|
317
|
+
+ _MAKEMAKER_HINT,
|
|
318
|
+
NO_MAKEMAKER_TOAST,
|
|
319
|
+
)
|
|
262
320
|
reasons: list[str] = []
|
|
321
|
+
primary = cache_root()
|
|
263
322
|
for root in _cache_candidates():
|
|
264
323
|
dest = root / name
|
|
265
324
|
try:
|
|
266
|
-
root
|
|
325
|
+
if root == primary:
|
|
326
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
327
|
+
else:
|
|
328
|
+
root.mkdir(mode=0o700, exist_ok=True)
|
|
267
329
|
except OSError as e:
|
|
268
330
|
reasons.append(f"cannot create {root} ({e})")
|
|
269
331
|
continue
|
|
332
|
+
if not _trusted(root, primary):
|
|
333
|
+
reasons.append(
|
|
334
|
+
f"cache dir {root} is not private (owned by another user, "
|
|
335
|
+
"a symlink, or writable by others); not using it"
|
|
336
|
+
)
|
|
337
|
+
continue
|
|
270
338
|
reason = _build(perl, env, make, dlext, dest)
|
|
271
339
|
if reason is None:
|
|
272
340
|
if _loads(perl, with_perl5lib(env, str(dest))):
|
|
@@ -318,8 +386,7 @@ def is_loadable(perl: str, env: dict | None = None) -> bool:
|
|
|
318
386
|
return False
|
|
319
387
|
name = cache_key(cfg[0], cfg[1])
|
|
320
388
|
return any(
|
|
321
|
-
|
|
322
|
-
for root in _cache_candidates()
|
|
389
|
+
_loads(perl, with_perl5lib(env, str(entry))) for entry in _cached_dirs(name)
|
|
323
390
|
)
|
|
324
391
|
|
|
325
392
|
|
|
@@ -335,9 +402,8 @@ def padwalker_status(perl: str = "perl") -> str:
|
|
|
335
402
|
return f"{perl} does not run"
|
|
336
403
|
version, archname, _make, _dlext = cfg
|
|
337
404
|
name = cache_key(version, archname)
|
|
338
|
-
for
|
|
339
|
-
|
|
340
|
-
if cached.is_dir() and _loads(perl, with_perl5lib(env, str(cached))):
|
|
405
|
+
for cached in _cached_dirs(name):
|
|
406
|
+
if _loads(perl, with_perl5lib(env, str(cached))):
|
|
341
407
|
return f"built for perl {version} ({archname}), cached in {cached}"
|
|
342
408
|
return (
|
|
343
409
|
f"not yet built for perl {version} ({archname}); tdb will try to "
|
|
@@ -16,6 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
import asyncio
|
|
17
17
|
import logging
|
|
18
18
|
import os
|
|
19
|
+
import time
|
|
19
20
|
from typing import Any, Awaitable, Callable
|
|
20
21
|
|
|
21
22
|
from tdb.dap.messages import Event, Request, Response, parse_message
|
|
@@ -56,6 +57,8 @@ class PerlDapServer:
|
|
|
56
57
|
self._stop_on_entry = True
|
|
57
58
|
self._classifying = False
|
|
58
59
|
self._pause_pending = False
|
|
60
|
+
# monotonic time of the last tdbSignal whose stop is not yet resolved
|
|
61
|
+
self._sigint_pending: float | None = None
|
|
59
62
|
# (file, line) the debuggee was stopped at when the user issued
|
|
60
63
|
# the last step command (n/s/r) -- None after a continue or once
|
|
61
64
|
# consumed. Lets _classify_and_emit_stop coalesce the several
|
|
@@ -768,6 +771,10 @@ class PerlDapServer:
|
|
|
768
771
|
try:
|
|
769
772
|
if self.session is None:
|
|
770
773
|
return
|
|
774
|
+
if self._sigint_pending:
|
|
775
|
+
await self._deliver_pending_sigint()
|
|
776
|
+
if self.session is None or self.session.eof:
|
|
777
|
+
return
|
|
771
778
|
loc = await self._location_after_settling()
|
|
772
779
|
loc = await self._coalesce_compile_phase_step(loc)
|
|
773
780
|
if loc is None or loc.get("file") == "?":
|
|
@@ -1237,6 +1244,49 @@ class PerlDapServer:
|
|
|
1237
1244
|
return
|
|
1238
1245
|
self.send_response(request)
|
|
1239
1246
|
|
|
1247
|
+
async def _on_tdbSignal(self, request: Request) -> None:
|
|
1248
|
+
"""tdb-private request: deliver Ctrl-C to the running program after
|
|
1249
|
+
tdb detached. Not gated on "stopped" -- the program is running."""
|
|
1250
|
+
name = request.arguments.get("signal")
|
|
1251
|
+
if name != "SIGINT":
|
|
1252
|
+
self.send_error(request, f"unsupported signal: {name!r}")
|
|
1253
|
+
return
|
|
1254
|
+
if self.session is None:
|
|
1255
|
+
self.send_error(request, "no debuggee to signal: no launch yet")
|
|
1256
|
+
return
|
|
1257
|
+
try:
|
|
1258
|
+
self.session.send_sigint()
|
|
1259
|
+
except PerlProtocolError as e:
|
|
1260
|
+
self.send_error(request, str(e))
|
|
1261
|
+
return
|
|
1262
|
+
# perl5db's $SIG{INT} (DB::catch) will turn this into a stop at the
|
|
1263
|
+
# next statement; _classify_and_emit_stop then re-raises it.
|
|
1264
|
+
self._sigint_pending = time.monotonic()
|
|
1265
|
+
self.send_response(request)
|
|
1266
|
+
|
|
1267
|
+
async def _deliver_pending_sigint(self) -> None:
|
|
1268
|
+
"""Called at a stop that follows tdbSignal. If perl5db still owns
|
|
1269
|
+
$SIG{INT} the program has not seen the interrupt: put back the
|
|
1270
|
+
default disposition and re-raise it, so the program dies of SIGINT
|
|
1271
|
+
as it would natively. (A program with its own handler never gets
|
|
1272
|
+
here: its handler replaced DB::catch and ran directly.)"""
|
|
1273
|
+
started, self._sigint_pending = self._sigint_pending, None
|
|
1274
|
+
# A stale request (the program ran its own handler, no stop
|
|
1275
|
+
# followed) must not turn a later, unrelated stop into a kill.
|
|
1276
|
+
if started is None or time.monotonic() - started > 5.0:
|
|
1277
|
+
return
|
|
1278
|
+
session = self.session
|
|
1279
|
+
if session is None or session.eof:
|
|
1280
|
+
return
|
|
1281
|
+
try:
|
|
1282
|
+
await session.command(
|
|
1283
|
+
";{ my $h = $SIG{INT}; "
|
|
1284
|
+
"if (ref $h eq 'CODE' && $h == \\&DB::catch) "
|
|
1285
|
+
"{ $SIG{INT} = 'DEFAULT'; kill 'INT', $$; } }"
|
|
1286
|
+
)
|
|
1287
|
+
except PerlProtocolError:
|
|
1288
|
+
pass # the connection closed: the program died, EOF reports it
|
|
1289
|
+
|
|
1240
1290
|
async def _on_evaluate(self, request: Request) -> None:
|
|
1241
1291
|
reason = self._not_ready()
|
|
1242
1292
|
if reason is not None:
|
|
@@ -21,6 +21,7 @@ from typing import Awaitable, Callable
|
|
|
21
21
|
|
|
22
22
|
from tdb.adapters.perl.protocol import StreamParser
|
|
23
23
|
from tdb.adapters.perl import padwalker as _padwalker
|
|
24
|
+
from tdb.dap.messages import TOAST_CATEGORY
|
|
24
25
|
|
|
25
26
|
log = logging.getLogger(__name__)
|
|
26
27
|
|
|
@@ -171,6 +172,10 @@ class PerlSession:
|
|
|
171
172
|
child_env = with_perl5lib(child_env, pw.lib_dir)
|
|
172
173
|
if pw.message:
|
|
173
174
|
self._on_output(pw.message + "\n", "console")
|
|
175
|
+
if pw.toast:
|
|
176
|
+
# tdb's own output category: the TUI raises it as a toast
|
|
177
|
+
# (the detail line above already went to the Console View).
|
|
178
|
+
self._on_output(pw.toast + "\n", TOAST_CATEGORY)
|
|
174
179
|
child_env["PERLDB_OPTS"] = f"RemotePort=127.0.0.1:{port}"
|
|
175
180
|
# Devel::TdbCompile (this adapter's own compile-phase shim --
|
|
176
181
|
# see that module's header) arms perl5db to trap during
|
|
@@ -483,10 +488,20 @@ class PerlSession:
|
|
|
483
488
|
assert self._writer is not None
|
|
484
489
|
await self._writer.drain()
|
|
485
490
|
|
|
491
|
+
def _terminal_debuggee_pid(self) -> int | None:
|
|
492
|
+
"""The external-terminal debuggee's pid while it is provably still
|
|
493
|
+
ours, else None. The pid came from perl5db's own `p $$`; the
|
|
494
|
+
debuggee holds the perl5db socket until it exits, so before EOF
|
|
495
|
+
the pid cannot have been reused by an unrelated process."""
|
|
496
|
+
if self._process is not None or self.debuggee_pid is None or self._eof:
|
|
497
|
+
return None
|
|
498
|
+
return self.debuggee_pid
|
|
499
|
+
|
|
486
500
|
def interrupt(self) -> bool:
|
|
487
501
|
"""Ask the running debuggee to stop: SIGINT the owned child (launch
|
|
488
|
-
mode)
|
|
489
|
-
|
|
502
|
+
mode), write a pause byte on the control channel (attach mode),
|
|
503
|
+
or SIGINT the external-terminal debuggee by its pid. False if
|
|
504
|
+
none is available."""
|
|
490
505
|
if self._process is not None:
|
|
491
506
|
try:
|
|
492
507
|
os.kill(self._process.pid, signal.SIGINT)
|
|
@@ -496,9 +511,45 @@ class PerlSession:
|
|
|
496
511
|
if self._control_writer is not None:
|
|
497
512
|
self._control_writer.write(b"p")
|
|
498
513
|
return True
|
|
514
|
+
pid = self._terminal_debuggee_pid()
|
|
515
|
+
if pid is not None:
|
|
516
|
+
try:
|
|
517
|
+
os.kill(pid, signal.SIGINT)
|
|
518
|
+
return True
|
|
519
|
+
except (ProcessLookupError, PermissionError):
|
|
520
|
+
return False
|
|
499
521
|
return False
|
|
500
522
|
|
|
523
|
+
def send_sigint(self) -> None:
|
|
524
|
+
"""Deliver SIGINT to the program the way a terminal Ctrl-C would
|
|
525
|
+
(tdbSignal, after tdb detached). Launch mode: the whole process
|
|
526
|
+
group (spawned with start_new_session). --terminal mode: the
|
|
527
|
+
debuggee's pid only (it shares the emulator's group). Raises
|
|
528
|
+
PerlProtocolError when there is nothing to signal.
|
|
529
|
+
|
|
530
|
+
perl5db's own $SIG{INT} (DB::catch) turns the signal into a
|
|
531
|
+
debugger stop; the server resolves that stop (see
|
|
532
|
+
PerlDapServer._deliver_pending_sigint)."""
|
|
533
|
+
if os.name == "nt":
|
|
534
|
+
raise PerlProtocolError("SIGINT delivery is not supported on Windows")
|
|
535
|
+
try:
|
|
536
|
+
if self._process is not None:
|
|
537
|
+
if self._process.returncode is not None:
|
|
538
|
+
raise PerlProtocolError("the program has already exited")
|
|
539
|
+
os.killpg(self._process.pid, signal.SIGINT)
|
|
540
|
+
elif self.debuggee_pid is not None and self.debuggee_pid > 1:
|
|
541
|
+
if self._terminal_debuggee_pid() is None:
|
|
542
|
+
raise PerlProtocolError("the program has already exited")
|
|
543
|
+
os.kill(self.debuggee_pid, signal.SIGINT)
|
|
544
|
+
else:
|
|
545
|
+
raise PerlProtocolError("no debuggee to signal")
|
|
546
|
+
except (ProcessLookupError, PermissionError) as e:
|
|
547
|
+
raise PerlProtocolError(f"cannot signal the program: {e}") from e
|
|
548
|
+
|
|
501
549
|
async def stop(self) -> None:
|
|
550
|
+
# Before the reader is cancelled: whether the debuggee had
|
|
551
|
+
# already gone (EOF) decides if its pid may still be signalled.
|
|
552
|
+
terminal_pid = self._terminal_debuggee_pid()
|
|
502
553
|
tasks = [t for t in [self._reader_task, *self._pump_tasks] if t is not None]
|
|
503
554
|
for t in tasks:
|
|
504
555
|
t.cancel()
|
|
@@ -515,15 +566,17 @@ class PerlSession:
|
|
|
515
566
|
# "Event loop is closed" unraisable warning at teardown.
|
|
516
567
|
if self._process.stdin is not None and not self._process.stdin.is_closing():
|
|
517
568
|
self._process.stdin.close()
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
569
|
+
# The whole group (spawned with start_new_session): a process
|
|
570
|
+
# the program started can hold our pipes, and wait() would
|
|
571
|
+
# block on them forever. No grace: perl5db is no longer
|
|
572
|
+
# listening, so SIGTERM buys nothing.
|
|
573
|
+
from tdb._proc import stop_group
|
|
574
|
+
|
|
575
|
+
await stop_group(self._process, grace=0, kill_grace=2.0)
|
|
576
|
+
if terminal_pid is not None:
|
|
524
577
|
for sig in (signal.SIGTERM, signal.SIGKILL):
|
|
525
578
|
try:
|
|
526
|
-
os.kill(
|
|
579
|
+
os.kill(terminal_pid, sig)
|
|
527
580
|
except (ProcessLookupError, PermissionError):
|
|
528
581
|
break
|
|
529
582
|
await asyncio.sleep(0.05)
|
|
@@ -773,28 +773,16 @@ class PowerShellDapServer:
|
|
|
773
773
|
return "".join(early)[-2000:].strip()
|
|
774
774
|
|
|
775
775
|
# ---- teardown ----
|
|
776
|
-
def _kill_group(self, sig_kill: bool = False) -> None:
|
|
777
|
-
proc = self._proc
|
|
778
|
-
if proc is None or proc.returncode is not None:
|
|
779
|
-
return
|
|
780
|
-
try:
|
|
781
|
-
if os.name == "nt":
|
|
782
|
-
proc.kill() if sig_kill else proc.terminate()
|
|
783
|
-
else:
|
|
784
|
-
os.killpg(proc.pid, signal.SIGKILL if sig_kill else signal.SIGTERM)
|
|
785
|
-
except (ProcessLookupError, OSError):
|
|
786
|
-
pass
|
|
787
|
-
|
|
788
776
|
async def _ensure_pwsh_dead(self, grace: float = 2.0) -> None:
|
|
777
|
+
"""Stop pwsh's whole process group -- even when pwsh itself has
|
|
778
|
+
already exited, since the script's own children can outlive it --
|
|
779
|
+
with every wait bounded (see tdb._proc)."""
|
|
780
|
+
from tdb._proc import stop_group
|
|
781
|
+
|
|
789
782
|
proc = self._proc
|
|
790
|
-
if proc is None
|
|
783
|
+
if proc is None:
|
|
791
784
|
return
|
|
792
|
-
|
|
793
|
-
try:
|
|
794
|
-
await asyncio.wait_for(proc.wait(), grace)
|
|
795
|
-
except asyncio.TimeoutError:
|
|
796
|
-
self._kill_group(sig_kill=True)
|
|
797
|
-
await proc.wait()
|
|
785
|
+
await stop_group(proc, grace=grace)
|
|
798
786
|
|
|
799
787
|
async def _await_watch_exit(self, timeout: float = 4.0) -> None:
|
|
800
788
|
task = self._watch_exit_task
|