src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java
changeset 54955 46409371a691
parent 48166 2659c4fe8ea7
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Tue May 21 00:52:04 2019 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Tue May 21 10:34:57 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -619,10 +619,10 @@
         Threads threads = VM.getVM().getThreads();
         int len = threads.getNumberOfThreads();
         long[] result = new long[len * 3];    // triple
-        JavaThread t = threads.first();
         long beg, end;
         int i = 0;
-        while (t != null) {
+        for (int k = 0; k < threads.getNumberOfThreads(); k++) {
+            JavaThread t = threads.getJavaThreadAt(k);
             end = t.getStackBaseValue();
             beg = end - t.getStackSize();
             BsdThread bsdt = (BsdThread)t.getThreadProxy();
@@ -631,7 +631,6 @@
             result[i] = uid;
             result[i + 1] = beg;
             result[i + 2] = end;
-            t = t.next();
             i += 3;
         }
         return result;