Mercurial > hg > truffle
diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java @ 22110:c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 26 Aug 2015 15:22:31 +0200 |
parents | 78c3d3d8d86e |
children | f879b1fe3773 |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java Wed Aug 26 14:13:43 2015 +0200 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java Wed Aug 26 15:22:31 2015 +0200 @@ -117,8 +117,8 @@ } }; - this.lineBreaks = new LineBreakpointFactory(breakpointCallback, warningLog); - this.tagBreaks = new TagBreakpointFactory(breakpointCallback, warningLog); + this.lineBreaks = new LineBreakpointFactory(this, breakpointCallback, warningLog); + this.tagBreaks = new TagBreakpointFactory(this, breakpointCallback, warningLog); } TruffleVM vm() { @@ -267,17 +267,11 @@ * formed. */ @SuppressWarnings("rawtypes") - static AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(Probe probe, String expr, AdvancedInstrumentResultListener resultListener) throws IOException { + AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(Probe probe, String expr, AdvancedInstrumentResultListener resultListener) throws IOException { try { Class<? extends TruffleLanguage> langugageClass = ACCESSOR.findLanguage(probe); - TruffleLanguage<?> l; - try { - l = langugageClass.newInstance(); - } catch (InstantiationException ex) { - throw new IllegalStateException(ex); - } catch (IllegalAccessException ex) { - throw new IllegalStateException(ex); - } + TruffleLanguage.Env env = ACCESSOR.findLanguage(vm, langugageClass); + TruffleLanguage<?> l = ACCESSOR.findLanguage(env); DebugSupportProvider dsp = ACCESSOR.getDebugSupport(l); return dsp.createAdvancedInstrumentRootFactory(expr, resultListener); } catch (DebugSupportException ex) { @@ -827,6 +821,11 @@ } @Override + protected TruffleLanguage<?> findLanguage(TruffleLanguage.Env env) { + return super.findLanguage(env); + } + + @Override protected DebugSupportProvider getDebugSupport(TruffleLanguage<?> l) { return super.getDebugSupport(l); }