[Lldb-commits] [PATCH] D55038: [Reproducers] Change how reproducers are initialized.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 19 11:31:21 PST 2019

I think we'll need to reconsider this in light of the SBReproducers. The
Initialize method causes a bootstrapping problem, where we try to record
the Initialize call before the reproducer is initialized. Not recording the
initialization call isn't sufficient to solve this and in addition would
cause incorrectness in the logic that tracks API boundaries. This isn't
limited to the Initialized method, but also applies to
the SBInitializerOptions class.

I see a few potential solutions:

(1) Return a default-initialized reproducer when we try to obtain the
reproducer from the record macros before initialization. This would mean
we'd have to allow the reproducer to be re-initialized, potentially guarded
by a variable so that limits this to the aforementioned
(default-constructed) instance. This will create an imbalance, where
nothing before the initialization is recorded, but things after are. I'm
not sure if this actually causes a problem, but it feels hacky to say the

(2) Introduce a static variable that says that we're currently in the
initialization phase. When the variable is set we make the record macro a
no-op. This would mean adding more code to the macro expansion. In order to
guarantee symmetry during the initialization process we'd have to set and
unset it before and after the initialize call respectively. These two new
function calls would not be instrumented and guarantee to not call any
other SB method.

(3) Go back to initializing the reproducer before the rest of the debugger.
The method wouldn't be instrumented and guarantee no other SB methods are
called or SB objects are constructed. The initialization then becomes part
of the replay. Although it's more work and basically means undoing the
changes in this patch, I think it's the cleanest from a design point of

Of course I'm open to alternatives as well!


On Mon, Dec 3, 2018 at 9:31 AM Jonas Devlieghere via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL348152: [Reproducers] Change how reproducers are
> initialized. (authored by JDevlieghere, committed by ).
> Herald added a subscriber: llvm-commits.
> Changed prior to commit:
>   https://reviews.llvm.org/D55038?vs=176161&id=176418#toc
> Repository:
>   rL LLVM
>   https://reviews.llvm.org/D55038/new/
> https://reviews.llvm.org/D55038
> Files:
>   lldb/trunk/include/lldb/API/SBDebugger.h
>   lldb/trunk/include/lldb/API/SBDefines.h
>   lldb/trunk/include/lldb/API/SBFileSpec.h
>   lldb/trunk/include/lldb/API/SBInitializerOptions.h
>   lldb/trunk/include/lldb/Core/Debugger.h
>   lldb/trunk/include/lldb/Host/HostInfoBase.h
>   lldb/trunk/include/lldb/Initialization/SystemInitializer.h
>   lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h
>   lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h
>   lldb/trunk/include/lldb/Utility/Reproducer.h
>   lldb/trunk/lit/Reproducer/Inputs/GDBRemoteCapture.in
>   lldb/trunk/lit/Reproducer/Inputs/GDBRemoteReplay.in
>   lldb/trunk/lit/Reproducer/Inputs/simple.c
>   lldb/trunk/lit/Reproducer/TestDriverOptions.test
>   lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/Makefile
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/TestGdbRemoteReproducer.py
>   lldb/trunk/scripts/interface/SBDebugger.i
>   lldb/trunk/scripts/interface/SBInitializerOptions.i
>   lldb/trunk/scripts/lldb.swig
>   lldb/trunk/source/API/CMakeLists.txt
>   lldb/trunk/source/API/SBDebugger.cpp
>   lldb/trunk/source/API/SBInitializerOptions.cpp
>   lldb/trunk/source/API/SystemInitializerFull.cpp
>   lldb/trunk/source/API/SystemInitializerFull.h
>   lldb/trunk/source/Commands/CommandObjectReproducer.cpp
>   lldb/trunk/source/Core/Debugger.cpp
>   lldb/trunk/source/Host/common/HostInfoBase.cpp
>   lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
>   lldb/trunk/source/Initialization/SystemLifetimeManager.cpp
>   lldb/trunk/source/Utility/Reproducer.cpp
>   lldb/trunk/tools/driver/Driver.cpp
>   lldb/trunk/tools/driver/Options.td
>   lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp
>   lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h
>   lldb/trunk/tools/lldb-server/lldb-server.cpp
>   lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp
>   lldb/trunk/tools/lldb-test/SystemInitializerTest.h
>   lldb/trunk/tools/lldb-test/lldb-test.cpp
>   lldb/trunk/unittests/Utility/ReproducerTest.cpp
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190219/aaa1c96f/attachment-0001.html>

More information about the lldb-commits mailing list