Search in sources :

Example 1 with UnwindInfo

use of com.ibm.j9ddr.corereaders.minidump.unwind.UnwindInfo in project openj9 by eclipse.

the class BaseWindowsOSThread method walkStack64.

/* Walking 64 bit stacks is not like 32 bit stacks.
	 * We have to apply the unwind info contained in the dll's.
	 * 
	 * This is documented here:
	 * http://msdn.microsoft.com/en-us/library/8ydc79k6%28v=vs.110%29.aspx
	 */
private void walkStack64() throws CorruptDataException {
    // Get the module for the current instruction pointer.
    long ip = getInstructionPointer();
    long rsp = getStackPointer();
    while (ip != 0x0) {
        // Create a stack frame from that base pointer and instruction pointer.
        // On x86-64 the there is no base pointer.
        stackFrames.add(new OSStackFrame(rsp, ip));
        // Get the unwind info in the right module, for the current instruction pointer. (Step 1)
        UnwindModule module = getModuleForInstructionAddress(ip);
        RuntimeFunction rf = null;
        if (module != null) {
            rf = module.getUnwindDataForAddress(ip - module.getLoadAddress());
        } else {
            break;
        }
        if (rf == null) {
            // functions. (Windows 7 does.)
            break;
        } else {
            // System.err.println("Found unwind data: " + rf + " for " + SymbolUtil.getProcedureNameForAddress(process, ip));
            UnwindInfo info = new UnwindInfo(process.getAddressSpace(), module, rf.getUnwindInfoAddress());
            // Uncomment to dump unwind information as we apply it.
            // System.err.println("Applying UNWIND_INFO: " + info);
            // Apply the unwind info to the stack and get the new
            // base pointer and stack pointer.
            rsp = info.apply(rsp);
            // Get the instruction/base pointer for the next frame.
            ip = process.getPointerAt(rsp);
            // New stack pointer is the slot after that. (I think)
            rsp += 8;
        }
    // System.err.println(String.format("Next rsp = 0x%08x", rsp));
    // System.err.println(String.format("Next ip = 0x%08x", ip));
    }
}
Also used : IOSStackFrame(com.ibm.j9ddr.corereaders.osthread.IOSStackFrame) OSStackFrame(com.ibm.j9ddr.corereaders.osthread.OSStackFrame) UnwindInfo(com.ibm.j9ddr.corereaders.minidump.unwind.UnwindInfo) UnwindModule(com.ibm.j9ddr.corereaders.minidump.unwind.UnwindModule) RuntimeFunction(com.ibm.j9ddr.corereaders.minidump.unwind.RuntimeFunction)

Aggregations

RuntimeFunction (com.ibm.j9ddr.corereaders.minidump.unwind.RuntimeFunction)1 UnwindInfo (com.ibm.j9ddr.corereaders.minidump.unwind.UnwindInfo)1 UnwindModule (com.ibm.j9ddr.corereaders.minidump.unwind.UnwindModule)1 IOSStackFrame (com.ibm.j9ddr.corereaders.osthread.IOSStackFrame)1 OSStackFrame (com.ibm.j9ddr.corereaders.osthread.OSStackFrame)1