summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r--lldb/scripts/Python/python-typemaps.swig8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig
index 7eedfdbdb8d..77ca1156ec5 100644
--- a/lldb/scripts/Python/python-typemaps.swig
+++ b/lldb/scripts/Python/python-typemaps.swig
@@ -406,6 +406,8 @@ bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
}
%typemap(out) FILE * {
+ // TODO: This is gross. We should find a way to fetch the mode flags from the
+ // lldb_private::File object.
char mode[4] = {0};
%#ifdef __APPLE__
int i = 0;
@@ -420,6 +422,12 @@ bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
else // if (flags & __SRW)
mode[i++] = 'a';
}
+%#else
+ // There's no portable way to get the mode here. We just return a mode which
+ // permits both reads and writes and count on the operating system to return
+ // an error when an invalid operation is attempted.
+ mode[0] = 'r';
+ mode[1] = '+';
%#endif
using namespace lldb_private;
NativeFile file($1, false);
OpenPOWER on IntegriCloud