src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java
author ysuenaga
Fri, 18 Jan 2019 14:43:25 +0900
changeset 53379 e47074d2d8cc
parent 51203 220c9188db4f
child 58913 e2dfab7beccb
permissions -rw-r--r--
8181313: SA: Remove libthread_db dependency on Linux Reviewed-by: jgeorge, sballal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53379
e47074d2d8cc 8181313: SA: Remove libthread_db dependency on Linux
ysuenaga
parents: 51203
diff changeset
     2
 * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.debugger.linux;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
17310
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    27
import java.io.File;
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    28
import java.io.IOException;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    29
import java.io.UncheckedIOException;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    30
import java.nio.file.Files;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    31
import java.nio.file.Path;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    32
import java.nio.file.Paths;
17310
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    33
import java.util.ArrayList;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    34
import java.util.List;
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    35
import java.util.Map;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    36
import java.util.NoSuchElementException;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    37
import java.util.stream.Collectors;
17310
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    38
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    39
import sun.jvm.hotspot.debugger.Address;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    40
import sun.jvm.hotspot.debugger.DebuggerBase;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    41
import sun.jvm.hotspot.debugger.DebuggerException;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    42
import sun.jvm.hotspot.debugger.DebuggerUtilities;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    43
import sun.jvm.hotspot.debugger.MachineDescription;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    44
import sun.jvm.hotspot.debugger.NotInHeapException;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    45
import sun.jvm.hotspot.debugger.OopHandle;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    46
import sun.jvm.hotspot.debugger.ReadResult;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    47
import sun.jvm.hotspot.debugger.ThreadProxy;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    48
import sun.jvm.hotspot.debugger.UnalignedAddressException;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    49
import sun.jvm.hotspot.debugger.UnmappedAddressException;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    50
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    51
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    52
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
    53
