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/ChangeLog | |
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/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a5abe28..591a114 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2015-03-25 Gary Benson <gbenson@redhat.com> + Pedro Alves <palves@redhat.com> + + * 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. + 2015-03-24 Pedro Alves <palves@redhat.com> * thread.c (thread_apply_all_command): Take exited threads into |