Allow passing fd == NULL to exec_file_find and solib_find
This commit allows NULL to be passed as the int *fd argument to exec_file_find and solib_find to simplify use cases where the caller does not require the file to be opened. gdb/ChangeLog: * solib.c (solib_find_1): Allow fd argument to be NULL. (exec_file_find): Update comment. (solib_find): Likewise. * exec.c (exec_file_locate_attach): Use NULL as fd argument to exec_file_find to avoid having to close the opened file. * infrun.c (follow_exec): Likewise.
This commit is contained in:
parent
a93d5cb197
commit
998d2a3ef3
4 changed files with 29 additions and 21 deletions
|
@ -156,13 +156,7 @@ exec_file_locate_attach (int pid, int from_tty)
|
|||
is absolute then prefix the filename with gdb_sysroot. */
|
||||
if (gdb_sysroot != NULL && *gdb_sysroot != '\0'
|
||||
&& IS_ABSOLUTE_PATH (exec_file))
|
||||
{
|
||||
int fd = -1;
|
||||
|
||||
full_exec_path = exec_file_find (exec_file, &fd);
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
}
|
||||
full_exec_path = exec_file_find (exec_file, NULL);
|
||||
|
||||
if (full_exec_path == NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue