[Lldb-commits] [PATCH] [LLDB] debugger.GetInputFileHandle() should not close the file

Enrico Pertoso epertoso at google.com
Tue Jan 7 02:33:42 PST 2014


Hi Ari,

I think you're probably looking for another Enrico (in copy).

On Wed, Jan 1, 2014 at 1:33 AM, Ari Grant <ari.grant at me.com> wrote:
> Hi enrico,
>
> Open LLDB and run:
> (lldb) script print lldb.debugger.GetInputFileHandle()
>
> This puts the debugger into a catatonic state and all interactions seem
> to enter a black hole. The reason is that executing this commnand
> actually *CLOSES* the input file handle and so all input is dropped on
> the floor. Oof!
>
> The fix is simple: flush a descriptor, instead of closing it, when
> transferring ownership.
>
> Note that this also fixes GetOutputFileHandle() and GetError*.
>
> Test Plan: Execute 'script print lldb.debugger.GetInputFileHandle()' in
> the debugger. See that the handle is correctly printed and that LLDB
> remains response to all further commands.
>
> http://llvm-reviews.chandlerc.com/D2496
>
> Files:
>   scripts/Python/python-typemaps.swig
>
> Index: scripts/Python/python-typemaps.swig
> ===================================================================
> --- scripts/Python/python-typemaps.swig
> +++ scripts/Python/python-typemaps.swig
> @@ -440,7 +440,7 @@
>     else // if (flags & __SRW)
>        mode[i++] = 'a';
>  #endif
> -   $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fclose);
> +   $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fflush);
>  }
>
>  %typemap(in) (const char* string, int len) {



More information about the lldb-commits mailing list