1 /*
2 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.debugger.windbg.x86;
26
27 import sun.jvm.hotspot.debugger.*;
28 import sun.jvm.hotspot.debugger.x86.*;
29 import sun.jvm.hotspot.debugger.windbg.*;
30
31 class WindbgX86Thread implements ThreadProxy {
32 private WindbgDebugger debugger;
33 private long sysId;
34 private boolean gotID;
35 private long id;
36
37 /** The address argument must be the address of the HANDLE of the
38 desired thread in the target process. */
39 WindbgX86Thread(WindbgDebugger debugger, Address addr) {
40 this.debugger = debugger;
41 // FIXME: size of data fetched here should be configurable.
42 // However, making it so would produce a dependency on the "types"
43 // package from the debugger package, which is not desired.
44
45 // another hack here is that we use sys thread id instead of handle.
46 // windbg can't get details based on handles it seems.
47 // I assume that osThread_win32 thread struct has _thread_id (which
48 // sys thread id) just after handle field.
49
50 this.sysId = (int) addr.addOffsetTo(debugger.getAddressSize()).getCIntegerAt(0, 4, true);
51 gotID = false;
52 }
53
54 WindbgX86Thread(WindbgDebugger debugger, long sysId) {
55 this.debugger = debugger;
56 this.sysId = sysId;
57 gotID = false;
58 }
59
60 public ThreadContext getContext() throws IllegalThreadStateException {
61 long[] data = debugger.getThreadIntegerRegisterSet(getThreadID());
62 WindbgX86ThreadContext context = new WindbgX86ThreadContext(debugger);
63 for (int i = 0; i < data.length; i++) {
64 context.setRegister(i, data[i]);
65 }
66 return context;
67 }
68
69 public boolean canSetContext() throws DebuggerException {
70 return false;
|
1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.debugger.windbg.x86;
26
27 import sun.jvm.hotspot.debugger.*;
28 import sun.jvm.hotspot.debugger.x86.*;
29 import sun.jvm.hotspot.debugger.windbg.*;
30
31 class WindbgX86Thread implements ThreadProxy {
32 private WindbgDebugger debugger;
33 private long sysId;
34 private boolean gotID;
35 private long id;
36
37 // The address argument must be the address of OSThread::_thread_id
38 WindbgX86Thread(WindbgDebugger debugger, Address addr) {
39 this.debugger = debugger;
40 this.sysId = (long)addr.getCIntegerAt(0, 4, true);
41 gotID = false;
42 }
43
44 WindbgX86Thread(WindbgDebugger debugger, long sysId) {
45 this.debugger = debugger;
46 this.sysId = sysId;
47 gotID = false;
48 }
49
50 public ThreadContext getContext() throws IllegalThreadStateException {
51 long[] data = debugger.getThreadIntegerRegisterSet(getThreadID());
52 WindbgX86ThreadContext context = new WindbgX86ThreadContext(debugger);
53 for (int i = 0; i < data.length; i++) {
54 context.setRegister(i, data[i]);
55 }
56 return context;
57 }
58
59 public boolean canSetContext() throws DebuggerException {
60 return false;
|