diff options
author | Gary Benson <gbenson@redhat.com> | 2015-03-25 11:26:43 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-03-25 11:26:43 +0000 |
commit | 1c4b552ba553c4dbbb066c9ef8667209553444ca (patch) | |
tree | 0e1760a4e3082ffc5d5f63afedc05b9f879fb3d9 /gdb/mipsread.c | |
parent | d422d1c433073ba412287334a7ec3aa95e03c5e9 (diff) | |
download | gdb-1c4b552ba553c4dbbb066c9ef8667209553444ca.zip gdb-1c4b552ba553c4dbbb066c9ef8667209553444ca.tar.gz gdb-1c4b552ba553c4dbbb066c9ef8667209553444ca.tar.bz2 |
Associate target_ops with target_fileio file descriptors
Various target_fileio_* functions use integer file descriptors to
refer to open files. File operation functions are looked up from
the target stack as they are used, which causes problems if the
target stack changes after the file is opened.
For example, if a file is opened on a remote target and the remote
target disconnects or closes the remote target will be popped off
the stack. If target_fileio_close is then called on that file and
"set auto-connect-native-target" is "on" (the default) then the
native target's close method will be called. If the file opened
on the remote happens to share the same number with a file open in
GDB then that file will be closed by mistake.
This commit changes target_fileio_open to store newly opened file
descriptors in a table together with the target_ops used to open
them. The index into the table is returned and used as the file
descriptor argument to all target_fileio_* functions that accept
file descriptor arguments.
gdb/ChangeLog:
* target.c (fileio_ft_t): New typedef, define object vector.
(fileio_fhandles): New static variable.
(is_closed_fileio_fh): New macro.
(lowest_closed_fd): New static variable.
(acquire_fileio_fd): New function.
(release_fileio_fd): Likewise.
(fileio_fd_to_fh): New macro.
(target_fileio_open): Wrap the file descriptor on success.
(target_fileio_pwrite): Updated to use wrapped file descriptor.
(target_fileio_pread): Likewise.
(target_fileio_close): Likewise.
Diffstat (limited to 'gdb/mipsread.c')
0 files changed, 0 insertions, 0 deletions