Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/lit.local.cfg =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.dexter'] Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/construct.cpp =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/construct.cpp @@ -0,0 +1,6 @@ +#include "theclass.h" + +foo *makeFoo() { + return new foo(); +} + Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/main.cpp =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/main.cpp @@ -0,0 +1,50 @@ +#include +#include + +#include "theclass.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int main() { + foo *bar = makeFoo(); + std::cout << bar->asString() << std::endl; // DexLabel("output_line") + delete bar; + return 0; +} + +std::string foo::asString() const { + using namespace std::string_literals; + return "a "s + std::to_string(a) + " b "s + std::to_string(b); // DexLabel('str') +} + +/* + +We should be able to see the fields of bar even with constructor homing, + +DexExpectWatchValue('bar->a', 1, on_line="output_line") +DexExpectWatchValue('bar->b', 2, on_line="output_line") + +Check that we can step into asString too and look at the fields. + +DexExpectProgramState({ + 'frames': [ + { + 'location': { + 'lineno': 'str' + }, + 'function': 'asString', + 'watches': { + 'a': '1', + 'b': '2' + } + }, + { + 'location': { + 'lineno': 'output_line' + } + } + ] +}) +*/ + Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/test.cfg =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/test.cfg @@ -0,0 +1 @@ +This space intentionally left blank. (Enables Dexter directory based tests). Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/theclass.h =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/theclass.h @@ -0,0 +1,15 @@ +#include + +class foo { +public: + int a; + int b; + + foo() : a(1), b(2) { } + + ~foo() { } + + std::string asString() const; +}; + +foo *makeFoo(); Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/unix.dexter =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/unix.dexter @@ -0,0 +1,10 @@ +// UNSUPPORTED: system-windows +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' \ +// RUN: --cflags "-O0 -g -std=c++14 -Xclang -fuse-ctor-homing" -- %s/.. + +// And again under LTO with opts: + +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --ldflags="-flto -fuse-ld=lld" \ +// RUN: --cflags "-O2 -g -std=c++14 -Xclang -fuse-ctor-homing -flto" -- %s/.. Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/win.dexter =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/partial-type/win.dexter @@ -0,0 +1,11 @@ +// UNSUPPORTED: !system-windows +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'dbgeng' --ldflags="-g"\ +// RUN: --cflags "-O0 -g -std=c++14 -Xclang -fuse-ctor-homing" -- %s/.. + +// Running under LTO currently fails -- none of the local variables appear +// to be present. + +// run: %dexter --fail-lt 1.0 -w \ +// run: --builder 'clang' --debugger 'dbgeng' --ldflags="-flto -g" \ +// run: --cflags "-O2 -g -std=c++14 -Xclang -fuse-ctor-homing -flto" -- %s/.. Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/construct.cpp =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/construct.cpp @@ -0,0 +1,15 @@ +#include "theclass.h" + +foo::foo() : a(1), b(2) { } + +foo::~foo() { } + +foo *makeFoo() { + return new foo(); +} + +std::string foo::asString() const { + using namespace std::string_literals; + return "a "s + std::to_string(a) + " b "s + std::to_string(b); +} + Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/main.cpp =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/main.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include "theclass.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int main() { + foo *bar = makeFoo(); + std::cout << bar->asString() << std::endl; // DexLabel("output_line") + delete bar; + return 0; +} + +/* + +We should be able to see the fields of bar even with constructor homing, + +DexExpectWatchValue('bar->a', 1, on_line="output_line") +DexExpectWatchValue('bar->b', 2, on_line="output_line") + +Check that we can step into asString too and look at the fields. + +DexExpectProgramState({ + 'frames': [ + { + 'location': { + 'lineno': 13 + }, + 'function': 'asString', + 'watches': { + 'a': '1', + 'b': '2' + } + }, + { + 'location': { + 'lineno': 'output_line' + } + } + ] +}) +*/ + Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/test.cfg =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/test.cfg @@ -0,0 +1 @@ +This space intentionally left blank. (Enables Dexter directory based tests). Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/theclass.h =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/theclass.h @@ -0,0 +1,15 @@ +#include + +class foo { +public: + int a; + int b; + + foo(); + + ~foo(); + + std::string asString() const; +}; + +foo *makeFoo(); Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/unix.dexter =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/unix.dexter @@ -0,0 +1,10 @@ +// UNSUPPORTED: system-windows +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' \ +// RUN: --cflags "-O0 -g -std=c++14 -Xclang -fuse-ctor-homing" -- %s/.. + +// And again under LTO with opts: + +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --ldflags="-flto -fuse-ld=lld" \ +// RUN: --cflags "-O2 -g -std=c++14 -Xclang -fuse-ctor-homing -flto" -- %s/.. Index: debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/win.dexter =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/debug-info-kind-cons/simple/win.dexter @@ -0,0 +1,11 @@ +// UNSUPPORTED: !system-windows +// RUN: %dexter --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'dbgeng' --ldflags="-g"\ +// RUN: --cflags "-O0 -g -std=c++14 -Xclang -fuse-ctor-homing" -- %s/.. + +// Running under LTO currently fails -- none of the local variables appear +// to be present. + +// run: %dexter --fail-lt 1.0 -w \ +// run: --builder 'clang' --debugger 'dbgeng' --ldflags="-flto -g" \ +// run: --cflags "-O2 -g -std=c++14 -Xclang -fuse-ctor-homing -flto" -- %s/..