Skip to content

Commit d578c15

Browse files
authored
Environment debugging test suite (#1668)
2 parents 0ad0ca4 + 39aa0b7 commit d578c15

30 files changed

+3908
-160
lines changed

sources/dfmc/conversion/convert.dylan

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,8 +1648,10 @@ define method convert-next-method-into
16481648
next-ref :: <value-reference>)
16491649
=> ()
16501650
f.^function-next? := #t;
1651+
let loc = lambda-source-location(f);
16511652
let fragment
1652-
= with-expansion-source-form (model-definition(f))
1653+
= with-expansion-source-location (loc & source-location-record(loc),
1654+
loc & source-location-source-position(loc))
16531655
generate-next-method-function-fragment(f, signature-spec, next-ref)
16541656
end;
16551657
let (f-start, f-end, f-temp) = convert-1(env, fragment);

sources/environment/commands/application/debugging.dylan

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ define method do-execute-command
354354
(context,
355355
run-application, project,
356356
client: context,
357+
initialize-client: initialize-application-client,
357358
machine: machine | unsupplied(),
358359
startup-option: case
359360
debug? => #"debug";
@@ -662,7 +663,7 @@ end method parse-next-argument;
662663

663664
/// Application callbacks
664665

665-
define sideways method initialize-application-client
666+
define function initialize-application-client
666667
(context :: <environment-context>, application :: <application>) => ()
667668
register-application-callbacks
668669
(application,
@@ -690,7 +691,7 @@ define sideways method initialize-application-client
690691
application.application-filename);
691692
end,
692693
message-type: <run-application-failed-message>);
693-
end method initialize-application-client;
694+
end function initialize-application-client;
694695

695696

696697
define method start-debugging

sources/environment/dfmc/application/control-protocols.dylan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ define method run-application
3333
(application :: <dfmc-application>,
3434
#key startup-option :: <symbol> = #"start",
3535
client,
36+
initialize-client,
3637
filename :: false-or(<file-locator>),
3738
arguments :: false-or(<string>),
3839
process :: false-or(<process>) = #f,
@@ -44,6 +45,7 @@ define method run-application
4445
pause-before-termination? :: <boolean> = #f)
4546
=> (application :: <dfmc-application>)
4647
ignore(client);
48+
ignore(initialize-client);
4749

4850
// A couple of conveniences for filename processing stolen from
4951
// the console debugger.

sources/environment/dfmc/application/stack-frame-objects.dylan

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -145,59 +145,6 @@ define method stack-frame-type
145145
end method stack-frame-type;
146146

147147

148-
///// STACK-FRAME-PREVIOUS-FRAME (Environment Protocol Method)
149-
// Descends the stack trace.
150-
151-
define method stack-frame-previous-frame
152-
(application :: <dfmc-application>, sf :: <stack-frame-object>)
153-
=> (prev :: false-or(<stack-frame-object>))
154-
let prev-dm-frame = #f;
155-
let target = application.application-target-app;
156-
let dm-frame = sf.application-object-proxy;
157-
158-
perform-requiring-debugger-transaction
159-
(target,
160-
method ()
161-
prev-dm-frame := previous-stack-frame(target, dm-frame);
162-
end method);
163-
164-
if (prev-dm-frame)
165-
make-environment-object(<stack-frame-object>,
166-
project: application.server-project,
167-
application-object-proxy: prev-dm-frame);
168-
else
169-
#f
170-
end if;
171-
end method stack-frame-previous-frame;
172-
173-
174-
///// STACK-FRAME-NEXT-FRAME (Environment Protocol Method)
175-
// Ascends the stack trace.
176-
177-
define method stack-frame-next-frame
178-
(application :: <dfmc-application>, sf :: <stack-frame-object>)
179-
=> (prev :: false-or(<stack-frame-object>))
180-
181-
let nxt-dm-frame = #f;
182-
let target = application.application-target-app;
183-
let dm-frame = sf.application-object-proxy;
184-
185-
perform-requiring-debugger-transaction
186-
(target,
187-
method ()
188-
nxt-dm-frame := next-stack-frame(target, dm-frame);
189-
end method);
190-
191-
if (nxt-dm-frame)
192-
make-environment-object(<stack-frame-object>,
193-
project: application.server-project,
194-
application-object-proxy: nxt-dm-frame);
195-
else
196-
#f
197-
end if;
198-
end method stack-frame-next-frame;
199-
200-
201148
///// STACK-FRAME-LOCAL-VARIABLES (Environment Protocol Method)
202149
// Builds <local-variable-object>s for the variables known to be live
203150
// in the given stack frame.

sources/environment/dfmc/application/thread-objects.dylan

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -223,26 +223,6 @@ define method application-threads
223223
end method application-threads;
224224

225225

226-
///// THREAD-STACK-TRACE (Environment Protocol Method)
227-
// Returns the frame at the top of the stack for this thread.
228-
229-
define method thread-stack-trace
230-
(application :: <dfmc-application>, thread :: <thread-object>)
231-
=> (top-frame :: <stack-frame-object>)
232-
let top-dm-frame = #f;
233-
let target = application.application-target-app;
234-
let remote-thread = thread.application-object-proxy;
235-
perform-requiring-debugger-transaction
236-
(target,
237-
method ()
238-
top-dm-frame := first-stack-frame(target, remote-thread);
239-
end method);
240-
make-environment-object(<stack-frame-object>,
241-
project: application.server-project,
242-
application-object-proxy: top-dm-frame);
243-
end method;
244-
245-
246226
///// THREAD-COMPLETE-STACK-TRACE (Environment Protocol Method)
247227
// Returns an ordered sequence of <stack-frame-object>s - all the frames
248228
// in the call stack of the specified thread.

sources/environment/dfmc/projects/library.dylan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ define module dfmc-environment-projects
6767
use dfmc-progress-reports,
6868
import: { internal-reporting-setter };
6969
use build-system,
70-
import: { $personal-bin, system-release-path };
70+
import: { $personal-bin, system-release-path, $build-system-makefile-name };
7171

7272
export <native-project-object>,
7373
<dfmc-project-object>;

sources/environment/dfmc/projects/projects.dylan

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,6 @@ define sealed method project-can-be-debugged?
828828
// | project-object.project-debug-filename ~= #f
829829
end method project-can-be-debugged?;
830830

831-
define constant $build-makefile = "dylanmakefile";
832-
833831
define sealed method project-compiled?
834832
(project :: <dfmc-project-object>)
835833
=> (compiled? :: <boolean>)
@@ -839,7 +837,7 @@ define sealed method project-compiled?
839837
let makefile
840838
= make(<native-file-locator>,
841839
directory: as(<directory-locator>, build-location),
842-
name: $build-makefile);
840+
name: $build-system-makefile-name);
843841
file-exists?(makefile)
844842
else
845843
#t

