On 06/03/2019 02:49, Jonas Devlieghere via lldb-commits wrote:
Author: jdevlieghere
Date: Tue Mar  5 17:49:54 2019
New Revision: 355469

URL: http://llvm.org/viewvc/llvm-project?rev=355469&view=rev
Log:
[Reproducers] Don't intercept SBDebugger::SetInputFileHandle

With the reproducer logic in place for the command interpreter we no
longer need to make SBDebugger::SetInputFileHandle a no-op.

Modified:
     lldb/trunk/source/API/SBReproducer.cpp

Modified: lldb/trunk/source/API/SBReproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBReproducer.cpp?rev=355469&r1=355468&r2=355469&view=diff
==============================================================================
--- lldb/trunk/source/API/SBReproducer.cpp (original)
+++ lldb/trunk/source/API/SBReproducer.cpp Tue Mar  5 17:49:54 2019
@@ -45,9 +45,6 @@ SBRegistry::SBRegistry() {
// Custom implementation.
    Register(&invoke<void (SBDebugger::*)(
-               FILE *, bool)>::method<&SBDebugger::SetInputFileHandle>::doit,
-           &SetFileHandleRedirect);
-  Register(&invoke<void (SBDebugger::*)(
                 FILE *, bool)>::method<&SBDebugger::SetErrorFileHandle>::doit,
             &SetFileHandleRedirect);
    Register(&invoke<void (SBDebugger::*)(
@@ -706,6 +703,7 @@ SBRegistry::SBRegistry() {
      LLDB_REGISTER_METHOD(bool, SBDebugger, GetAsync, ());
      LLDB_REGISTER_METHOD(void, SBDebugger, SkipLLDBInitFiles, (bool));
      LLDB_REGISTER_METHOD(void, SBDebugger, SkipAppInitFiles, (bool));
+    LLDB_REGISTER_METHOD(void, SBDebugger, SetInputFileHandle, (FILE *, bool));
      LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetInputFileHandle, ());
      LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetOutputFileHandle, ());
      LLDB_REGISTER_METHOD(FILE *, SBDebugger, GetErrorFileHandle, ());



I'm wondering whether it wouldn't be cleaner move the FILE* recorder handling code completely to the SB replayer. I'm thinking of something like where we would teach the (de)serializer classes to treat `FILE*` specially, similarly to "const char*" values are treated specially. Only in this case, the special handling would consist of creating the recorder object like we do now. Then during replaying, the deserializer could automatically substitute the FILE* for the fake one without any special logic in SBDebugger.

For recording we would still have to have some special code, but this could be as simple as
```
SBDebugger::SetInputFH(FILE *f) {
  m_opaque_sp->SetInputFH(f, repro::GetDataRecorderForFileIfRecording(f));
}
```

What do you think?

pl
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to