Lines 47-52
Link Here
|
47 |
import java.beans.PropertyChangeSupport; |
47 |
import java.beans.PropertyChangeSupport; |
48 |
import java.io.File; |
48 |
import java.io.File; |
49 |
import java.io.IOException; |
49 |
import java.io.IOException; |
|
|
50 |
import java.nio.charset.Charset; |
50 |
import java.util.ArrayList; |
51 |
import java.util.ArrayList; |
51 |
import java.util.Collection; |
52 |
import java.util.Collection; |
52 |
import java.util.Collections; |
53 |
import java.util.Collections; |
Lines 718-724
Link Here
|
718 |
// See IZ 147931 (On Mac sometimes response is in wrong format) |
719 |
// See IZ 147931 (On Mac sometimes response is in wrong format) |
719 |
if (results.startsWith("threadno")) { // NOI18N |
720 |
if (results.startsWith("threadno")) { // NOI18N |
720 |
for (String line : results.split("threadn")) { //NOI18N |
721 |
for (String line : results.split("threadn")) { //NOI18N |
721 |
Map<String, String> map = GdbUtils.createMapFromString(line); |
722 |
Map<String, String> map = createMapFromString(line); |
722 |
if (!map.isEmpty()) { |
723 |
if (!map.isEmpty()) { |
723 |
list.add(map.get("o") + " " + map.get("target_tid")); // NOI18N |
724 |
list.add(map.get("o") + " " + map.get("target_tid")); // NOI18N |
724 |
} |
725 |
} |
Lines 930-936
Link Here
|
930 |
|
931 |
|
931 |
while ((line = info.substring(start, next > 0 ? next : info.length())) != null) { |
932 |
while ((line = info.substring(start, next > 0 ? next : info.length())) != null) { |
932 |
if (line.contains(path)) { |
933 |
if (line.contains(path)) { |
933 |
return parseMacDylibAddress(line); |
934 |
return parseMacDylibAddress(line, getCharSetEncoding()); |
934 |
} |
935 |
} |
935 |
start = next + 12; |
936 |
start = next + 12; |
936 |
next = info.indexOf(",shlib-info=", start); // NOI18N |
937 |
next = info.indexOf(",shlib-info=", start); // NOI18N |
Lines 939-948
Link Here
|
939 |
|
940 |
|
940 |
} |
941 |
} |
941 |
|
942 |
|
942 |
private static String parseMacDylibAddress(String line) { |
943 |
private static String parseMacDylibAddress(String line, String encoding) { |
943 |
int pos1 = GdbUtils.findMatchingCurly(line, 0); |
944 |
int pos1 = GdbUtils.findMatchingCurly(line, 0); |
944 |
if (pos1 != -1) { |
945 |
if (pos1 != -1) { |
945 |
Map<String, String> map = GdbUtils.createMapFromString(line.substring(1, pos1)); |
946 |
Map<String, String> map = GdbUtils.createMapFromString(line.substring(1, pos1), encoding); |
946 |
if (map.containsKey("loaded_addr")) { // NOI18N |
947 |
if (map.containsKey("loaded_addr")) { // NOI18N |
947 |
return map.get("loaded_addr"); // NOI18N |
948 |
return map.get("loaded_addr"); // NOI18N |
948 |
} |
949 |
} |
Lines 1075-1085
Link Here
|
1075 |
if (msg.startsWith(DONE_PREFIX)) { |
1076 |
if (msg.startsWith(DONE_PREFIX)) { |
1076 |
if (msg.startsWith("^done,bkpt=")) { // NOI18N (-break-insert) |
1077 |
if (msg.startsWith("^done,bkpt=")) { // NOI18N (-break-insert) |
1077 |
msg = msg.substring(12, msg.length() - 1); |
1078 |
msg = msg.substring(12, msg.length() - 1); |
1078 |
Map<String, String> map = GdbUtils.createMapFromString(msg); |
1079 |
Map<String, String> map = createMapFromString(msg); |
1079 |
validateBreakpoint(token, map); |
1080 |
validateBreakpoint(token, map); |
1080 |
} else if (msg.startsWith("^done,stack=")) { // NOI18N (-stack-list-frames) |
1081 |
} else if (msg.startsWith("^done,stack=")) { // NOI18N (-stack-list-frames) |
1081 |
if (state == State.STOPPED) { // Ignore data if we've resumed running |
1082 |
if (state == State.STOPPED) { // Ignore data if we've resumed running |
1082 |
stackUpdate(GdbUtils.createListFromString((msg.substring(13, msg.length() - 1)))); |
1083 |
stackUpdate(createListFromString((msg.substring(13, msg.length() - 1)))); |
1083 |
} |
1084 |
} |
1084 |
} else if (msg.startsWith("^done,locals=")) { // NOI18N (-stack-list-locals) |
1085 |
} else if (msg.startsWith("^done,locals=")) { // NOI18N (-stack-list-locals) |
1085 |
if (state == State.STOPPED) { // Ignore data if we've resumed running |
1086 |
if (state == State.STOPPED) { // Ignore data if we've resumed running |
Lines 1222-1228
Link Here
|
1222 |
if (msg.startsWith("*stopped")) { // NOI18N |
1223 |
if (msg.startsWith("*stopped")) { // NOI18N |
1223 |
Map<String, String> map; |
1224 |
Map<String, String> map; |
1224 |
if (msg.length() > 9) { |
1225 |
if (msg.length() > 9) { |
1225 |
map = GdbUtils.createMapFromString(msg.substring(9)); |
1226 |
map = createMapFromString(msg.substring(9)); |
1226 |
} else { |
1227 |
} else { |
1227 |
map = new HashMap<String, String>(); |
1228 |
map = new HashMap<String, String>(); |
1228 |
} |
1229 |
} |
Lines 1361-1370
Link Here
|
1361 |
} |
1362 |
} |
1362 |
|
1363 |
|
1363 |
private void addArgsToLocalVariables(String info) { |
1364 |
private void addArgsToLocalVariables(String info) { |
1364 |
List<String> frames = GdbUtils.createListFromString(info); |
1365 |
List<String> frames = createListFromString(info); |
1365 |
GdbCallStackFrame curFrame = getCurrentCallStackFrame(); |
1366 |
GdbCallStackFrame curFrame = getCurrentCallStackFrame(); |
1366 |
for (String frame : frames) { |
1367 |
for (String frame : frames) { |
1367 |
Map<String, String> frameMap = GdbUtils.createMapFromString(frame); |
1368 |
Map<String, String> frameMap = createMapFromString(frame); |
1368 |
int level; |
1369 |
int level; |
1369 |
try { |
1370 |
try { |
1370 |
level = Integer.parseInt(frameMap.get("level")); // NOI18N |
1371 |
level = Integer.parseInt(frameMap.get("level")); // NOI18N |
Lines 1679-1685
Link Here
|
1679 |
if (state == State.STARTING) { |
1680 |
if (state == State.STARTING) { |
1680 |
String frame = map.get("frame"); // NOI18N |
1681 |
String frame = map.get("frame"); // NOI18N |
1681 |
if (frame != null) { |
1682 |
if (frame != null) { |
1682 |
map = GdbUtils.createMapFromString(frame); |
1683 |
map = createMapFromString(frame); |
1683 |
updateLastStop(map); |
1684 |
updateLastStop(map); |
1684 |
} |
1685 |
} |
1685 |
setLoading(); |
1686 |
setLoading(); |
Lines 1760-1766
Link Here
|
1760 |
} |
1761 |
} |
1761 |
String frame = map.get("frame"); // NOI18N |
1762 |
String frame = map.get("frame"); // NOI18N |
1762 |
if (frame != null) { |
1763 |
if (frame != null) { |
1763 |
map = GdbUtils.createMapFromString(frame); |
1764 |
map = createMapFromString(frame); |
1764 |
updateLastStop(map); |
1765 |
updateLastStop(map); |
1765 |
} |
1766 |
} |
1766 |
GdbTimer.getTimer("Startup").stop("Startup1"); // NOI18N |
1767 |
GdbTimer.getTimer("Startup").stop("Startup1"); // NOI18N |
Lines 1773-1779
Link Here
|
1773 |
setStopped(); |
1774 |
setStopped(); |
1774 |
String frame = map.get("frame"); // NOI18N |
1775 |
String frame = map.get("frame"); // NOI18N |
1775 |
if (frame != null) { |
1776 |
if (frame != null) { |
1776 |
map = GdbUtils.createMapFromString(frame); |
1777 |
map = createMapFromString(frame); |
1777 |
updateLastStop(map); |
1778 |
updateLastStop(map); |
1778 |
} |
1779 |
} |
1779 |
if (GdbTimer.getTimer("Step").getSkipCount() == 0) { // NOI18N |
1780 |
if (GdbTimer.getTimer("Step").getSkipCount() == 0) { // NOI18N |
Lines 1880-1886
Link Here
|
1880 |
int next; |
1881 |
int next; |
1881 |
|
1882 |
|
1882 |
while ((next = info.indexOf("shlib-info=", start + 1)) > 0) { // NOI18N |
1883 |
while ((next = info.indexOf("shlib-info=", start + 1)) > 0) { // NOI18N |
1883 |
map = GdbUtils.createMapFromString(info.substring(start + 12, next - 2)); |
1884 |
map = createMapFromString(info.substring(start + 12, next - 2)); |
1884 |
path = map.get("path"); // NOI18N |
1885 |
path = map.get("path"); // NOI18N |
1885 |
addr = map.get("dyld-addr"); // NOI18N |
1886 |
addr = map.get("dyld-addr"); // NOI18N |
1886 |
if (path != null && addr != null) { |
1887 |
if (path != null && addr != null) { |
Lines 1888-1894
Link Here
|
1888 |
} |
1889 |
} |
1889 |
start = next; |
1890 |
start = next; |
1890 |
} |
1891 |
} |
1891 |
map = GdbUtils.createMapFromString(info.substring(start + 12, info.length() - 1)); |
1892 |
map = createMapFromString(info.substring(start + 12, info.length() - 1)); |
1892 |
path = map.get("path"); // NOI18N |
1893 |
path = map.get("path"); // NOI18N |
1893 |
addr = map.get("dyld-addr"); // NOI18N |
1894 |
addr = map.get("dyld-addr"); // NOI18N |
1894 |
if (path != null && addr != null) { |
1895 |
if (path != null && addr != null) { |
Lines 1967-1974
Link Here
|
1967 |
boolean valid = true; |
1968 |
boolean valid = true; |
1968 |
boolean checkNextFrame = false; |
1969 |
boolean checkNextFrame = false; |
1969 |
|
1970 |
|
1970 |
for (String frame : GdbUtils.createListFromString(msg)) { |
1971 |
for (String frame : createListFromString(msg)) { |
1971 |
Map<String, String> map = GdbUtils.createMapFromString(frame); |
1972 |
Map<String, String> map = createMapFromString(frame); |
1972 |
String func = map.get("func"); // NOI18N |
1973 |
String func = map.get("func"); // NOI18N |
1973 |
if (func != null && func.equals("dlopen") && !checkNextFrame) { // NOI18N |
1974 |
if (func != null && func.equals("dlopen") && !checkNextFrame) { // NOI18N |
1974 |
if (platform == PlatformTypes.PLATFORM_MACOSX) { |
1975 |
if (platform == PlatformTypes.PLATFORM_MACOSX) { |
Lines 2249-2255
Link Here
|
2249 |
|
2250 |
|
2250 |
for (int i = 0; i < stack.size(); i++) { |
2251 |
for (int i = 0; i < stack.size(); i++) { |
2251 |
String line = stack.get(i); |
2252 |
String line = stack.get(i); |
2252 |
Map<String, String> map = GdbUtils.createMapFromString(line); |
2253 |
Map<String, String> map = createMapFromString(line); |
2253 |
|
2254 |
|
2254 |
String func = map.get("func"); // NOI18N |
2255 |
String func = map.get("func"); // NOI18N |
2255 |
String file = map.get("file"); // NOI18N |
2256 |
String file = map.get("file"); // NOI18N |
Lines 2793-2796
Link Here
|
2793 |
System.out.println(" " + msg); // NOI18N |
2794 |
System.out.println(" " + msg); // NOI18N |
2794 |
} |
2795 |
} |
2795 |
} |
2796 |
} |
|
|
2797 |
|
2798 |
private final static String remoteCharSet = System.getProperty("cnd.remote.charset", "UTF-8"); // NOI18N |
2799 |
public String getCharSetEncoding() { |
2800 |
return getCharSetEncoding(this.execEnv); |
2801 |
} |
2802 |
|
2803 |
public static String getCharSetEncoding(ExecutionEnvironment execEnv) { |
2804 |
String encoding; |
2805 |
if (execEnv.isRemote()) { |
2806 |
encoding = remoteCharSet; |
2807 |
} else { |
2808 |
encoding = Charset.defaultCharset().name(); |
2809 |
} |
2810 |
return encoding; |
2811 |
} |
2812 |
|
2813 |
public Map<String, String> createMapFromString(String info) { |
2814 |
return GdbUtils.createMapFromString(info, getCharSetEncoding()); |
2815 |
} |
2816 |
|
2817 |
public List<String> createListFromString(String info) { |
2818 |
return GdbUtils.createListFromString(info, getCharSetEncoding()); |
2819 |
} |
2796 |
} |
2820 |
} |