comparison 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
comparison
equal deleted inserted replaced
6640:e2cc1fe53845 6641:a9fed06c01d2
1 /* 1 /*
2 * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
22 * 22 *
23 */ 23 */
24 24
25 package sun.jvm.hotspot.debugger.linux; 25 package sun.jvm.hotspot.debugger.linux;
26 26
27 import java.lang.reflect.*;
27 import sun.jvm.hotspot.debugger.*; 28 import sun.jvm.hotspot.debugger.*;
28 import sun.jvm.hotspot.debugger.linux.amd64.*; 29 import sun.jvm.hotspot.debugger.linux.amd64.*;
29 import sun.jvm.hotspot.debugger.linux.ia64.*; 30 import sun.jvm.hotspot.debugger.linux.ia64.*;
30 import sun.jvm.hotspot.debugger.linux.x86.*; 31 import sun.jvm.hotspot.debugger.linux.x86.*;
31 import sun.jvm.hotspot.debugger.linux.sparc.*; 32 import sun.jvm.hotspot.debugger.linux.sparc.*;
39 return new LinuxAMD64ThreadContext(dbg); 40 return new LinuxAMD64ThreadContext(dbg);
40 } else if (cpu.equals("ia64")) { 41 } else if (cpu.equals("ia64")) {
41 return new LinuxIA64ThreadContext(dbg); 42 return new LinuxIA64ThreadContext(dbg);
42 } else if (cpu.equals("sparc")) { 43 } else if (cpu.equals("sparc")) {
43 return new LinuxSPARCThreadContext(dbg); 44 return new LinuxSPARCThreadContext(dbg);
44 } else { 45 } else {
45 throw new RuntimeException("cpu " + cpu + " is not yet supported"); 46 try {
47 Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." +
48 cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
49 "ThreadContext");
50 Constructor[] ctcc = tcc.getConstructors();
51 return (ThreadContext)ctcc[0].newInstance(dbg);
52 } catch (Exception e) {
53 throw new RuntimeException("cpu " + cpu + " is not yet supported");
54 }
46 } 55 }
47 } 56 }
48 } 57 }