Merge

Sat, 02 Feb 2013 03:51:01 -0800

author
minqi
date
Sat, 02 Feb 2013 03:51:01 -0800
changeset 4517
ff5401ad5635
parent 4514
9fe95b01ad32
parent 4516
65b632b77a97
child 4518
879c6de913d6

Merge

     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/amd64/WindbgAMD64Thread.java	Sat Feb 02 08:46:48 2013 +0100
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/amd64/WindbgAMD64Thread.java	Sat Feb 02 03:51:01 2013 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -34,21 +34,11 @@
    1.11    private boolean        gotID;
    1.12    private long           id;
    1.13  
    1.14 -  /** The address argument must be the address of the HANDLE of the
    1.15 -      desired thread in the target process. */
    1.16 +  // The address argument must be the address of the OSThread::_thread_id
    1.17    WindbgAMD64Thread(WindbgDebugger debugger, Address addr) {
    1.18      this.debugger = debugger;
    1.19 -    // FIXME: size of data fetched here should be configurable.
    1.20 -    // However, making it so would produce a dependency on the "types"
    1.21 -    // package from the debugger package, which is not desired.
    1.22 -
    1.23 -    // another hack here is that we use sys thread id instead of handle.
    1.24 -    // windbg can't get details based on handles it seems.
    1.25 -    // I assume that osThread_win32 thread struct has _thread_id (which
    1.26 -    // sys thread id) just after handle field.
    1.27 -
    1.28 -    this.sysId   = (int) addr.addOffsetTo(debugger.getAddressSize()).getCIntegerAt(0, 4, true);
    1.29 -    gotID = false;
    1.30 +    this.sysId    = (long)addr.getCIntegerAt(0, 4, true);
    1.31 +    gotID         = false;
    1.32    }
    1.33  
    1.34    WindbgAMD64Thread(WindbgDebugger debugger, long sysId) {
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java	Sat Feb 02 08:46:48 2013 +0100
     2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java	Sat Feb 02 03:51:01 2013 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -34,21 +34,11 @@
    2.11    private boolean        gotID;
    2.12    private long           id;
    2.13  
    2.14 -  /** The address argument must be the address of the HANDLE of the
    2.15 -      desired thread in the target process. */
    2.16 +  // The address argument must be the address of OSThread::_thread_id
    2.17    WindbgX86Thread(WindbgDebugger debugger, Address addr) {
    2.18      this.debugger = debugger;
    2.19 -    // FIXME: size of data fetched here should be configurable.
    2.20 -    // However, making it so would produce a dependency on the "types"
    2.21 -    // package from the debugger package, which is not desired.
    2.22 -
    2.23 -    // another hack here is that we use sys thread id instead of handle.
    2.24 -    // windbg can't get details based on handles it seems.
    2.25 -    // I assume that osThread_win32 thread struct has _thread_id (which
    2.26 -    // sys thread id) just after handle field.
    2.27 -
    2.28 -    this.sysId   = (int) addr.addOffsetTo(debugger.getAddressSize()).getCIntegerAt(0, 4, true);
    2.29 -    gotID = false;
    2.30 +    this.sysId    = (long)addr.getCIntegerAt(0, 4, true);
    2.31 +    gotID         = false;
    2.32    }
    2.33  
    2.34    WindbgX86Thread(WindbgDebugger debugger, long sysId) {
     3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java	Sat Feb 02 08:46:48 2013 +0100
     3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java	Sat Feb 02 03:51:01 2013 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -32,6 +32,7 @@
    3.11  // to the sys_thread_t structure of the classic JVM implementation.
    3.12  public class OSThread extends VMObject {
    3.13      private static JIntField interruptedField;
    3.14 +    private static JIntField threadIdField;
    3.15      static {
    3.16          VM.registerVMInitializedObserver(new Observer() {
    3.17              public void update(Observable o, Object data) {
    3.18 @@ -43,6 +44,7 @@
    3.19      private static synchronized void initialize(TypeDataBase db) {
    3.20          Type type = db.lookupType("OSThread");
    3.21          interruptedField = type.getJIntField("_interrupted");
    3.22 +        threadIdField = type.getJIntField("_thread_id");
    3.23      }
    3.24  
    3.25      public OSThread(Address addr) {
    3.26 @@ -52,4 +54,9 @@
    3.27      public boolean interrupted() {
    3.28          return ((int)interruptedField.getValue(addr)) != 0;
    3.29      }
    3.30 +
    3.31 +    public int threadId() {
    3.32 +        return (int)threadIdField.getValue(addr);
    3.33 +    }
    3.34 +
    3.35  }
     4.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java	Sat Feb 02 08:46:48 2013 +0100
     4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java	Sat Feb 02 03:51:01 2013 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -43,7 +43,7 @@
    4.11    private static AddressField  osThreadField;
    4.12  
    4.13    // Field from OSThread
    4.14 -  private static Field         osThreadThreadHandleField;
    4.15 +  private static Field         osThreadThreadIdField;
    4.16  
    4.17    // This is currently unneeded but is being kept in case we change
    4.18    // the currentFrameGuess algorithm
    4.19 @@ -64,7 +64,7 @@
    4.20      osThreadField           = type.getAddressField("_osthread");
    4.21  
    4.22      type = db.lookupType("OSThread");
    4.23 -    osThreadThreadHandleField = type.getField("_thread_handle");
    4.24 +    osThreadThreadIdField = type.getField("_thread_id");
    4.25    }
    4.26  
    4.27    public Address getLastJavaFP(Address addr) {
    4.28 @@ -128,10 +128,10 @@
    4.29      // Fetch the OSThread (for now and for simplicity, not making a
    4.30      // separate "OSThread" class in this package)
    4.31      Address osThreadAddr = osThreadField.getValue(addr);
    4.32 -    // Get the address of the HANDLE within the OSThread
    4.33 -    Address threadHandleAddr =
    4.34 -      osThreadAddr.addOffsetTo(osThreadThreadHandleField.getOffset());
    4.35 +    // Get the address of the thread_id within the OSThread
    4.36 +    Address threadIdAddr =
    4.37 +      osThreadAddr.addOffsetTo(osThreadThreadIdField.getOffset());
    4.38      JVMDebugger debugger = VM.getVM().getDebugger();
    4.39 -    return debugger.getThreadForIdentifierAddress(threadHandleAddr);
    4.40 +    return debugger.getThreadForIdentifierAddress(threadIdAddr);
    4.41    }
    4.42  }
     5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java	Sat Feb 02 08:46:48 2013 +0100
     5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java	Sat Feb 02 03:51:01 2013 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -42,7 +42,7 @@
    5.11    private static AddressField  osThreadField;
    5.12  
    5.13    // Field from OSThread
    5.14 -  private static Field         osThreadThreadHandleField;
    5.15 +  private static Field         osThreadThreadIdField;
    5.16  
    5.17    // This is currently unneeded but is being kept in case we change
    5.18    // the currentFrameGuess algorithm
    5.19 @@ -63,7 +63,7 @@
    5.20      osThreadField           = type.getAddressField("_osthread");
    5.21  
    5.22      type = db.lookupType("OSThread");
    5.23 -    osThreadThreadHandleField = type.getField("_thread_handle");
    5.24 +    osThreadThreadIdField = type.getField("_thread_id");
    5.25    }
    5.26  
    5.27    public Address getLastJavaFP(Address addr) {
    5.28 @@ -127,10 +127,10 @@
    5.29      // Fetch the OSThread (for now and for simplicity, not making a
    5.30      // separate "OSThread" class in this package)
    5.31      Address osThreadAddr = osThreadField.getValue(addr);
    5.32 -    // Get the address of the HANDLE within the OSThread
    5.33 -    Address threadHandleAddr =
    5.34 -      osThreadAddr.addOffsetTo(osThreadThreadHandleField.getOffset());
    5.35 +    // Get the address of the thread_id within the OSThread
    5.36 +    Address threadIdAddr =
    5.37 +      osThreadAddr.addOffsetTo(osThreadThreadIdField.getOffset());
    5.38      JVMDebugger debugger = VM.getVM().getDebugger();
    5.39 -    return debugger.getThreadForIdentifierAddress(threadHandleAddr);
    5.40 +    return debugger.getThreadForIdentifierAddress(threadIdAddr);
    5.41    }
    5.42  }

mercurial