1
1
/*
2
- * Copyright (c) 2002, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2002, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -103,52 +103,21 @@ public void launchJdbAndDebuggee (String classToExecute) throws IOException {
103
103
104
104
String [] jdbCmdArgs = makeJdbCmdLine (classToExecute );
105
105
106
- if (argumentHandler .isLaunchedLocally ()) {
107
-
108
- if (argumentHandler .isDefaultConnector ()) {
109
-
110
- localDefaultLaunch (jdbCmdArgs , classToExecute );
111
-
112
- } else if (argumentHandler .isRawLaunchingConnector ()) {
113
-
114
- localRawLaunch (jdbCmdArgs , classToExecute );
115
-
116
- } else if (argumentHandler .isLaunchingConnector ()) {
117
-
118
- localLaunch (jdbCmdArgs , classToExecute );
119
-
120
- } else if (argumentHandler .isAttachingConnector ()) {
121
-
122
- localLaunchAndAttach (jdbCmdArgs , classToExecute );
123
-
124
- } else if (argumentHandler .isListeningConnector ()) {
125
-
126
- localLaunchAndListen (jdbCmdArgs , classToExecute );
127
-
128
- } else {
129
- throw new TestBug ("Unexpected connector type for local launch mode"
130
- + argumentHandler .getConnectorType ());
131
- }
132
-
133
- } else if (argumentHandler .isLaunchedRemotely ()) {
134
-
135
- connectToBindServer (classToExecute );
136
-
137
- if (argumentHandler .isAttachingConnector ()) {
138
-
139
- remoteLaunchAndAttach (jdbCmdArgs , classToExecute );
140
-
141
- } else if (argumentHandler .isListeningConnector ()) {
142
-
143
- remoteLaunchAndListen (jdbCmdArgs , classToExecute );
144
-
145
- } else {
146
- throw new TestBug ("Unexpected connector type for remote launch mode"
147
- + argumentHandler .getConnectorType ());
148
- }
106
+ if (argumentHandler .isDefaultConnector ()) {
107
+ localDefaultLaunch (jdbCmdArgs , classToExecute );
108
+ } else if (argumentHandler .isRawLaunchingConnector ()) {
109
+ localRawLaunch (jdbCmdArgs , classToExecute );
110
+ } else if (argumentHandler .isLaunchingConnector ()) {
111
+ localLaunch (jdbCmdArgs , classToExecute );
112
+ } else if (argumentHandler .isAttachingConnector ()) {
113
+ localLaunchAndAttach (jdbCmdArgs , classToExecute );
114
+ } else if (argumentHandler .isListeningConnector ()) {
115
+ localLaunchAndListen (jdbCmdArgs , classToExecute );
149
116
} else {
150
- throw new Failure ("Unexpected launching mode: " + argumentHandler .getLaunchMode ());
117
+ throw new TestBug ("Unexpected connector type for local launch mode"
118
+ + argumentHandler .getConnectorType ());
151
119
}
120
+
152
121
}
153
122
154
123
/**
@@ -189,11 +158,7 @@ private String[] makeJdbCmdLine (String classToExecute) {
189
158
if (argumentHandler .isRawLaunchingConnector ()) {
190
159
191
160
if (argumentHandler .isSocketTransport ()) {
192
- if (argumentHandler .isLaunchedLocally ()) {
193
- connectorAddress = argumentHandler .getTransportPort ();
194
- } else {
195
- connectorAddress = argumentHandler .getDebugeeHost () + ":" + argumentHandler .getTransportPort ();
196
- }
161
+ connectorAddress = argumentHandler .getTransportPort ();
197
162
} else if (argumentHandler .isShmemTransport () ) {
198
163
connectorAddress = argumentHandler .getTransportSharedName ();
199
164
} else {
@@ -235,8 +200,6 @@ private String[] makeJdbCmdLine (String classToExecute) {
235
200
236
201
if (argumentHandler .isSocketTransport ()) {
237
202
connect .append ("port=" + argumentHandler .getTransportPort ().trim ());
238
- if (argumentHandler .isLaunchedRemotely ())
239
- connect .append (",hostname=" + argumentHandler .getDebugeeHost ().trim ());
240
203
} else if (argumentHandler .isShmemTransport ()) {
241
204
connect .append ("name=" + argumentHandler .getTransportSharedName ().trim ());
242
205
} else {
@@ -312,7 +275,7 @@ private String[] makeJdbCmdLine (String classToExecute) {
312
275
private void localLaunchAndAttach
313
276
(String [] jdbCmdArgs , String classToExecute ) throws IOException {
314
277
315
- debuggee = new LocalLaunchedDebuggee (this );
278
+ debuggee = new Debuggee (this );
316
279
String address = makeTransportAddress ();
317
280
String [] javaCmdArgs = makeCommandLineArgs (classToExecute , address );
318
281
debuggee .launch (javaCmdArgs );
@@ -334,57 +297,12 @@ private String[] makeJdbCmdLine (String classToExecute) {
334
297
String address = jdb .waitForListeningJdb ();
335
298
display ("Listening address found: " + address );
336
299
337
- debuggee = new LocalLaunchedDebuggee (this );
300
+ debuggee = new Debuggee (this );
338
301
String [] javaCmdArgs = makeCommandLineArgs (classToExecute , address );
339
302
debuggee .launch (javaCmdArgs );
340
303
341
304
// jdb.waitForPrompt(0, false);
342
305
}
343
306
344
- /**
345
- * Run test in remote mode using attaching connector.
346
- */
347
- private void remoteLaunchAndAttach
348
- (String [] jdbCmdArgs , String classToExecute ) throws IOException {
349
-
350
- debuggee = new RemoteLaunchedDebuggee (this );
351
- String address = makeTransportAddress ();
352
- String [] javaCmdArgs = makeCommandLineArgs (classToExecute , address );
353
- try {
354
- debuggee .launch (javaCmdArgs );
355
- } catch (IOException e ) {
356
- throw new Failure ("Caught exception while launching debuggee VM process:\n \t "
357
- + e );
358
- };
359
-
360
- display ("Start jdb attaching to remote debuggee" );
361
- jdb = Jdb .startAttachingJdb (this , jdbCmdArgs , JDB_STARTED );
362
- // jdb.waitForPrompt(0, false);
363
- }
364
-
365
- /**
366
- * Run test in remote mode using listening connector.
367
- */
368
- private void remoteLaunchAndListen
369
- (String [] jdbCmdArgs , String classToExecute ) throws IOException {
370
-
371
- jdb = new Jdb (this );
372
- display ("Starting jdb listening to remote debuggee" );
373
- jdb .launch (jdbCmdArgs );
374
- String address = jdb .waitForListeningJdb ();
375
- display ("Listening address found: " + address );
376
-
377
- debuggee = new RemoteLaunchedDebuggee (this );
378
- String [] javaCmdArgs = makeCommandLineArgs (classToExecute );
379
- try {
380
- debuggee .launch (javaCmdArgs );
381
- } catch (IOException e ) {
382
- throw new Failure ("Caught exception while launching debuggee VM process:\n \t "
383
- + e );
384
- };
385
-
386
- jdb .waitForMessage (0 , JDB_STARTED );
387
- // jdb.waitForPrompt(0, false);
388
- }
389
307
390
308
} // End of Launcher
0 commit comments