blob: 4f5f2f5864967d82510143f1f1e49460b79b8f0f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (c) 2004, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.command.factories.linux;
import java.util.List;
import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
import org.eclipse.cdt.debug.mi.core.output.MIShared;
/**
* Linux specific parser of the "info shared" output.
*/
public class LinuxCLIInfoSharedLibraryInfo extends CLIInfoSharedLibraryInfo {
/**
* Constructor for LinuxCLIInfoSharedLibraryInfo.
*/
public LinuxCLIInfoSharedLibraryInfo( MIOutput out ) {
super( out );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo#parseShared(java.lang.String, java.util.List)
*/
protected void parseShared( String str, List aList ) {
if ( str.length() > 0 && !str.startsWith( "From" ) ) { //$NON-NLS-1$
// Pass the header
int index = -1;
String from = ""; //$NON-NLS-1$
String to = ""; //$NON-NLS-1$
boolean syms = false;
String name = ""; //$NON-NLS-1$
for( int i = 0; (index = str.lastIndexOf( ' ' )) != -1 || i <= 3; i++ ) {
if ( index == -1 ) {
index = 0;
}
String sub = str.substring( index ).trim();
// move to previous column
str = str.substring( 0, index ).trim();
switch( i ) {
case 0:
name = sub;
break;
case 1:
if ( sub.equalsIgnoreCase( "Yes" ) ) { //$NON-NLS-1$
syms = true;
}
break;
case 2: // second column is "To"
to = sub;
break;
case 3: // first column is "From"
from = sub;
break;
}
}
if ( name.length() > 0 ) {
MIShared s = new MIShared( from, to, syms, name );
aList.add( s );
}
}
}
}
|