Skip to content

Debugger breakpoint improvements and integration tests - #1844

Merged
housel merged 19 commits into
dylan-lang:masterfrom
housel:breakpoint-breakthroughs-202609
Oct 22, 2026
Merged

housel merged 19 commits into
dylan-lang:masterfrom
housel:breakpoint-breakthroughs-202609

Conversation

@housel

@housel housel commented Oct 21, 2026

Copy link
Copy Markdown
Member

These changes add basic integration tests for the various kinds of breakpoints supported by the Dylan environment and fix various issues to make them more reliable.

@housel
housel force-pushed the breakpoint-breakthroughs-202609 branch from f8f903a to 86e2b10 Compare October 21, 2026 05:25
housel added 19 commits October 21, 2026 20:41
Previously retrieving the application-stop-reason-message during a
trace breakpoint stop would cause the trace depth to be incremennted
or decremented each time the message was requested.

* sources/environment/dfmc/application/app-server.dylan
  (<dfmc-application>): Add application-stop-reason-message as a
   sealed slot.

* sources/environment/dfmc/application/stop-reason-handlers.dylan
  (note-application-thread-message): Store the computed stop reason
   message.
  (application-stop-reason-message): Remove method.
  (finish-debugging-transaction): Clear
   application-stop-reason-message.
* sources/runtime-manager/debugger-manager/debug-target.dylan
  (<debug-target>): Remove commented-out slot definition for an MPS entry
   point cache.

* sources/runtime-manager/debugger-manager/transaction.dylan: Remove
  commented-out support for special handling of calls through the
  Memory Pool System APIs.
* sources/runtime-manager/access-path/stop-reasons.dylan
  ($timeout-handled-stop-reason, $timeout-unhandled-stop-reason,
   $profiler-stop-reason, $profiler-unhandled-stop-reason): New
   constants.
  (construct-stop-reason): Return appropriate preconstructed stop
   reasons rather than making new ones.
* sources/io/print.dylan
  (print-object on <C-pointer>): extract and print the pointer address
   when printing <C-pointer> objects.

* sources/io/library.dylan
  (module print-internals): Reference the dylan-c-ffi module.
The format-out function used for message output in devel-dbg-ui uses
output buffering, which means that the buffers need to be flushed
before interactive prompts.

* sources/runtime-manager/devel-dbg-ui/command-reader.dylan
  (read-console-commands): Flush the prompt output before reading
   commands.

* sources/runtime-manager/devel-dbg-ui/debugger-message.dylan
  (debugger-message): Flush message output after each message.

* sources/runtime-manager/devel-dbg-ui/new-execute.dylan
  (execute-debugger-command): Flush the Y/N prompt output before
   reading the response.
* sources/runtime-manager/debugger-manager/initialization-tracking.dylan
  (<initialization-state>): Remove.
  (<library-initialization-tracker>): Remove
   tracker-initialization-state slot.
  (<foreign-library-initialization-tracker>): Remove
   tracker-initialization-state slot override.
  (<dylan-library-initialization-tracker>): Remove
   tracker-initialization-state slot override.
  (dynamic-initializer-start-callback,
   dynamic-initializer-done-callback): Remove assignments to
   tracker-initialization-state.

* sources/runtime-manager/debugger-manager/stop-reason-interpret.dylan
  (interpret-stop-reason): Remove assignment to
   tracker-initialization-state.
* sources/runtime-manager/debugger-nub/x86-win32/misc_utils.c
  (invalidate_library_descriptor): New utility function for marking
   DBGLIBRARY entries as not Valid on unload.
  (lowest_base_address): Remove (unused).
  (housekeep_for_stop_reason): Invalidate the corresponding library
   entry on UNLOAD_DLL_DEBUG_EVENT.

* sources/runtime-manager/debugger-nub/x86-win32/app_control.c
  (continue_application): Clean out invalidated library entries when
   application execution resumes.

* sources/runtime-manager/debugger-nub/x86-win32/coff_map.h
  (release_library_coff_map): Add declaration.

