summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-01-14 20:47:38 +0000
committerGreg Clayton <gclayton@apple.com>2012-01-14 20:47:38 +0000
commit32720b51e22300b66d791755e3bb09821741cd09 (patch)
tree54c87e87f2def767b1874acec6124fdda56c350a /lldb/source/Core/Debugger.cpp
parent02b0843684d72360389756cdecd7df08b928939c (diff)
downloadbcm5719-llvm-32720b51e22300b66d791755e3bb09821741cd09.tar.gz
bcm5719-llvm-32720b51e22300b66d791755e3bb09821741cd09.zip
<rdar://problem/9731573>
Fixed two double "int close(int fd)" issues found by our file descriptor interposing library on darwin: The first is in SBDebugger::SetInputFileHandle (FILE *file, bool transfer_ownership) where we would give our FILE * to a lldb_private::File object member variable and tell it that it owned the file descriptor if "transfer_ownership" was true, and then we would also give it to the communication plug-in that waits for stdin to come in and tell it that it owned the FILE *. They would both try and close the file. The seconds was when we use a file descriptor through ConnectionFileDescriptor where someone else is creating a connection with ConnectionFileDescriptor and a URL like: "fd://123". We were always taking ownwership of the fd 123, when we shouldn't be. There is a TODO in the comments that says we should allow URL options to be passed to be able to specify this later (something like: "fd://123?transer_ownership=1"), but we can get to this later. llvm-svn: 148201
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index f28c261b414..72449efb4c3 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -410,7 +410,10 @@ Debugger::SetInputFileHandle (FILE *fh, bool tranfer_ownership)
// Disconnect from any old connection if we had one
m_input_comm.Disconnect ();
- m_input_comm.SetConnection (new ConnectionFileDescriptor (in_file.GetDescriptor(), true));
+ // Pass false as the second argument to ConnectionFileDescriptor below because
+ // our "in_file" above will already take ownership if requested and we don't
+ // want to objects trying to own and close a file descriptor.
+ m_input_comm.SetConnection (new ConnectionFileDescriptor (in_file.GetDescriptor(), false));
m_input_comm.SetReadThreadBytesReceivedCallback (Debugger::DispatchInputCallback, this);
Error error;
OpenPOWER on IntegriCloud