sources/environment/protocols/applications.dylan

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ define open generic run-application
108108
(server :: <server>,
109109
#key startup-option,
110110
client,
111+
initialize-client,
111112
filename,
112113
arguments,
113114
pause-before-termination?,
@@ -116,9 +117,6 @@ define open generic run-application
116117
machine)
117118
=> (application :: <application>);
118119

119-
define open generic initialize-application-client
120-
(client :: <object>, application :: <application>) => ();
121-
122120
// There's no NOTE-RUN-APPLICATION-REQUESTED, we just do the relevant
123121
// work in RUN-APPLICATION.
124122

@@ -183,11 +181,6 @@ define method perform-application-transaction
183181
end
184182
end method perform-application-transaction;
185183

186-
define method initialize-application-client
187-
(client :: <object>, application :: <application>) => ()
188-
#f
189-
end method initialize-application-client;
190-
191184
define method note-application-initialized
192185
(project :: <project-object>)
193186
=> ()
@@ -260,6 +253,7 @@ define method run-application
260253
(project :: <project-object>,
261254
#key startup-option = #"start",
262255
client = project,
256+
initialize-client :: <function> = ignore,
263257
filename,
264258
arguments,
265259
working-directory,
@@ -297,7 +291,7 @@ define method run-application
297291
end if;
298292
broadcast($project-channel,
299293
make(<run-application-requested-message>, project: project));
300-
initialize-application-client(client, application);
294+
initialize-client(client, application);
301295
let host-machine? = machine == environment-host-machine();
302296
run-application(application,
303297
startup-option: startup-option,

sources/environment/protocols/module.dylan

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ define module environment-protocols
309309

310310
// Threads objects
311311
export <thread-object>,
312-
thread-stack-trace,
313312
thread-complete-stack-trace,
314313
thread-index,
315314
thread-state,
@@ -388,7 +387,6 @@ define module environment-protocols
388387
find-application-proxy,
389388
application-proxy-id,
390389
run-application,
391-
initialize-application-client,
392390
attach-live-application,
393391
note-run-application-failed,
394392
stop-application,
@@ -636,8 +634,6 @@ define module environment-protocols
636634
stack-frame-source-location,
637635
stack-frame-thread,
638636
stack-frame-type,
639-
stack-frame-next-frame,
640-
stack-frame-previous-frame,
641637
stack-frame-local-variables,
642638
stack-frame-local-variable-count;
643639

sources/environment/protocols/stack-frame-objects.dylan

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,6 @@ define open generic stack-frame-type
9393
(server :: <server>, stack-frame :: <stack-frame-object>)
9494
=> (type :: <symbol>);
9595

96-
/// stack-frame-next-frame
97-
///
98-
///
99-
define open generic stack-frame-next-frame
100-
(server :: <server>, stack-frame :: <stack-frame-object>)
101-
=> (next-one :: false-or(<stack-frame-object>));
102-
103-
/// stack-frame-previous-frame
104-
///
105-
///
106-
define open generic stack-frame-previous-frame
107-
(server :: <server>, stack-frame :: <stack-frame-object>)
108-
=> (previous-one :: false-or(<stack-frame-object>));
109-
11096
/// stack-frame-local-variables
11197
///
11298
///

0 commit comments

Comments
 (0)