* sources/runtime-manager/debugger-nub/x86-win32/debug_map.c
  (release_library_coff_map): Remove extern declaration.
* sources/runtime-manager/access-path/stop-reasons.dylan
  (construct-stop-reason): Clear the access-path threads and libraries
   vectors on $exit-process. Assert the invariant that at
   $create-process time there is exactly one thread and one
   library. Use local variables for the stop reason library objects.

* sources/runtime-manager/access-path/remote-objects.dylan
  (construct-thread-object): Improve readability using the position
   function.
  (find-or-make-library): Improve readability using the position
   function.
When shared libraries/DLLs are loaded the debugger-manager needs to
set up various kinds of initialization tracking. Windows, in
particular, sometimes unloads and reloads DLLs during an executable's
initial loading phase, so it is less error-prone to defer this setup
until the loading phase is complete.

* sources/runtime-manager/debugger-manager/debug-target.dylan
  (<debug-target>): Add an application-loading? slot.

* sources/runtime-manager/debugger-manager/stop-reason-interpret.dylan
  (interpret-stop-reason): For the <create-process-stop-reason>
   case, set the application-loading? flag and defer the executable
   initialization. For the <system-initialized-stop-reason> case,
   clear the flag and perform deferred library registrations. For the
   <load-library-stop-reason> and <unload-library-stop-reason> cases,
   perform the registration/deregistration if it is no longer being
   deferred.

* sources/runtime-manager/debugger-manager/initialization-tracking.dylan
  (register-library, deregister-library): New functions extracted from
   interpret-stop-reason.

FIXFIX runtime-manager: Defer library initialization tracking while loading
* sources/runtime-manager/access-path/remote-objects.dylan
  (print-object on <remote-thread>): Improve formatting and remove
   useless fields.
  (print-object on <remote-library>): New method printing libraries
   as image name and base address.

* sources/runtime-manager/access-path/stop-reasons.dylan
  (print-object on <basic-stop-reason>): New method printing the
   stop reason object class and thread.
  (<debug-point-stop-reason>): New method printing the debug point
   address as well as the stop reason object class and thread.

* sources/runtime-manager/access-path/module.dylan
  (module access-path-implementation): Import debug-name for use in
   print-object.
The <system-initialized-stop-reason> stop occurs when the system's
loading and unloading of shared libraries is complete and the program
being debugged is ready to start its own initialization. On Windows
this is indicated by a the first instance of a hard-coded breakpoint
exception. Previously the access-path code used a
first-debugger-invocation? access connection method to determine
whether to instantiate <system-initialized-stop-reason> or a regular
<system-invoke-debugger-stop-reason>; this change gives
$system-initialized-exception its own separate stop-reason identifier
and moves its identification down into the nub level.

* sources/runtime-manager/access-path/stop-reasons.dylan
  ($system-initialized-exception): Assign as a new stop-reason
   identifier.
  (first-debugger-invocation?): Remove generic.
  (construct-stop-reason): Add a separate
   <system-invoke-debugger-stop-reason> case.

* sources/runtime-manager/access-path/module.dylan
  (module access-path-nub): Remove expoort of first-debugger-invocation?.

* sources/runtime-manager/local-access-path/stop-reasons.dylan
  (first-debugger-invocation? on <local-access-connection>): Remove.

* sources/runtime-manager/local-access-path/nub-ffi-defs.dylan
  (nub-first-hard-coded-breakpoint): Remove.

* sources/runtime-manager/debugger-nub/x86-win32/nub-core.h
  (MAX_EVENT_TYPES): Update constant.
  (SYSTEM_INITIALIZED_DBG_EVENT): New constant.
  (FILTER_HANDLED_DBG_EVENT, FILTER_UNHANDLED_DBG_EVENT,
   SPY_RETURN_DBG_EVENT): Renumber.

