| 1258 | } |
| 1259 | |
| 1260 | static void parse_stabs(void) |
| 1261 | { |
| 1262 | TCHAR *path = NULL; |
| 1263 | TCHAR *pathprefix = NULL; |
| 1264 | struct stab *s; |
| 1265 | int idx; |
| 1266 | static int pmindex; |
| 1267 | |
| 1268 | pathprefix = cfgfile_option_get(currprefs.debugging_options, _T("pathprefix")); |
| 1269 | |
| 1270 | idx = 0; |
| 1271 | for (;;) { |
| 1272 | s = findstab(N_SO, &idx); |
| 1273 | if (!s) |
| 1274 | break; |
| 1275 | if (s->string && s->string[_tcslen(s->string) - 1] == '/') { |
| 1276 | path = s->string; |
| 1277 | break; |
| 1278 | } |
| 1279 | } |
| 1280 | idx = 0; |
| 1281 | while (idx < stabscount) { |
| 1282 | s = &stabs[idx++]; |
| 1283 | if (!s) |
| 1284 | break; |
| 1285 | if (s->type == N_SO && s->string && s->string[_tcslen(s->string) - 1] != '/') { |
| 1286 | int pm = pmindex; |
| 1287 | struct debugcodefile *cf = NULL; |
| 1288 | for (int pmi = 0; pmi <= 5; pmi++, pm++) { |
| 1289 | TCHAR path2[MAX_DPATH]; |
| 1290 | TCHAR *f = NULL, *p = NULL; |
| 1291 | if (pm > 5) |
| 1292 | pm = 0; |
| 1293 | if (pm == 5) { |
| 1294 | // wsl path |
| 1295 | if (!_tcsnicmp(path, _T("/mnt/"), 5)) { |
| 1296 | TCHAR path2[MAX_DPATH]; |
| 1297 | _sntprintf(path2, sizeof path2, _T("%c:/%s"), path[5], path + 7); |
| 1298 | f = s->string; |
| 1299 | p = path2; |
| 1300 | } |
| 1301 | } else if (pm == 4) { |
| 1302 | // cygwin path |
| 1303 | if (!_tcsnicmp(path, _T("/cygdrive/"), 10)) { |
| 1304 | TCHAR path2[MAX_DPATH]; |
| 1305 | _sntprintf(path2, sizeof path2, _T("%c:/%s"), path[10], path + 12); |
| 1306 | f = s->string; |
| 1307 | p = path2; |
| 1308 | } |
| 1309 | } else if (pm == 3) { |
| 1310 | // pathprefix + path + file |
| 1311 | if (pathprefix) { |
| 1312 | _sntprintf(path2, sizeof path2, _T("%s%s"), pathprefix, path); |
| 1313 | f = s->string; |
| 1314 | p = path2; |
| 1315 | } |
| 1316 | } else if (pm == 2) { |
| 1317 | // pathprefix + file |
no test coverage detected