Lines 1520-1530
static debug_prefix_map *debug_prefix_maps;
Link Here
|
1520 |
/* Record a debug file prefix mapping. ARG is the argument to |
1520 |
/* Record a debug file prefix mapping. ARG is the argument to |
1521 |
-fdebug-prefix-map and must be of the form OLD=NEW. */ |
1521 |
-fdebug-prefix-map and must be of the form OLD=NEW. */ |
1522 |
|
1522 |
|
|
|
1523 |
#define ENV_PREFIX "ENV:" |
1524 |
#define ENV_PREFIX_OFFSET (sizeof(ENV_PREFIX) - 1) |
1525 |
|
1523 |
void |
1526 |
void |
1524 |
add_debug_prefix_map (const char *arg) |
1527 |
add_debug_prefix_map (const char *arg) |
1525 |
{ |
1528 |
{ |
1526 |
debug_prefix_map *map; |
1529 |
debug_prefix_map *map; |
1527 |
const char *p; |
1530 |
const char *p; |
|
|
1531 |
char *env; |
1532 |
const char *old; |
1533 |
size_t oldlen; |
1528 |
|
1534 |
|
1529 |
p = strchr (arg, '='); |
1535 |
p = strchr (arg, '='); |
1530 |
if (!p) |
1536 |
if (!p) |
Lines 1532-1540
add_debug_prefix_map (const char *arg)
Link Here
|
1532 |
error ("invalid argument %qs to -fdebug-prefix-map", arg); |
1538 |
error ("invalid argument %qs to -fdebug-prefix-map", arg); |
1533 |
return; |
1539 |
return; |
1534 |
} |
1540 |
} |
|
|
1541 |
if (0 == strncmp(ENV_PREFIX, arg, ENV_PREFIX_OFFSET)) |
1542 |
{ |
1543 |
env = xstrndup (arg+ENV_PREFIX_OFFSET, p - (arg+ENV_PREFIX_OFFSET)); |
1544 |
old = getenv(env); |
1545 |
if (!old) |
1546 |
{ |
1547 |
warning (0, "environment variable %qs not set in argument to " |
1548 |
"-fdebug-prefix-map", env); |
1549 |
free(env); |
1550 |
return; |
1551 |
} |
1552 |
oldlen = strlen(old); |
1553 |
free(env); |
1554 |
} |
1555 |
else |
1556 |
{ |
1557 |
old = xstrndup (arg, p - arg); |
1558 |
oldlen = p - arg; |
1559 |
} |
1560 |
|
1535 |
map = XNEW (debug_prefix_map); |
1561 |
map = XNEW (debug_prefix_map); |
1536 |
map->old_prefix = xstrndup (arg, p - arg); |
1562 |
map->old_prefix = old; |
1537 |
map->old_len = p - arg; |
1563 |
map->old_len = oldlen; |
1538 |
p++; |
1564 |
p++; |
1539 |
map->new_prefix = xstrdup (p); |
1565 |
map->new_prefix = xstrdup (p); |
1540 |
map->new_len = strlen (p); |
1566 |
map->new_len = strlen (p); |
1541 |
- |
|
|