1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for. Use soname instead of shared library name.

This commit is contained in:
Mikhail Khodjaiants 2006-04-11 19:31:59 +00:00
parent dae81c31ec
commit 39e1b6c5d3
2 changed files with 42 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2006-04-11 Mikhail Khodjaiants
Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for.
Use soname instead of shared library name.
* SolibSearchPathBlock.java
2006-04-10 Mikhail Khodjaiants
Bug 119740: allow to specify only a subset of shared objects that we want symbols to be loaded for.
* MANIFEST.MF

View file

@ -489,8 +489,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
throw new InterruptedException();
}
monitor.subTask( all[j].getPath() );
if ( isSharedLibrary( all[j] ) ) {
libs.add( all[j] );
String libName = getSharedLibraryName( all[j] );
if ( libName != null ) {
libs.add( new File( libName ) );
}
}
}
@ -509,6 +510,40 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
return result;
}
protected String getSharedLibraryName( File file ) {
if ( !file.isFile() )
return null;
IProject project = getProject();
if ( project != null ) {
IPath fullPath = new Path( file.getPath() );
try {
ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions( project );
for( int i = 0; i < binaryParsersExt.length; i++ ) {
IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension();
try {
IBinaryFile bin = parser.getBinary( fullPath );
if ( bin instanceof IBinaryShared ) {
String soname = ((IBinaryShared)bin).getSoName();
return ( soname.length() != 0 ) ? soname : file.getName();
}
}
catch( IOException e ) {
}
}
}
catch( CoreException e ) {
}
return null;
}
// no project: for now
IPath path = new Path( file.getPath() );
String name = path.lastSegment();
String extension = path.getFileExtension();
if ( extension != null && (extension.compareTo( "so" ) == 0 || extension.compareToIgnoreCase( "dll" ) == 0) ) //$NON-NLS-1$ //$NON-NLS-2$
return name;
return ( name.indexOf( ".so." ) >= 0 ) ? name : null; //$NON-NLS-1$
}
protected boolean isSharedLibrary( File file ) {
if ( !file.isFile() )
return false;