Hi Thomas, Here are some suggestions.
Try to use the String org.eclipse.jdt.core.IMethod.getSignature() throws JavaModelException to get the IMethod JNI signature and then use TraceUtils.convertMethodSignature()to get the TRCMethod signature and then use the TPTP model query engine to find the method by signature. Two cases are shown here one with unqualified class names and one with one parameter being qualified: 1. public String testname1(int i1, List L1) throws Exception Params to Signature.createMethodSignature(String[], String) line: 530 = parameterTypes String[2] = [I, QList;] returnType = "QString;" IMethod.getSignature() = (IQList;)QString; 2. public String testname1(int i1, java.util.List L1) throws Exception Params to Signature.createMethodSignature(String[], String) line: 530 = parameterTypes String[2] = [I, Qjava.util.List;] returnType = "QString;" IMethod.getSignature() = (IQjava.util.List;)QString; <methodDef name="testname1" signature="(ILjava/util/List;)Ljava/lang/String;" startLineNumber="20" endLineNumber="20" methodId="5305" classIdRef="5309"/> <methods id="5305" name="testname1" signature="(int, java.util.List) java.lang.String" lineNo="20" baseTime="2.388830566406253E-7" cumulativeTime="2.388830566406253E-7" calls="1"/> If you can generate the fully quallified JNI signature from IMethod info using String org.eclipse.jdt.core.Signature.createMethodSignature(String[] parameterTypes, String returnType) then it should be easy to convert to TRCMethod signature, see the attached test class (add JDT core plugin and org.eclipse.tptp.platform.models to the class path): Take a look at the boolean org.eclipse.hyades.ui.internal.util.OpenJavaSource.openSource(String pattern, int javaType, IJavaSearchScope searchScope, boolean switchToJavaPerspective) an see if you can use the same approach to find the corresponding IMethod/IClass from an TRCMethod/TRCClass. OpenSource.openSource(Object) line: 43 selection TRCMethodImpl (id=228) [EMAIL PROTECTED] (id: 15605, name: add, signature: (java.lang.String, java.awt.Component) java.awt.Component, modifier: 0, notation: JNI, lineNo: 356, lineCount: 1, baseTime: 4.78991E-4, cumulativeTime: 4.78991E-4, calls: 2, totalCpuTime: 0.0) OpenJavaSource.openSource(String, int, IJavaSearchScope, boolean) line: 73 pattern "java.awt.Container.add(java.lang.String, java.awt.Component) java.awt.Component" Here is the whole call stack trace: Thread [main] (Suspended (breakpoint at line 73 in OpenJavaSource)) OpenJavaSource.openSource(String, int, IJavaSearchScope, boolean) line: 73 JavaOpenSource$1.run() line: 58 BusyIndicator.showWhile(Display, Runnable) line: 67 JavaOpenSource.openSource(EObject, boolean) line: 55 JavaOpenSourceProvider.openSource(String, EObject) line: 23 OpenSource.openSource(Object) line: 43 OpenSourceAction.run() line: 87 OpenSourceAction.run(IAction) line: 102 ObjectPluginAction(PluginAction).runWithEvent(Event) line: 253 PluginActionContributionItem(ActionContributionItem).handleWidgetSelection(Event, boolean) line: 545 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490 ActionContributionItem$5.handleEvent(Event) line: 402 EventTable.sendEvent(Event) line: 66 MenuItem(Widget).sendEvent(Event) line: 938 Display.runDeferredEvents() line: 3673 Display.readAndDispatch() line: 3284 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2337 Workbench.runUI() line: 2301 Workbench.access$4(Workbench) line: 2176 Workbench$4.run() line: 463 Realm.runWithDefault(Realm, Runnable) line: 289 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 458 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 101 EclipseAppHandle.run(Object) line: 146 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 356 EclipseStarter.run(String[], Runnable) line: 171 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object[]) line: 324 Main.invokeFramework(String[], URL[]) line: 476 Main.basicRun(String[]) line: 416 Main.run(String[]) line: 1141 Main.main(String[]) line: 1116 Thanks ! Marius Slavescu IBM Tivoli Autonomic Computing - Toronto Lab Phone: 905-413-3610 Thomas Eichstädt-Engelen <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 04/22/2007 07:55 AM Please respond to [EMAIL PROTECTED]; Please respond to TPTP Tracing and Profiling Tools Project developer discussions <tptp-tracing-profiling-tools-dev@eclipse.org> To tptp-tracing-profiling-tools-dev@eclipse.org cc Subject [tptp-tracing-profiling-tools-dev] the other way around -> relating TRCMethod to IMethod Hi there, a month ago Marius gave a very enlighting example how to use the SimpleQueryEngine. With that i got access to the TraceModel and extracted my method of interest successfully. Thanks Marius! What i now would like to do is do relate the found TRCMethod to the corresponding IMethod. I wrote a little HelperMethod wich looks like: HelperMethods.getIMethod(fqClassName, methodName, paramTypes); And here is my problem: TRCMethods' signature get's converted to a more readable version through TraceUtils.convertMethodSignature(). What i need is the 'original' signature to make the relation work in all cases. Is there possibility to get access to the original signature (probably through another query?) or do i have to reverse (assuming that it is reversable) the function of TraceUtils.convertMethodSignature() to come to the original signature? Many thanks to all, Thomas E.-E. _______________________________________________ tptp-tracing-profiling-tools-dev mailing list tptp-tracing-profiling-tools-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev
SignatureTest.java
Description: Binary data
_______________________________________________ tptp-tracing-profiling-tools-dev mailing list tptp-tracing-profiling-tools-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev