提交 5e7aa551 编写于 作者: S sgehwolf

8208091: SA: jhsdb jstack --mixed throws UnmappedAddressException on i686

Summary: Be sure to use the same register index in native and Java code.
Reviewed-by: sballal, cjplummer, tbell
上级 93fc4c9d
...@@ -55,7 +55,15 @@ final public class LinuxX86CFrame extends BasicCFrame { ...@@ -55,7 +55,15 @@ final public class LinuxX86CFrame extends BasicCFrame {
public CFrame sender(ThreadProxy thread) { public CFrame sender(ThreadProxy thread) {
X86ThreadContext context = (X86ThreadContext) thread.getContext(); X86ThreadContext context = (X86ThreadContext) thread.getContext();
Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP); /*
* Native code fills in the stack pointer register value using index
* X86ThreadContext.SP.
* See file LinuxDebuggerLocal.c macro REG_INDEX(reg).
*
* Be sure to use SP, or UESP which is aliased to SP in Java code,
* for the frame pointer validity check.
*/
Address esp = context.getRegisterAsAddress(X86ThreadContext.SP);
if ( (ebp == null) || ebp.lessThan(esp) ) { if ( (ebp == null) || ebp.lessThan(esp) ) {
return null; return null;
......
...@@ -46,7 +46,15 @@ public class WindowsX86CFrame extends BasicCFrame { ...@@ -46,7 +46,15 @@ public class WindowsX86CFrame extends BasicCFrame {
public CFrame sender(ThreadProxy thread) { public CFrame sender(ThreadProxy thread) {
X86ThreadContext context = (X86ThreadContext) thread.getContext(); X86ThreadContext context = (X86ThreadContext) thread.getContext();
Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP); /*
* Native code fills in the stack pointer register value using index
* X86ThreadContext.SP.
* See file sawindbg.cpp macro REG_INDEX(x).
*
* Be sure to use SP, or UESP which is aliased to SP in Java code,
* for the frame pointer validity check.
*/
Address esp = context.getRegisterAsAddress(X86ThreadContext.SP);
if ( (ebp == null) || ebp.lessThan(esp) ) { if ( (ebp == null) || ebp.lessThan(esp) ) {
return null; return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册