11/*
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.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -103,52 +103,21 @@ public void launchJdbAndDebuggee (String classToExecute) throws IOException {
103103
104104 String [] jdbCmdArgs = makeJdbCmdLine (classToExecute );
105105
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 );
149116 } else {
150- throw new Failure ("Unexpected launching mode: " + argumentHandler .getLaunchMode ());
117+ throw new TestBug ("Unexpected connector type for local launch mode"
118+ + argumentHandler .getConnectorType ());
151119 }
120+
152121 }
153122
154123 /**
@@ -189,11 +158,7 @@ private String[] makeJdbCmdLine (String classToExecute) {
189158 if (argumentHandler .isRawLaunchingConnector ()) {
190159
191160 if (argumentHandler .isSocketTransport ()) {
192- if (argumentHandler .isLaunchedLocally ()) {
193- connectorAddress = argumentHandler .getTransportPort ();
194- } else {
195- connectorAddress = argumentHandler .getDebugeeHost () + ":" + argumentHandler .getTransportPort ();
196- }
161+ connectorAddress = argumentHandler .getTransportPort ();
197162 } else if (argumentHandler .isShmemTransport () ) {
198163 connectorAddress = argumentHandler .getTransportSharedName ();
199164 } else {
@@ -235,8 +200,6 @@ private String[] makeJdbCmdLine (String classToExecute) {
235200
236201 if (argumentHandler .isSocketTransport ()) {
237202 connect .append ("port=" + argumentHandler .getTransportPort ().trim ());
238- if (argumentHandler .isLaunchedRemotely ())
239- connect .append (",hostname=" + argumentHandler .getDebugeeHost ().trim ());
240203 } else if (argumentHandler .isShmemTransport ()) {
241204 connect .append ("name=" + argumentHandler .getTransportSharedName ().trim ());
242205 } else {
@@ -312,7 +275,7 @@ private String[] makeJdbCmdLine (String classToExecute) {
312275 private void localLaunchAndAttach
313276 (String [] jdbCmdArgs , String classToExecute ) throws IOException {
314277
315- debuggee = new LocalLaunchedDebuggee (this );
278+ debuggee = new Debuggee (this );
316279 String address = makeTransportAddress ();
317280 String [] javaCmdArgs = makeCommandLineArgs (classToExecute , address );
318281 debuggee .launch (javaCmdArgs );
@@ -334,57 +297,12 @@ private String[] makeJdbCmdLine (String classToExecute) {
334297 String address = jdb .waitForListeningJdb ();
335298 display ("Listening address found: " + address );
336299
337- debuggee = new LocalLaunchedDebuggee (this );
300+ debuggee = new Debuggee (this );
338301 String [] javaCmdArgs = makeCommandLineArgs (classToExecute , address );
339302 debuggee .launch (javaCmdArgs );
340303
341304// jdb.waitForPrompt(0, false);
342305 }
343306
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- }
389307
390308} // End of Launcher
0 commit comments