Mercurial > hg > truffle
diff agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java @ 6641:a9fed06c01d2
7154641: Servicability agent should work on platforms other than x86, sparc
Summary: Added capability to load support classes for other cpus
Reviewed-by: coleenp, bobv, sla
Contributed-by: Bill Pittore <bill.pittore@oracle.com>
author | bpittore |
---|---|
date | Thu, 30 Aug 2012 11:20:01 -0400 |
parents | c18cbe5936b8 |
children |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java Fri Aug 17 16:47:04 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java Thu Aug 30 11:20:01 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -24,6 +24,7 @@ package sun.jvm.hotspot.debugger.linux; +import java.lang.reflect.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.linux.amd64.*; import sun.jvm.hotspot.debugger.linux.ia64.*; @@ -41,8 +42,16 @@ return new LinuxIA64ThreadContext(dbg); } else if (cpu.equals("sparc")) { return new LinuxSPARCThreadContext(dbg); - } else { - throw new RuntimeException("cpu " + cpu + " is not yet supported"); + } else { + try { + Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." + + cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() + + "ThreadContext"); + Constructor[] ctcc = tcc.getConstructors(); + return (ThreadContext)ctcc[0].newInstance(dbg); + } catch (Exception e) { + throw new RuntimeException("cpu " + cpu + " is not yet supported"); + } } } }