src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java
changeset 54955 46409371a691
parent 48166 2659c4fe8ea7
equal deleted inserted replaced
54954:6ec71a88b68e 54955:46409371a691
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   617     public long[] getJavaThreadsInfo() {
   617     public long[] getJavaThreadsInfo() {
   618         requireAttach();
   618         requireAttach();
   619         Threads threads = VM.getVM().getThreads();
   619         Threads threads = VM.getVM().getThreads();
   620         int len = threads.getNumberOfThreads();
   620         int len = threads.getNumberOfThreads();
   621         long[] result = new long[len * 3];    // triple
   621         long[] result = new long[len * 3];    // triple
   622         JavaThread t = threads.first();
       
   623         long beg, end;
   622         long beg, end;
   624         int i = 0;
   623         int i = 0;
   625         while (t != null) {
   624         for (int k = 0; k < threads.getNumberOfThreads(); k++) {
       
   625             JavaThread t = threads.getJavaThreadAt(k);
   626             end = t.getStackBaseValue();
   626             end = t.getStackBaseValue();
   627             beg = end - t.getStackSize();
   627             beg = end - t.getStackSize();
   628             BsdThread bsdt = (BsdThread)t.getThreadProxy();
   628             BsdThread bsdt = (BsdThread)t.getThreadProxy();
   629             long uid = bsdt.getUniqueThreadId();
   629             long uid = bsdt.getUniqueThreadId();
   630             if (threadList != null) threadList.add(bsdt);
   630             if (threadList != null) threadList.add(bsdt);
   631             result[i] = uid;
   631             result[i] = uid;
   632             result[i + 1] = beg;
   632             result[i + 1] = beg;
   633             result[i + 2] = end;
   633             result[i + 2] = end;
   634             t = t.next();
       
   635             i += 3;
   634             i += 3;
   636         }
   635         }
   637         return result;
   636         return result;
   638     }
   637     }
   639 
   638