Lines 386-392
exec_file_attach (const char *filename, int from_tty)
Link Here
|
386 |
else |
386 |
else |
387 |
{ |
387 |
{ |
388 |
int load_via_target = 0; |
388 |
int load_via_target = 0; |
389 |
const char *scratch_pathname, *canonical_pathname; |
389 |
const char *scratch_pathname; |
390 |
int scratch_chan; |
390 |
int scratch_chan; |
391 |
char **matching; |
391 |
char **matching; |
392 |
|
392 |
|
Lines 398-404
exec_file_attach (const char *filename, int from_tty)
Link Here
|
398 |
load_via_target = 1; |
398 |
load_via_target = 1; |
399 |
} |
399 |
} |
400 |
|
400 |
|
401 |
gdb::unique_xmalloc_ptr<char> canonical_storage, scratch_storage; |
401 |
gdb::unique_xmalloc_ptr<char> scratch_storage; |
402 |
if (load_via_target) |
402 |
if (load_via_target) |
403 |
{ |
403 |
{ |
404 |
/* gdb_bfd_fopen does not support "target:" filenames. */ |
404 |
/* gdb_bfd_fopen does not support "target:" filenames. */ |
Lines 409-415
exec_file_attach (const char *filename, int from_tty)
Link Here
|
409 |
|
409 |
|
410 |
scratch_pathname = filename; |
410 |
scratch_pathname = filename; |
411 |
scratch_chan = -1; |
411 |
scratch_chan = -1; |
412 |
canonical_pathname = scratch_pathname; |
|
|
413 |
} |
412 |
} |
414 |
else |
413 |
else |
415 |
{ |
414 |
{ |
Lines 437-455
exec_file_attach (const char *filename, int from_tty)
Link Here
|
437 |
perror_with_name (filename); |
436 |
perror_with_name (filename); |
438 |
|
437 |
|
439 |
scratch_pathname = scratch_storage.get (); |
438 |
scratch_pathname = scratch_storage.get (); |
440 |
|
|
|
441 |
/* gdb_bfd_open (and its variants) prefers canonicalized |
442 |
pathname for better BFD caching. */ |
443 |
canonical_storage = gdb_realpath (scratch_pathname); |
444 |
canonical_pathname = canonical_storage.get (); |
445 |
} |
439 |
} |
446 |
|
440 |
|
447 |
gdb_bfd_ref_ptr temp; |
441 |
gdb_bfd_ref_ptr temp; |
448 |
if (write_files && !load_via_target) |
442 |
if (write_files && !load_via_target) |
449 |
temp = gdb_bfd_fopen (canonical_pathname, gnutarget, |
443 |
temp = gdb_bfd_fopen (scratch_pathname, gnutarget, |
450 |
FOPEN_RUB, scratch_chan); |
444 |
FOPEN_RUB, scratch_chan); |
451 |
else |
445 |
else |
452 |
temp = gdb_bfd_open (canonical_pathname, gnutarget, scratch_chan); |
446 |
temp = gdb_bfd_open (scratch_pathname, gnutarget, scratch_chan); |
453 |
current_program_space->set_exec_bfd (std::move (temp)); |
447 |
current_program_space->set_exec_bfd (std::move (temp)); |
454 |
|
448 |
|
455 |
if (!current_program_space->exec_bfd ()) |
449 |
if (!current_program_space->exec_bfd ()) |