sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.instr/src/com/nokia/carbide/cpp/pi/instr/BinaryReader122.java
changeset 5 844b047e260d
parent 2 b9ab3b238396
child 12 ae255c9aa552
--- a/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.instr/src/com/nokia/carbide/cpp/pi/instr/BinaryReader122.java	Tue Apr 20 14:41:43 2010 +0300
+++ b/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.instr/src/com/nokia/carbide/cpp/pi/instr/BinaryReader122.java	Wed Apr 21 15:14:16 2010 +0300
@@ -25,9 +25,13 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map.Entry;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.eclipse.core.runtime.Path;
+
 import com.nokia.carbide.cpp.internal.pi.model.Binary;
 import com.nokia.carbide.cpp.pi.importer.SampleImporter;
 import com.nokia.carbide.cpp.pi.importer.SampleImporter.PkgObyFile;
@@ -83,8 +87,32 @@
 	}
 	
 	public MapFile getMapFileForBinary(Binary b)
-	{
-		return this.binaryToMapFile.get(b);
+	{	
+		MapFile mf = binaryToMapFile.get(b);
+		if(mf == null){
+			String binaryName = b.getBinaryName();
+			try{
+				binaryName = new Path(b.getBinaryName()).lastSegment();
+			}catch (Exception e) {
+				// use defaults
+			}		
+			Iterator<Entry<Binary, MapFile>> iterator = binaryToMapFile.entrySet().iterator();
+			while(iterator.hasNext()){
+				Entry<Binary, MapFile> entry = iterator.next();			
+				String name = entry.getKey().getBinaryName();
+				try{
+					name = new Path(name).lastSegment();
+				}catch (Exception e) {
+					// use defaults
+				}
+				if(name.equals(binaryName)){
+					b.setBinaryName(entry.getKey().getBinaryName());
+					mf = entry.getValue();
+					break;
+				}
+			}
+		}
+		return mf;
 	}
 	
 	public Binary getBinaryForHostName(String s)
@@ -169,9 +197,9 @@
 				        	  
 					          if (binary != null)
 					          {
-					        	  if (debug)System.out.println(Messages.getString("BinaryReader122.foundPkgBinary1")+binary.binaryName+Messages.getString("BinaryReader122.foundPkgBinary2")+localFile); //$NON-NLS-1$ //$NON-NLS-2$
-				        		  binary.binaryName = localFile;
-				        		  getHostNameToBinary().put(binary.binaryName, binary);
+					        	  if (debug)System.out.println(Messages.getString("BinaryReader122.foundPkgBinary1")+binary.getBinaryName()+Messages.getString("BinaryReader122.foundPkgBinary2")+localFile); //$NON-NLS-1$ //$NON-NLS-2$
+				        		  binary.setBinaryName(localFile);
+				        		  getHostNameToBinary().put(binary.getBinaryName(), binary);
 					          }
 							  
 					          mapName = localFile+".map"; //$NON-NLS-1$
@@ -183,7 +211,7 @@
 			        			  {
 			        				  if (binary != null)
 			        				  {
-							        	  if (debug)System.out.println(Messages.getString("BinaryReader122.canGetBinaryFrom1")+binary.binaryName+Messages.getString("BinaryReader122.canGetBinaryFrom2")+localFile); //$NON-NLS-1$ //$NON-NLS-2$
+							        	  if (debug)System.out.println(Messages.getString("BinaryReader122.canGetBinaryFrom1")+binary.getBinaryName()+Messages.getString("BinaryReader122.canGetBinaryFrom2")+localFile); //$NON-NLS-1$ //$NON-NLS-2$
 			        					  binaryToMapFile.put(binary,mf);
 			        				  }
 			        				  else
@@ -227,8 +255,8 @@
 					if (fileSpecMatcher.matches()) {
 						Binary binary = ittTrace122.getBinaryForFileName(fileSpecMatcher.group(2).trim());
 						if (binary != null) {
-							binary.binaryName = fileSpecMatcher.group(1).trim();
-							getHostNameToBinary().put(binary.binaryName, binary);
+							binary.setBinaryName(fileSpecMatcher.group(1).trim());
+							getHostNameToBinary().put(binary.getBinaryName(), binary);
 							
 							String pcFileName = fileSpecMatcher.group(1).trim();
 							// .OBY is referring everything as root relative,