import sun.jvm.hotspot.utilities.PlatformInfo;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
/** <P> An implementation of the JVMDebugger interface. The basic debug
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    facilities are implemented through ptrace interface in the JNI code
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    (libsaproc.so). Library maps and symbol table management are done in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    JNI. </P>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    <P> <B>NOTE</B> that since we have the notion of fetching "Java
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    primitive types" from the remote process (which might have
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    different sizes than we expect) we have a bootstrapping
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    problem. We need to know the sizes of these types before we can
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    fetch them. The current implementation solves this problem by
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    requiring that it be configured with these type sizes before they
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    can be fetched. The readJ(Type) routines here will throw a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    RuntimeException if they are called before the debugger is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    configured with the Java primitive type sizes. </P> */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    private boolean useGCC32ABI;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    private boolean attached;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    private long    p_ps_prochandle; // native debugger handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    private boolean isCore;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    // CDebugger support
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    private LinuxCDebugger cdbg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    // threadList and loadObjectList are filled by attach0 method
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    private List threadList;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    private List loadObjectList;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    83
    // PID namespace support
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    84
    // It maps the LWPID in the host to the LWPID in the container.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    85
    private Map<Integer, Integer> nspidMap;
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
    86
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    // called by native method lookupByAddress0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    private ClosestSymbol createClosestSymbol(String name, long offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
       return new ClosestSymbol(name, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    // called by native method attach0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    private LoadObject createLoadObject(String fileName, long textsize,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                                        long base) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
       File f = new File(fileName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
       Address baseAddr = newAddress(base);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
       return new SharedObject(this, fileName, f.length(), baseAddr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    // native methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    private native static void init0()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                                throws DebuggerException;
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   104
    private native void setSAAltRoot0(String altroot);
53379
e47074d2d8cc 8181313: SA: Remove libthread_db dependency on Linux
ysuenaga
parents: 51203
diff changeset
   105
    private native void attach0(int pid)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    private native void attach0(String execName, String coreName)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    private native void detach0()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    private native long lookupByName0(String objectName, String symbol)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    private native ClosestSymbol lookupByAddress0(long address)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    private native long[] getThreadIntegerRegisterSet0(int lwp_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    private native byte[] readBytesFromProcess0(long address, long numBytes)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
                                throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    public native static int  getAddressSize() ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    // Note on Linux threads are really processes. When target process is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    // attached by a serviceability agent thread, only that thread can do
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    // ptrace operations on the target. This is because from kernel's point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    // view, other threads are just separate processes and they are not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    // attached to the target. When they attempt to make ptrace calls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    // an ESRCH error will be returned as kernel believes target is not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    // being traced by the caller.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    // To work around the problem, we use a worker thread here to handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    // all JNI functions that are making ptrace calls.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    interface WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
       public void doit(LinuxDebuggerLocal debugger) throws DebuggerException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    class LinuxDebuggerLocalWorkerThread extends Thread {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
       LinuxDebuggerLocal debugger;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
       WorkerThreadTask task;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
       DebuggerException lastException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
       public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
         this.debugger = debugger;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
         setDaemon(true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
       public void run() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
          synchronized (workerThread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
             for (;;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
                if (task != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
                   lastException = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
                   try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
                      task.doit(debugger);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
                   } catch (DebuggerException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
                      lastException = exp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
                   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
                   task = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
                   workerThread.notifyAll();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
                try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
                   workerThread.wait();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
                } catch (InterruptedException x) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
       public WorkerThreadTask execute(WorkerThreadTask task) throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
          synchronized (workerThread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
             this.task = task;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
             workerThread.notifyAll();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
             while (this.task != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
                try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
                   workerThread.wait();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
                } catch (InterruptedException x) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
             if (lastException != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
                throw new DebuggerException(lastException);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
             } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
                return task;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    private LinuxDebuggerLocalWorkerThread workerThread = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    //----------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    // Implementation of Debugger interface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    /** <P> machDesc may not be null. </P>
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    <P> useCache should be set to true if debugging is being done
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    locally, and to false if the debugger is being created for the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    purpose of supporting remote debugging. </P> */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    public LinuxDebuggerLocal(MachineDescription machDesc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
                              boolean useCache) throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
        this.machDesc = machDesc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
        utils = new DebuggerUtilities(machDesc.getAddressSize(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
                                      machDesc.isBigEndian()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
           public void checkAlignment(long address, long alignment) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
             // Need to override default checkAlignment because we need to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
             // relax alignment constraints on Linux/x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
             if ( (address % alignment != 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
                &&(alignment != 8 || address % 4 != 0)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
                throw new UnalignedAddressException(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
                        "Trying to read at address: "
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
                      + addressValueToString(address)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
                      + " with alignment: " + alignment,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
                        address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        if (useCache) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
            // FIXME: re-test necessity of cache on Linux, where data
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
            // fetching is faster
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
            // Cache portion of the remote process's address space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
            // Fetching data over the socket connection to dbx is slow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
            // Might be faster if we were using a binary protocol to talk to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
            // dbx, but would have to test. For now, this cache works best
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
            // if it covers the entire heap of the remote process. FIXME: at
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
            // least should make this tunable from the outside, i.e., via
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
            // the UI. This is a cache of 4096 4K pages, or 16 MB. The page
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
            // size must be adjusted to be the hardware's page size.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
            // (FIXME: should pick this up from the debugger.)
48166
2659c4fe8ea7 8191324: SA cleanup -- part 2
jgeorge
parents: 47216
diff changeset
   226
            initCache(4096, parseCacheNumPagesProperty(4096));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
        workerThread = new LinuxDebuggerLocalWorkerThread(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
        workerThread.start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    public boolean hasProcessList() throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    public List getProcessList() throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
        throw new DebuggerException("getProcessList not implemented yet");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    private void checkAttached() throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
        if (attached) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
            if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
                throw new DebuggerException("attached to a core dump already");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
            } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                throw new DebuggerException("attached to a process already");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    private void requireAttach() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
        if (! attached) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
            throw new RuntimeException("not attached to a process or a core!");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    /* called from attach methods */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    private void findABIVersion() throws DebuggerException {
17310
b4118c427cc0 8005038: remove crufty '_g' support from SA
sla
parents: 13969
diff changeset
   261
        if (lookupByName0("libjvm.so", "__vt_10JavaThread") != 0) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
            // old C++ ABI
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
            useGCC32ABI = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
            // new C++ ABI
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
            useGCC32ABI = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   270
    // Get namespace PID from /proc/<PID>/status.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   271
    private int getNamespacePID(Path statusPath) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   272
        try (var lines = Files.lines(statusPath)) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   273
            return lines.map(s -> s.split("\\s+"))
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   274
                        .filter(a -> a.length == 3)
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   275
                        .filter(a -> a[0].equals("NSpid:"))
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   276
                        .mapToInt(a -> Integer.valueOf(a[2]))
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   277
                        .findFirst()
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   278
                        .getAsInt();
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   279
        } catch (IOException | NoSuchElementException e) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   280
            return Integer.valueOf(statusPath.getParent()
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   281
                                             .toFile()
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   282
                                             .getName());
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   283
        }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   284
    }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   285
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   286
    // Get LWPID in the host from the container's LWPID.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   287
    // Returns -1 if the process is running in the host.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   288
    public int getHostPID(int id) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   289
        return (nspidMap == null) ? -1 : nspidMap.get(id);
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   290
    }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   291
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   292
    // Fill namespace PID map from procfs.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   293
    // This method scans all tasks (/proc/<PID>/task) in the process.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   294
    private void fillNSpidMap(Path proc) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   295
        Path task = Paths.get(proc.toString(), "task");
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   296
        try (var tasks = Files.list(task)) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   297
            nspidMap = tasks.filter(p -> !p.toString().startsWith("."))
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   298
                            .collect(Collectors.toMap(p -> Integer.valueOf(getNamespacePID(Paths.get(p.toString(), "status"))),
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   299
                                                      p -> Integer.valueOf(p.toFile().getName())));
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   300
        } catch (IOException e) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   301
            throw new UncheckedIOException(e);
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   302
        }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   303
    }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   304
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
    public synchronized void attach(int processID) throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
        checkAttached();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
        threadList = new ArrayList();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
        loadObjectList = new ArrayList();
51203
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   310
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   311
        Path proc = Paths.get("/proc", Integer.toString(processID));
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   312
        int NSpid = getNamespacePID(Paths.get(proc.toString(), "status"));
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   313
        if (NSpid != processID) {
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   314
            // If PID different from namespace PID, we can assume the process
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   315
            // is running in the container.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   316
            // So we need to set SA_ALTROOT environment variable that SA reads
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   317
            // binaries in the container.
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   318
            setSAAltRoot0(Paths.get(proc.toString(), "root").toString());
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   319
            fillNSpidMap(proc);
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   320
        }
220c9188db4f 8205992: jhsdb cannot attach to Java processes running in Docker containers
ysuenaga
parents: 48166
diff changeset
   321
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
        class AttachTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
           int pid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
           public void doit(LinuxDebuggerLocal debugger) {
53379
e47074d2d8cc 8181313: SA: Remove libthread_db dependency on Linux
ysuenaga
parents: 51203
diff changeset
   325
              debugger.attach0(pid);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
              debugger.attached = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
              debugger.isCore = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
              findABIVersion();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
        AttachTask task = new AttachTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
        task.pid = processID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
        workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    public synchronized void attach(String execName, String coreName) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        checkAttached();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
        threadList = new ArrayList();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
        loadObjectList = new ArrayList();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
        attach0(execName, coreName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
        attached = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
        isCore = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        findABIVersion();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    public synchronized boolean detach() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
        if (!attached) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
        threadList = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
        loadObjectList = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
            detach0();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
            attached = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
            return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
            class DetachTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
                boolean result = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
                public void doit(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
                    debugger.detach0();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
                    debugger.attached = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
                    result = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
            DetachTask task = new DetachTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
            workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
            return task.result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    public Address parseAddress(String addressString)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
            throws NumberFormatException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        long addr = utils.scanAddress(addressString);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
        if (addr == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
            return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
        return new LinuxAddress(this, addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    public String getOS() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
        return PlatformInfo.getOS();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    /** From the Debugger interface via JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    public String getCPU() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
        return PlatformInfo.getCPU();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
    public boolean hasConsole() throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    public String consoleExecuteCommand(String cmd) throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
        throw new DebuggerException("No debugger console available on Linux");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    public String getConsolePrompt() throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
        return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    /* called from lookup */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    private long handleGCC32ABI(long addr, String symbol) throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
        if (useGCC32ABI && symbol.startsWith("_ZTV")) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
            return addr + (2 * machDesc.getAddressSize());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
            return addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    /** From the SymbolLookup interface via Debugger and JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    public synchronized Address lookup(String objectName, String symbol) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
        requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
        if (!attached) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
            return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
        if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
            long addr = lookupByName0(objectName, symbol);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
            return (addr == 0)? null : new LinuxAddress(this, handleGCC32ABI(addr, symbol));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
            class LookupByNameTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
                String objectName, symbol;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
                Address result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
                public void doit(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
                    long addr = debugger.lookupByName0(objectName, symbol);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
                    result = (addr == 0 ? null : new LinuxAddress(debugger, handleGCC32ABI(addr, symbol)));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
            LookupByNameTask task = new LookupByNameTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
            task.objectName = objectName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
            task.symbol = symbol;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
            workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
            return task.result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
    /** From the SymbolLookup interface via Debugger and JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
    public synchronized OopHandle lookupOop(String objectName, String symbol) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
        Address addr = lookup(objectName, symbol);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
        if (addr == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
            return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
        return addr.addOffsetToAsOopHandle(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
    /** From the Debugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    public MachineDescription getMachineDescription() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
        return machDesc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
    //----------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
    // Implementation of ThreadAccess interface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
    /** From the ThreadAccess interface via Debugger and JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
    public ThreadProxy getThreadForIdentifierAddress(Address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
        return new LinuxThread(this, addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
    /** From the ThreadAccess interface via Debugger and JVMDebugger */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
    public ThreadProxy getThreadForThreadId(long id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
        return new LinuxThread(this, id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
    //----------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    // Internal routines (for implementation of LinuxAddress).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
    // These must not be called until the MachineDescription has been set up.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
    /** From the LinuxDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
    public String addressValueToString(long address) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
        return utils.addressValueToString(address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
    /** From the LinuxDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
    public LinuxAddress readAddress(long address)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
            throws UnmappedAddressException, UnalignedAddressException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
        long value = readAddressValue(address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
        return (value == 0 ? null : new LinuxAddress(this, value));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
    }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   492
    public LinuxAddress readCompOopAddress(long address)
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   493
            throws UnmappedAddressException, UnalignedAddressException {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   494
        long value = readCompOopAddressValue(address);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   495
        return (value == 0 ? null : new LinuxAddress(this, value));
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   496
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   498
    public LinuxAddress readCompKlassAddress(long address)
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   499
            throws UnmappedAddressException, UnalignedAddressException {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   500
        long value = readCompKlassAddressValue(address);
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   501
        return (value == 0 ? null : new LinuxAddress(this, value));
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   502
    }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 5547
diff changeset
   503
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
    /** From the LinuxDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
    public LinuxOopHandle readOopHandle(long address)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
            throws UnmappedAddressException, UnalignedAddressException,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
                NotInHeapException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
        long value = readAddressValue(address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
        return (value == 0 ? null : new LinuxOopHandle(this, value));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
    }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   511
    public LinuxOopHandle readCompOopHandle(long address)
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   512
            throws UnmappedAddressException, UnalignedAddressException,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   513
                NotInHeapException {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   514
        long value = readCompOopAddressValue(address);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   515
        return (value == 0 ? null : new LinuxOopHandle(this, value));
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   516
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
    //----------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
    // Thread context access
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
    //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
    public synchronized long[] getThreadIntegerRegisterSet(int lwp_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
                                            throws DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
        requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
        if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
            return getThreadIntegerRegisterSet0(lwp_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
            class GetThreadIntegerRegisterSetTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
                int lwp_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
                long[] result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
                public void doit(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
                    result = debugger.getThreadIntegerRegisterSet0(lwp_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
            GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
            task.lwp_id = lwp_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
            workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
            return task.result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
    /** Need to override this to relax alignment checks on x86. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
    public long readCInteger(long address, long numBytes, boolean isUnsigned)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
        throws UnmappedAddressException, UnalignedAddressException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
        // Only slightly relaxed semantics -- this is a hack, but is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
        // necessary on x86 where it seems the compiler is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
        // putting some global 64-bit data on 32-bit boundaries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
        if (numBytes == 8) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
            utils.checkAlignment(address, 4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
            utils.checkAlignment(address, numBytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
        byte[] data = readBytes(address, numBytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
        return utils.dataToCInteger(data, isUnsigned);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
    // Overridden from DebuggerBase because we need to relax alignment
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
    // constraints on x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
    public long readJLong(long address)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
        throws UnmappedAddressException, UnalignedAddressException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
        utils.checkAlignment(address, jintSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
        byte[] data = readBytes(address, jlongSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
        return utils.dataToJLong(data, jlongSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    //----------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
    // Address access. Can not be package private, but should only be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    // accessed by the architecture-specific subpackages.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
    /** From the LinuxDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
    public long getAddressValue(Address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
      if (addr == null) return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
      return ((LinuxAddress) addr).getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
    /** From the LinuxDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
    public Address newAddress(long value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
      if (value == 0) return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
      return new LinuxAddress(this, value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
    /** From the LinuxCDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
    public List/*<ThreadProxy>*/ getThreadList() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
      requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
      return threadList;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
    /** From the LinuxCDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
    public List/*<LoadObject>*/ getLoadObjectList() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
      requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
      return loadObjectList;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
    /** From the LinuxCDebugger interface */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
    public synchronized ClosestSymbol lookup(long addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
       requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
       if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
          return lookupByAddress0(addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
       } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
          class LookupByAddressTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
             long addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
             ClosestSymbol result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
             public void doit(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
                 result = debugger.lookupByAddress0(addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
          LookupByAddressTask task = new LookupByAddressTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
          task.addr = addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
          workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
          return task.result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
    public CDebugger getCDebugger() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
      if (cdbg == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
         cdbg = new LinuxCDebugger(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
      return cdbg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
    /** This reads bytes from the remote process. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
    public synchronized ReadResult readBytesFromProcess(long address,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
            long numBytes) throws UnmappedAddressException, DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
        requireAttach();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
        if (isCore) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
            byte[] res = readBytesFromProcess0(address, numBytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
            return (res != null)? new ReadResult(res) : new ReadResult(address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
            class ReadBytesFromProcessTask implements WorkerThreadTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
                long address, numBytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
                ReadResult result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
                public void doit(LinuxDebuggerLocal debugger) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
                    byte[] res = debugger.readBytesFromProcess0(address, numBytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
                    if (res != null)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
                        result = new ReadResult(res);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
                    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
                        result = new ReadResult(address);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
            ReadBytesFromProcessTask task = new ReadBytesFromProcessTask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
            task.address = address;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
            task.numBytes = numBytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
            workerThread.execute(task);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
            return task.result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
    public void writeBytesToProcess(long address, long numBytes, byte[] data)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
        throws UnmappedAddressException, DebuggerException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
        // FIXME
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
        throw new DebuggerException("Unimplemented");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
    static {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
        System.loadLibrary("saproc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
        init0();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
}