agent/src/share/classes/sun/jvm/hotspot/runtime/VirtualConstructor.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7088955 Cdiff agent/src/share/classes/sun/jvm/hotspot/runtime/VirtualConstructor.java

agent/src/share/classes/sun/jvm/hotspot/runtime/VirtualConstructor.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 24,34 **** package sun.jvm.hotspot.runtime; import java.util.*; import sun.jvm.hotspot.debugger.*; - import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.types.*; /** This class provides generalized "virtual constructor" functionality for VMObjects. In simple terms, it creates correctly-typed Java wrapper objects for underlying Addresses, --- 24,33 ----
*** 37,47 **** created for it will be of type sun.jvm.hotspot.memory.DefNewGeneration, assuming the mapping from type "DefNewGeneration" to class sun.jvm.hotspot.memory.DefNewGeneration has been set up. */ ! public class VirtualConstructor { private TypeDataBase db; private Map map; // Map<String, Class> public VirtualConstructor(TypeDataBase db) { this.db = db; --- 36,46 ---- created for it will be of type sun.jvm.hotspot.memory.DefNewGeneration, assuming the mapping from type "DefNewGeneration" to class sun.jvm.hotspot.memory.DefNewGeneration has been set up. */ ! public class VirtualConstructor extends InstanceConstructor<VMObject> { private TypeDataBase db; private Map map; // Map<String, Class> public VirtualConstructor(TypeDataBase db) { this.db = db;
*** 76,97 **** if (db.addressTypeIsEqualToType(addr, db.lookupType(typeName))) { return (VMObject) VMObjectFactory.newObject((Class) map.get(typeName), addr); } } ! String message = "No suitable match for type of address " + addr; ! CDebugger cdbg = VM.getVM().getDebugger().getCDebugger(); ! if (cdbg != null) { ! // Most common case: V-table pointer is the first field ! Address vtblPtr = addr.getAddressAt(0); ! LoadObject lo = cdbg.loadObjectContainingPC(vtblPtr); ! if (lo != null) { ! ClosestSymbol symbol = lo.closestSymbolToPC(vtblPtr); ! if (symbol != null) { ! message += " (nearest symbol is " + symbol.getName() + ")"; } - } - } - - throw new WrongTypeException(message); - } } --- 75,82 ---- if (db.addressTypeIsEqualToType(addr, db.lookupType(typeName))) { return (VMObject) VMObjectFactory.newObject((Class) map.get(typeName), addr); } } ! throw newWrongTypeException(addr); } }
agent/src/share/classes/sun/jvm/hotspot/runtime/VirtualConstructor.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File