[lldb] Delete more mydir references (NFC)
[lldb/test] Add a couple of libc++ std::string layouts.. to the "string simulator" test. These layouts were used at some point inthe past few months, and are already supported by the code.
[lldb] Add tests which simulate the various std::string layoutsChecking whether a formatter change does not break some of the supportedstring layouts is difficult because it requires tracking down
[lldb] Add tests which simulate the various std::string layoutsChecking whether a formatter change does not break some of the supportedstring layouts is difficult because it requires tracking down and/orbuilding different versions and build configurations of the library.The purpose of this patch is to avoid that by providing an in-treesimulation of the string class. It is a reduced version of the realstring class, obtained by elimitating all non-trivial code, leavingjust the internal data structures used by the data formatter. Differentversions of the class can be simulated through preprocessor defines.The test (ab)uses the fact that our formatters kick in for anydouble-underscore sub-namespace of `std`, so it avoids colliding withthe real string class by declaring the test class in the std::__lldbnamespace.I do not consider this to be a replacement for the existing dataformatter tests, as producing this kind of a test is not trivial, and itis easy to make a mistake in the process. However, it's also notrealistic to expect that every person changing the data formatter willtest it against all versions of the real class, so I think it can beuseful as a first line of defence.Adding support for new layouts can become particularly unwieldy, butthis complexity will also be reflected in the actual code, so if we findourselves needing to support too many variants, we may need to startdropping support for old ones, or come up with a completely differentstrategy.Differential Revision: https://reviews.llvm.org/D124155
show more ...
[lldb][tests] Automatically call compute_mydir (NFC)Eliminate boilerplate of having each test manually assign to `mydir` by calling`compute_mydir` in lldbtest.py.Differential Revision: https://r
[lldb][tests] Automatically call compute_mydir (NFC)Eliminate boilerplate of having each test manually assign to `mydir` by calling`compute_mydir` in lldbtest.py.Differential Revision: https://reviews.llvm.org/D128077
Fix the std::string formatter to report errors in the case where thestring points to unaccessible memory.The formatter tries to get the data field of the std::string, and tocheck whether that fai
Fix the std::string formatter to report errors in the case where thestring points to unaccessible memory.The formatter tries to get the data field of the std::string, and tocheck whether that fails it just checks that the ValueObjectSPreturned is not empty. But we never return empty ValueObjectSP's toindicate failure, since doing so would lose the Error object thattells you why fetching the ValueObject failed.This patch adds a check for ValueObject::GetError().Success().I also added a test case for this failure, and reworked the test casea bit (to use run_to_source_breakpoint). I also renamed a couple ofsingle letter locals which don't follow the lldb coding conventions.Differential Revision: https://reviews.llvm.org/D108228
[lldb/DataFormatters] Display null C++ pointers as nullptrDisplay null pointer as `nullptr`, `nil` and `NULL` for C++,Objective-C/Objective-C++ and C respectively. The original motivationfor this
[lldb/DataFormatters] Display null C++ pointers as nullptrDisplay null pointer as `nullptr`, `nil` and `NULL` for C++,Objective-C/Objective-C++ and C respectively. The original motivationfor this patch was to display a null std::string pointer as nullptrinstead of "", but the fix seemed generic enough to be done for allsummary providers.Differential revision: https://reviews.llvm.org/D77153
[lldb] Introduce a LLDB printing policy for Clang type names that suppressed inline namespacesCommit 5f12f4ff9078455cad9d4806da01f570553a5bf9 made suppressing inline namespaceswhen printing typena
[lldb] Introduce a LLDB printing policy for Clang type names that suppressed inline namespacesCommit 5f12f4ff9078455cad9d4806da01f570553a5bf9 made suppressing inline namespaceswhen printing typenames default to true. As we're using the inline namespacesin LLDB to construct internal type names (which need internal namespaces in themto, for example, differentiate libc++'s std::__1::string from the std::stringfrom libstdc++), this broke most of the type formatting logic.
[lldb/StringPrinter] Support strings with invalid utf8 sub-sequencesSupport printing strings which contain invalid utf8 sub-sequences, e.g.strings like "hello world \xfe", instead of bailing out w
[lldb/StringPrinter] Support strings with invalid utf8 sub-sequencesSupport printing strings which contain invalid utf8 sub-sequences, e.g.strings like "hello world \xfe", instead of bailing out with "SummaryUnavailable".I took the opportunity here to delete some hand-rolled utf8 -> utf32conversion code and replace it with calls into llvm's Support library.rdar://61554346
[lldb/test] Tweak libcxx string test on Apple+ARM devicesOn Apple platforms, is __arm__ isn't defined and we're not on Intel, we use analternate std::string layout. I.e., the libcxx string test fa
[lldb/test] Tweak libcxx string test on Apple+ARM devicesOn Apple platforms, is __arm__ isn't defined and we're not on Intel, we use analternate std::string layout. I.e., the libcxx string test fails on phonesbecause the hand-crafted "garbage" string structs are actually valid strings.See:``` // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \ defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif```Disable inspection of the garbage structs on Apple+ARM devices.
[lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.Summary:Currently when printing data types we include implicit scopes such as inline namespaces or anonymous n
[lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.Summary:Currently when printing data types we include implicit scopes such as inline namespaces or anonymous namespaces.This leads to command output like this (for `std::set<X>` with X being in an anonymous namespace):```(lldb) print my_set(std::__1::set<(anonymous namespace)::X, std::__1::less<(anonymous namespace)::X>, std::__1::allocator<(anonymous namespace)::X> >) $0 = size=0 {}```This patch removes all the implicit scopes when printing type names in TypeSystemClang::GetDisplayTypeNameso that our output now looks like this:```(lldb) print my_set(std::set<X, std::less<X>, std::allocator<X> >) $0 = size=0 {}```As previously GetDisplayTypeName and GetTypeName had the same output we actually often used thetwo as if they are the same method (they were in fact using the same implementation), so this patch alsofixes the places where we actually want the display type name and not the actual type name.Note that this doesn't touch the `GetTypeName` class that for example the data formatters use, so this patchis only changes the way we display types to the user. The full type name can also still be found when passing'-R' to see the raw output of a variable in case someone is somehow interested in that.Partly fixes rdar://problem/59292534Reviewers: shafik, jinghamReviewed By: shafikSubscribers: christof, JDevlieghere, lldb-commitsTags: #lldbDifferential Revision: https://reviews.llvm.org/D74478
[lldb/StringPrinter] Avoid reading garbage in uninitialized stringsThis patch fixes a few related out-of-bounds read bugs in thestring data formatters. These issues have to do with mishandling of
[lldb/StringPrinter] Avoid reading garbage in uninitialized stringsThis patch fixes a few related out-of-bounds read bugs in thestring data formatters. These issues have to do with mishandling of un-initialized strings. These manifest as ASan exceptions when debugging aclang binary.The first issue was that the std::string formatter treated strings in"short mode" with length greater than the size of the inline buffer asvalid.The second issue was that the StringPrinter facility did not check thata full utf8 codepoint sequence can be read from the buffer (i.e. thereare some missing range checks). I took the opportunity here to deletesome untested code that was meant to deal with invalid input and replaceit with fail-on-invalid logic ([1][2][3]). This means we'll give up onformatting an invalid string instead of guessing our way through it.The third issue is that StringPrinter did not check that a utf8 sequencecould actually be fully read from the string payload. This one is especiallytricky as we may overflow the buffer pointer while reading the sequence.I also noticed that the std::string formatter would spew the raw version ofthe underlying ValueObject when garbage is detected. I've changed this tojust print "Summary Unavailable" instead, as we do elsewhere.I've added regression tests for these issues totest/functionalities/data-formatter/data-formatter-stl/libcxx/string.[1]http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L136[2]http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L163[3]http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L357rdar://59080026Differential Revision: https://reviews.llvm.org/D73860
[lldb][test] Remove symlink for API tests.Summary: Moves lldbsuite tests to lldb/test/API.This is a largely mechanical change, moved with the following steps:```rm lldb/test/API/testcasesmkdi
[lldb][test] Remove symlink for API tests.Summary: Moves lldbsuite tests to lldb/test/API.This is a largely mechanical change, moved with the following steps:```rm lldb/test/API/testcasesmkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runnerfor d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; donefor d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; donefor d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done```lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.Reviewers: labath, JDevlieghereTags: #lldbDifferential Revision: https://reviews.llvm.org/D71151