Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 46b43a2da004a8730fad98cbddd557c743dd1963 (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
package org.eclipse.cdt.debug.mi.core.output;

import java.util.ArrayList;

public class MIInfoSharedLibraryInfo extends MIInfo {

	MIShared[] shared = new MIShared[0];

	public MIInfoSharedLibraryInfo(MIOutput record) {
		super(record);
		parse();
	}

	private void parse() {
		if (isDone()) {
			ArrayList aList = new ArrayList();
			MIOutput out = getMIOutput();
			MIResultRecord rr = out.getMIResultRecord();
			if (rr != null) {
				MIResult[] results =  rr.getMIResults();
				for (int i = 0; i < results.length; i++) {
					String var = results[i].getVariable();
					if (var.equals("shlib-info")) { //$NON-NLS-1$
						MIValue val = results[i].getMIValue();
						if (val instanceof MITuple)
						{
							MIResult[] libResults = ((MITuple)val).getMIResults();
							String from = ""; //$NON-NLS-1$
							String to = ""; //$NON-NLS-1$
							boolean syms = true;
							String name = ""; //$NON-NLS-1$
							
							for (int j = 0; j < libResults.length; j++) {
								if (libResults[j].getVariable().equals("description")) //$NON-NLS-1$
								{
									name = libResults[j].getMIValue().toString();
								}
								if (libResults[j].getVariable().equals("loaded_addr")) //$NON-NLS-1$
								{
									from = libResults[j].getMIValue().toString();
									to = from;
								}
							}
							MIShared s = new MIShared(from, to, syms, name);
							aList.add(s);				
						}
					}
				}
			}
			shared = (MIShared[]) aList.toArray(new MIShared[aList.size()]);
		}
	}

	public MIShared[] getMIShared() {
		return shared;
	}

}

Back to the top