Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sources/environment/dfmc/application/control-protocols.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ define method run-application
else
dll-project? & dll-wrap? & phase == #"end"
end;
debugger-message("Preparing %=: top? %=, dll? %=, dll-wrap? %=, phase %=",
prepare-for-interaction?, top-level?, dll-project?, dll-wrap?, phase);
debug-target-message(target, $debug-level,
"Preparing %=: top? %=, dll? %=, dll-wrap? %=, phase %=",
prepare-for-interaction?, top-level?,
dll-project?, dll-wrap?, phase);
if (prepare-for-interaction?)
initialize-interactive-threads(application, thread);
maybe-initialize-allocation-profiling(application)
Expand Down
2 changes: 2 additions & 0 deletions sources/environment/dfmc/application/library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ define library dfmc-environment-application
use collections;
use io;
use channels;
use logging;

use environment-protocols;
use dfmc-environment-database;
Expand Down Expand Up @@ -45,6 +46,7 @@ define module dfmc-application
project-compilation-mode, project-compilation-mode-setter };

use channels;
use logging;
use environment-protocols,
// Prevent name clashes with projects:projects, imported above
// via project-manager-interface. (Many of these are renamed but
Expand Down
33 changes: 18 additions & 15 deletions sources/environment/dfmc/application/profiling.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ define method maybe-initialize-cpu-profiling
& ~profile-state.state-class-profiling?
& application.application-loaded-dylan-library?)
let target = application.application-target-app;
debugger-message("Initializing CPU profiling");
debug-target-message(target, $debug-level, "Initializing CPU profiling");
with-debugger-transaction (target)
start-profiling(target, class-profiling?: #f);
profile-state.state-profile-initialized? := #t
Expand All @@ -100,7 +100,7 @@ define method maybe-initialize-allocation-profiling
& profile-state.state-class-profiling?
& application.application-initialized-interactive-threads?)
let target = application.application-target-app;
debugger-message("Initializing allocation profiling");
debug-target-message(target, $debug-level, "Initializing allocation profiling");
//---*** Temporary hack, this may not always be what we want but
//---*** for now switch on breakpoints on all threads
let interactive-thread = application-open-interactor-thread(application);
Expand Down Expand Up @@ -144,15 +144,16 @@ define sealed method stop-profiling-application
end;
with-debugger-transaction (target)
if (interactive-thread)
debugger-message("Stopping general class breakpoint");
debug-target-message(target, $debug-level, "Stopping general class breakpoint");
let remote-thread = interactive-thread.application-object-proxy;
clear-application-class-breakpoint
(application, interactive-thread, #f, stop-profile?: #t);
#f
else
debugger-message("Failed to stop general class breakpoint");
debugger-message(" thread: %=, class profiling?: %=",
interactive-thread, class-profiling?);
debug-target-message(target, $debug-level,
"Failed to stop general class breakpoint: "
" thread: %=, class-profiling?: %=",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: did you mean to have three consecutive spaces?

interactive-thread, class-profiling?);
end;
block ()
unless (class-profiling?)
Expand Down Expand Up @@ -260,10 +261,10 @@ define sealed method process-thread-snapshot-frame-snapshots
= if (instance?(object, <application-code-object>))
values(object, location)
else
debugger-message("Corrupted profile stack! Found %=",
object
& environment-object-display-name
(project, object, #f));
debug-target-message
(target, $debug-level,
"Corrupted profile stack! Found %=",
object & environment-object-display-name(project, object, #f));
values(#f, #f)
end;
if (object)
Expand Down Expand Up @@ -296,8 +297,9 @@ define sealed method process-profiling-results
let snapshots = profile.application-profile-snapshots;
let raw-threads = data.dm-application-profile-threads;
let raw-snapshots = data.application-snapshots;
debugger-message("Processing profile results: threads=%d, snapshots=%d",
raw-threads.size, raw-snapshots.size);
debug-target-message(target, $debug-level,
"Processing profile results: threads=%d, snapshots=%d",
raw-threads.size, raw-snapshots.size);
do(method (raw-snapshot :: dm-<application-snapshot>)
let raw-snapshots = raw-snapshot.thread-snapshots;
let thread-snapshots
Expand Down Expand Up @@ -345,9 +347,10 @@ define sealed method process-profiling-results
application-total-wall-time(profile) := total-wall-time;
application-total-page-faults(profile) := total-page-faults;
reset-profile-data(target);
debugger-message("Returning, %d snapshots, %d threads",
profile.application-profile-snapshots.size,
profile.application-profile-threads.size);
debug-target-message(target, $debug-level,
"Returning, %d snapshots, %d threads",
profile.application-profile-snapshots.size,
profile.application-profile-threads.size);
profile
else
profile-state.state-last-profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,10 +1070,11 @@ define function handle-library-initialization
application.application-just-finished-execution? := #t;
end;
end;
/*
debugger-message("Stopping? %=: top? %= dll? %=, dll-wrap? %=, phase %=",
stop?, top-level?, dll-project?, dll-wrap?, phase);
*/
let target = application.application-target-app;
debug-target-message(target, $debug-level,
"Stopping? %=: top? %= really-top? dll? %=, dll-wrap? %=, phase %=",
stop?, top-level?, really-top-level?, dll-project?, dll-wrap?,
phase);
stop?
end function handle-library-initialization;

Expand Down
29 changes: 19 additions & 10 deletions sources/environment/dfmc/application/thread-objects.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ end class;
define method process-next-interaction-request
(application :: <dfmc-application>, thread :: <remote-thread>)
=> ()
debugger-message("process-next-interaction-request on %=", thread);
let target = application.application-target-app;
debug-target-message(target, $debug-level,
"process-next-interaction-request on %=", thread);
let path = target.debug-target-access-path;
let state-model = thread-state-model(application, thread);
let requests-pending? =
Expand Down Expand Up @@ -154,7 +155,8 @@ define method request-interaction
context :: <runtime-context>, module :: <module-object>,
code-string :: <byte-string>, state :: <application-state>)
=> (request :: <thread-interaction-request>)
debugger-message("request-interaction on %=", thread);
debug-target-message(application.application-target-app, $debug-level,
"request-interaction on %=", thread);
let request = make(<thread-interaction-request>,
string: code-string, module: module, context: context,
application-state: state);
Expand Down Expand Up @@ -349,7 +351,8 @@ define method suspend-application-thread
unless (thread-available-for-interaction?(target, remote-thread))
error("Cannot suspend a thread that is not ready for interaction");
end;
debugger-message("Suspending environment interactive thread %=", remote-thread);
debug-target-message(target, $debug-level,
"Suspending environment interactive thread %=", remote-thread);
suspend-thread(path, remote-thread);
thread-permanently-suspended?(path, remote-thread) := #t;
end
Expand Down Expand Up @@ -472,8 +475,9 @@ define method request-evaluator-thread
#key name :: <byte-string> = next-evaluator-thread-name(application),
thread :: <remote-thread> = application.dylan-thread-manager)
=> (thread :: <remote-thread>)
debugger-message("request-evaluator-thread %=", name);
let target = application.application-target-app;
debug-target-message(target, $debug-level,
"request-evaluator-thread %=", name);
let success? =
spawn-interactive-thread(target, name, thread: thread);
let stop-reason :: <stop-reason> =
Expand All @@ -493,8 +497,9 @@ end method;
define method install-evaluator-thread
(application :: <dfmc-application>, thread :: <remote-thread>,
name :: <byte-string>) => ()
debugger-message("install-evaluator-thread %= %=", name, thread);
let target = application.application-target-app;
debug-target-message(target, $debug-level,
"install-evaluator-thread %= %=", name, thread);
let path = target.debug-target-access-path;
let state-model = thread-state-model(application, thread);
suspend-thread(path, thread);
Expand Down Expand Up @@ -586,7 +591,8 @@ define method application-open-interactor-thread

if (interactive-threads?)
// If we fall through to here, spawn a new thread
debugger-message("application-open-interactor-thread spawning new thread");
debug-target-message(target, $debug-level,
"application-open-interactor-thread spawning new thread");
create-application-thread(application, "")
else
// If we fall through to here, just use any thread.
Expand All @@ -599,8 +605,9 @@ define method application-open-interactor-thread
end;
end
end;
debugger-message("application-open-interactor-thread chose Thread %=",
thread.application-object-proxy);
debug-target-message(target, $debug-level,
"application-open-interactor-thread chose Thread %=",
thread.application-object-proxy);
thread
end method;

Expand All @@ -618,7 +625,8 @@ define method resume-evaluator-thread
end if;

if (thread-permanently-suspended?(path, thread))
debugger-message("Resuming environment interactive thread %=", thread);
debug-target-message(target, $debug-level,
"Resuming environment interactive thread %=", thread);
thread-permanently-suspended?(path, thread) := #f;
end if;
end method;
Expand All @@ -636,7 +644,8 @@ define method suspend-evaluator-thread
let thread-trans-id = thread-state-transaction(application, thread);

if (thread-trans-id & (thread-trans-id == trans-id))
debugger-message("Suspending environment interactive thread %=", thread);
debug-target-message(target, $debug-level,
"Suspending environment interactive thread %=", thread);
thread-permanently-suspended?(path, thread) := #t;
end if;
end method;
Expand Down
21 changes: 14 additions & 7 deletions sources/environment/target-application/control.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
define method stop-target-application
(application :: <target-application>, #key client-data = #f)
=> ()
thread-debug-message("Stopping target application");
debug-target-message(application, $debug-level,
"Stopping target application");
let stop-reason =
make(<debugger-stop-application-stop-reason>,
client-data: client-data);
Expand All @@ -26,7 +27,8 @@ end method;

define method stop-application-request
(application :: <target-application>) => ()
thread-debug-message("Stopping target application temporarily");
debug-target-message(application, $debug-level,
"Stopping target application temporarily");
let stop-reason :: <stop-reason> =
make(<temporary-internal-debugger-transaction-stop>);
stop-application
Expand Down Expand Up @@ -57,17 +59,21 @@ end function;
define method continue-target-application
(application :: <target-application>, remote-thread)
=> ()
debugger-message("Selected Thread is %=", remote-thread);
debug-target-message(application, $debug-level,
"Selected Thread is %=", remote-thread);
application.application-selected-thread := remote-thread;

if (current-thread() == application.manager-thread)
application-continuation-pending(application);
else
thread-debug-message("Continuing target application");
debug-target-message(application, $debug-level,
"Continuing target application");
with-lock(application.debugger-transaction)
thread-debug-message("Releasing debugger-transaction-notification");
debug-target-message(application, $debug-level,
"Releasing debugger-transaction-notification");
release(application.debugger-transaction-notification);
thread-debug-message("Waiting for debugger-transaction-complete");
debug-target-message(application, $debug-level,
"Waiting for debugger-transaction-complete");
wait-for(application.debugger-transaction-complete);
end with-lock;
end;
Expand All @@ -92,7 +98,8 @@ define method target-application-state (application :: <target-application>)
application.been-managed? => #"closed";
otherwise => #"uninitialized";
end case;
thread-debug-message("target-application-state is %=", state);
debug-target-message(application, $debug-level,
"target-application-state is %=", state);
state
end method;

Expand Down
2 changes: 2 additions & 0 deletions sources/environment/target-application/library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ define library target-application

use release-info;

use logging;
use access-path;
use debugger-manager;

Expand All @@ -40,6 +41,7 @@ define module target-application-internals

use release-info;

use logging;
use access-path,
rename: { thread-name => ap-thread-name};
use debugger-manager,
Expand Down
Loading