Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java @ 7974:43badbe2717a
8000973: SA on windows thread inspection is broken
Summary: After bug 7161732, On Windows SA could not find correct address of thread_id of OSThread since _thread_id moved to end of the class . The presupposition of the address is following thread handle no longer stands. Fix by adding thread_id field to OSThread and getting the address directly from OSThread.
Reviewed-by: nloodin, sspitsyn
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Thu, 31 Jan 2013 17:43:01 -0800 |
parents | c18cbe5936b8 |
children |
comparison
equal
deleted
inserted
replaced
7959:7885e162c30f | 7974:43badbe2717a |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. | 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. | 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. |
32 private WindbgDebugger debugger; | 32 private WindbgDebugger debugger; |
33 private long sysId; | 33 private long sysId; |
34 private boolean gotID; | 34 private boolean gotID; |
35 private long id; | 35 private long id; |
36 | 36 |
37 /** The address argument must be the address of the HANDLE of the | 37 // The address argument must be the address of OSThread::_thread_id |
38 desired thread in the target process. */ | |
39 WindbgX86Thread(WindbgDebugger debugger, Address addr) { | 38 WindbgX86Thread(WindbgDebugger debugger, Address addr) { |
40 this.debugger = debugger; | 39 this.debugger = debugger; |
41 // FIXME: size of data fetched here should be configurable. | 40 this.sysId = (long)addr.getCIntegerAt(0, 4, true); |
42 // However, making it so would produce a dependency on the "types" | 41 gotID = false; |
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 } | 42 } |
53 | 43 |
54 WindbgX86Thread(WindbgDebugger debugger, long sysId) { | 44 WindbgX86Thread(WindbgDebugger debugger, long sysId) { |
55 this.debugger = debugger; | 45 this.debugger = debugger; |
56 this.sysId = sysId; | 46 this.sysId = sysId; |