Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Test and Performance Tools Platform (TPTP) » the other way around -> relating TRCMethod to IMethod
the other way around -> relating TRCMethod to IMethod [message #96865] Wed, 25 April 2007 09:58 Go to next message
Thomas  ichstädt-Engelen is currently offline Thomas ichstädt-EngelenFriend
Messages: 50
Registered: July 2009
Member

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.
Re: the other way around -> relating TRCMethod to IMethod [message #97577 is a reply to message #96865] Wed, 02 May 2007 15:10 Go to previous messageGo to next message
Marius Slavescu is currently offline Marius SlavescuFriend
Messages: 67
Registered: July 2009
Member
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.openSourc e(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)
org.eclipse.hyades.models.trace.impl.TRCMethodImpl@1667f3c (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).handleW idgetSelection(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


Re: the other way around -> relating TRCMethod to IMethod [message #97607 is a reply to message #97577] Wed, 02 May 2007 18:04 Go to previous message
Thomas  ichstädt-Engelen is currently offline Thomas ichstädt-EngelenFriend
Messages: 50
Registered: July 2009
Member

Hi Marius,

many thanks! Your suggestions helped a lot!!

Cheers,

Thomas E.-E.




"Marius Slavescu" <slavescu@ca.ibm.com> schrieb im Newsbeitrag
news:f1a9kf$aab$1@build.eclipse.org...
> Hi Thomas,
>
> Here are some suggestions.
Previous Topic:determining target vm vendor + version before launching an application
Next Topic:Problem creating workbench location - Argument cannot be null
Goto Forum:
  


Current Time: Sat Nov 29 07:46:28 GMT 2014

Powered by FUDForum. Page generated in 0.19477 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software