* sources/runtime-manager/debugger-nub/x86-win32/stop_reasons.c
  (initialize_process_exception_information): Add table initialization
   for the SYSTEM_INITIALIZED_DBG_EVENT stop reason.
  (nub_first_hard_coded_breakpoint): Remove.
  (process_this_first_chance_breakpoint): Identify the first
   hard-coded breakpoint invocation as a SYSTEM_INITIALIZED_DBG_EVENT
   stop.

* sources/runtime-manager/debugger-nub/remote-nub.idl
  (RemoteNub::first_hard_coded_breakpoint): Remove method.

* sources/runtime-manager/debugger-nub/server/remote-nub-defs.dylan
  (Rtmgr/RemoteNub/first-hard-coded-breakpoint): Remove method.

* sources/runtime-manager/debugger-nub/server/remote-nub-ffi-defs.dylan
  (nub-first-hard-coded-breakpoint): Remove.

* sources/runtime-manager/remote-access-path/stop-reasons.dylan
  (first-debugger-invocation? on <remote-access-connection>): Remove
   method.
* sources/environment/tests/dfmc/debugging.dylan
  (*finished?*): New module variable.
  (note-application-finished-execution): New callback function.
  (initialize-application-client): Register
   finished-execution-callback.
  (ensure-application-at-start): Turn off share-console? and enable
   pause-before-termination?. Clear *finished?*.
  (test generic-function-inout-breakpoint-test): New test validating
   that a requested generic function is created and that execution
   stops in each of the generic function's methods.
  (suite dfmc-environment-debugging-suite): Reference new test.

* sources/environment/tests/dfmc/library.dylan
  (library dfmc-environment-test-suite): Import from the collections
   library.

  (module dfmc-environment-test-suite)
* sources/environment/tests/dfmc/module.dylan: Import the set module.

FIXFIX runtime-manager: Add a generic functions breakpoint test
* sources/environment/protocols/project-objects.dylan
  (find-environment-object on <project-object> and <id>): Change from
   specializing on <definition-id>, since <method-id> is not a subtype
   of <definition-id>.
* sources/environment/tests/dfmc/debugging.dylan
  (test method-inout-breakpoint-test): New test for verifying that
   breakpoints set on <method-object> instances behave as expected.
  (suite dfmc-environment-debugging-suite): Add test
   method-inout-breakpoint-test to the suite.
* sources/environment/tests/dfmc/debugging.dylan
  ($class-breakpoint-pattern): New regex constant for matching
   environment class breakpoint messages.
  (test class-breakpoint-test): New test for verifying that
   breakpoints set on <class-object> instances behave as expected.
  (suite dfmc-environment-debugging-suite): Add test
   class-breakpoint-test to the suite.
* sources/environment/tests/dfmc/debugging.dylan
  (test source-location-breakpoint-test): New test validating that the
   environment can set a breakpoint at a given source location and
   stop there.
   (suite dfmc-environment-debugging-suite): Add the
    source-location-breakpoint-test test.
* sources/runtime-manager/access-path/stop-reasons.dylan
  (wait-for-stop-reason): Assert that the access path is in a valid
   target application state before waiting for a new event.
* sources/runtime-manager/debugger-manager/initialization-tracking.dylan
  (initialize on <dylan-library-initialization-tracker>): Assert that
   the loading phase is not active. Log when the dynamic
   initialization tracker is instantiated.
  (dynamic-initializer-start-callback): Log when the dynamic
   initialization tracker executes.
  (register-dylan-library): Assert that the dylan library is only
   initialized once.
  (register-dylan-runtime-library): Assert that the dylan runtime is
   only initialized once.
* sources/environment/dfmc/application/control-protocols.dylan
  (run-application local method wrapped-library-init-handler): Make
   the debug message more explicit.

* sources/environment/dfmc/application/thread-objects.dylan
  (initialize-interactive-threads): Assert that the interactive
   threads can only be spawned once.
@housel
housel force-pushed the breakpoint-breakthroughs-202609 branch from 86e2b10 to a823611 Compare October 22, 2026 03:43
@housel
housel merged commit 6236608 into dylan-lang:master Oct 22, 2026
3 checks passed
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.

1 participant