< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java

Print this page

234             }
235         }
236         if (count == 0)
237             return null;
238         if (count > 1)
239             throw new TestBug(
240                 "found " + count + " such threads: " + name);
241         return threads[index];
242     }
243 
244 
245     public ThreadReference threadByNameOrThrow(String name) throws JDITestRuntimeException {
246 
247         List all = vm.allThreads();
248         ListIterator li = all.listIterator();
249         for (; li.hasNext(); ) {
250             ThreadReference thread = (ThreadReference) li.next();
251             if (thread.name().equals(name))
252                 return thread;
253         }



254         throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name);
255     }
256 
257     // --------------------------------------------------- //
258 
259     /**
260      * Returns Location object for given line number in specified method or null
261      * if no location for this line is found.
262      *
263      * @param method method mirror containing given line number
264      * @param line line number to find location
265      */
266     public Location getLineLocation(Method method, int line) {
267         List locs = null;
268         try {
269             locs = method.allLineLocations();
270         } catch(AbsentInformationException e) {
271             throw new TestBug("Unable to find location for line " + line + ": " + e);
272         }
273         Iterator iter = locs.iterator();

234             }
235         }
236         if (count == 0)
237             return null;
238         if (count > 1)
239             throw new TestBug(
240                 "found " + count + " such threads: " + name);
241         return threads[index];
242     }
243 
244 
245     public ThreadReference threadByNameOrThrow(String name) throws JDITestRuntimeException {
246 
247         List all = vm.allThreads();
248         ListIterator li = all.listIterator();
249         for (; li.hasNext(); ) {
250             ThreadReference thread = (ThreadReference) li.next();
251             if (thread.name().equals(name))
252                 return thread;
253         }
254         if ("Virtual".equals(System.getProperty("main.wrapper"))) {
255             return null;
256         }
257         throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name);
258     }
259 
260     // --------------------------------------------------- //
261 
262     /**
263      * Returns Location object for given line number in specified method or null
264      * if no location for this line is found.
265      *
266      * @param method method mirror containing given line number
267      * @param line line number to find location
268      */
269     public Location getLineLocation(Method method, int line) {
270         List locs = null;
271         try {
272             locs = method.allLineLocations();
273         } catch(AbsentInformationException e) {
274             throw new TestBug("Unable to find location for line " + line + ": " + e);
275         }
276         Iterator iter = locs.iterator();
< prev index next >