Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.
omjavaid added a comment. @sas Ideally it should be thumb-* if an environment is thumb only but lldb right now has some areas where we need to handle this case. Either you put arm-* and leave it for someone else to correct the problems or put thumb-* and fix the issues that come up after that. I think better to take the first option with a note to come back and fix this once other areas in the code are able to handle this. http://reviews.llvm.org/D19604 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15067: Design building out of sources
labath accepted this revision. labath added a comment. Looks good. Repository: rL LLVM http://reviews.llvm.org/D15067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.
rengolin added a comment. In http://reviews.llvm.org/D19604#419284, @sas wrote: > - We don't use thumb-* triples in lldb as far as I can see. Thumb is handled > just fine regardless of the triple. This is a good strategy. Thumb is an instruction set, the "arm-" in the triple means the Architecture. > - `pc` vs `unknown` doesn't seem to matter either, and other code in this > file uses `pc` (see a few lines above). AFAIK, "pc" is accepted but ignored, just like "unknown" and "gobbedygook". > - I could just use `arm` instead of `armv7` but as far as I know, Windows > Phone is a pure thumb environment, so the CPUs used will be armv7 and up. Er, this doesn't make sense. ARM cores support Thumb ever since ARMv4T (ARM7, circa '97). Thumb2, which is the version supported by ARMv7 cores, exists since ARMv6 (ARM11, circa '03). It's best if you keep the triple free of sub-architecture choices and use -march to pick the right one. But some platforms have chosen to specify it on the triple, and we may have to follow suit to be compatible. > - I could add support for aarch64 in this file, but I've got no way of > testing it at the moment, and it seems likes a bad idea to advertise support > for something we can't even test. Agree. > Given all of these, it seems like sticking with `armv7-pc-windows` or using > `arm-pc-windows` might be the better solutions. Let me know what you guys > think. "arm-pc-windows" seems good to me. I'm also ok with "armv7-pc-windows" if that's the "accepted" triple on Windows world. cheers, --renato http://reviews.llvm.org/D19604 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19533: Introduce Connection::ReadAll and fix AdbClient
labath added inline comments. Comment at: source/Plugins/Platform/Android/AdbClient.cpp:37 @@ -36,3 +36,3 @@ -const uint32_t kReadTimeout = 100; // 1 second +const uint32_t kReadTimeout = 400; // 4 seconds const char * kOKAY = "OKAY"; ovyalov wrote: > It might be useful to expose this timeout as a settings property to allow its > customization for slow ADB connections. We can do it later if a need appears, but I don't see how making that a setting -- the value needs to be big enough to work under all circumstances, and in case of normal operation, it will not matter, as the function will return as soon as the data is ready. http://reviews.llvm.org/D19533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r268380 - Add a read_full_buffer argument to ConnectionFileDescriptor::Read
Author: labath Date: Tue May 3 08:55:53 2016 New Revision: 268380 URL: http://llvm.org/viewvc/llvm-project?rev=268380&view=rev Log: Add a read_full_buffer argument to ConnectionFileDescriptor::Read Summary: AdbClient was attempting to handle the case where the socket input arrived in pieces, but it was failing to handle the case where the connection was closed before that happened. In this case, it would just spin in an infinite loop calling Connection::Read. (This was also the cause of the spurious timeouts on the darwin->android buildbot. The exact cause of the premature EOF remains to be investigated, but is likely a server bug.) Since this wait-for-a-certain-number-of-bytes seems like a useful functionality to have, I am moving it (with the infinite loop fixed) to the Connection class, and adding an appropriate test for it. Reviewers: clayborg, zturner, ovyalov Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: http://reviews.llvm.org/D19533 Added: lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp lldb/trunk/unittests/Host/SocketUtil.h Modified: lldb/trunk/include/lldb/Core/Connection.h lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/ConnectionSharedMemory.cpp lldb/trunk/source/Host/common/Editline.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp lldb/trunk/unittests/Host/CMakeLists.txt lldb/trunk/unittests/Host/SocketTest.cpp Modified: lldb/trunk/include/lldb/Core/Connection.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Connection.h?rev=268380&r1=268379&r2=268380&view=diff == --- lldb/trunk/include/lldb/Core/Connection.h (original) +++ lldb/trunk/include/lldb/Core/Connection.h Tue May 3 08:55:53 2016 @@ -114,6 +114,14 @@ public: /// @param[in] timeout_usec /// The number of microseconds to wait for the data. /// +/// @param[in] read_full_buffer +/// If true, continues reading until the specified number of bytes is +/// read or some exceptional event occurs, which would prevent the +/// buffer from being filled (timeout, end of file, I/O error, etc.). +/// If false, the function returns as soon as at least some part of +/// the data is available (traditional behavior of the read system +/// call). +/// /// @param[out] status /// On return, indicates whether the call was successful or terminated /// due to some error condition. @@ -129,11 +137,8 @@ public: /// @see size_t Communication::Read (void *, size_t, uint32_t); //-- virtual size_t -Read (void *dst, - size_t dst_len, - uint32_t timeout_usec, - lldb::ConnectionStatus &status, - Error *error_ptr) = 0; +Read(void *dst, size_t dst_len, uint32_t timeout_usec, bool read_full_buffer, lldb::ConnectionStatus &status, + Error *error_ptr) = 0; //-- /// The actual write function that attempts to write to the Modified: lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h?rev=268380&r1=268379&r2=268380&view=diff == --- lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h (original) +++ lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h Tue May 3 08:55:53 2016 @@ -43,11 +43,8 @@ public: Disconnect (Error *error_ptr) override; size_t -Read (void *dst, - size_t dst_len, - uint32_t timeout_usec, - lldb::ConnectionStatus &status, - Error *error_ptr) override; +Read(void *dst, size_t dst_len, uint32_t timeout_usec, bool read_full_buffer, lldb::ConnectionStatus &status, + Error *error_ptr) override; size_t Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override; Modified: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h?rev=268380&r1=268379&r2=268380&view=diff == --- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h (original) +++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h Tue May 3 08:55:53 2016 @@ -59,7 +59,9 @@ class ConnectionFileDescriptor : public lldb::ConnectionStatus Disconnect(Error *error_ptr) overr
Re: [Lldb-commits] [PATCH] D19533: Introduce Connection::ReadAll and fix AdbClient
This revision was automatically updated to reflect the committed changes. Closed by commit rL268380: Add a read_full_buffer argument to ConnectionFileDescriptor::Read (authored by labath). Changed prior to commit: http://reviews.llvm.org/D19533?vs=55397&id=55986#toc Repository: rL LLVM http://reviews.llvm.org/D19533 Files: lldb/trunk/include/lldb/Core/Connection.h lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/ConnectionSharedMemory.cpp lldb/trunk/source/Host/common/Editline.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp lldb/trunk/unittests/Host/CMakeLists.txt lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp lldb/trunk/unittests/Host/SocketTest.cpp lldb/trunk/unittests/Host/SocketUtil.h Index: lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp === --- lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp +++ lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp @@ -0,0 +1,135 @@ +//===-- ConnectionFileDescriptorPosixTest.cpp ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) +// Workaround for MSVC standard library bug, which fails to include when +// exceptions are disabled. +#include +#endif + +#include "gtest/gtest.h" + +#include "SocketUtil.h" + +#include "lldb/Host/ConnectionFileDescriptor.h" + +using namespace lldb_private; +using namespace lldb; + +class ConnectionFileDescriptorPosixTest : public testing::Test +{ +public: +void +SetUp() override +{ +#if defined(_MSC_VER) +WSADATA data; +::WSAStartup(MAKEWORD(2, 2), &data); +#endif +} + +void +TearDown() override +{ +#if defined(_MSC_VER) +::WSACleanup(); +#endif +} +}; + +TEST_F(ConnectionFileDescriptorPosixTest, ReadAll) +{ +const bool read_full_buffer = true; + +std::unique_ptr socket_a_up; +std::unique_ptr socket_b_up; +std::tie(socket_a_up, socket_b_up) = CreateConnectedTCPSockets(); + +ConnectionFileDescriptor connection_a(socket_a_up.release()); + +// First, make sure Read returns nothing. +const auto k_reasonable_timeout_us = 10 * 1000; +char buffer[100]; +ConnectionStatus status; +Error error; +size_t bytes_read = +connection_a.Read(buffer, sizeof buffer, k_reasonable_timeout_us, read_full_buffer, status, &error); +ASSERT_TRUE(error.Success()) << error.AsCString(); +ASSERT_EQ(eConnectionStatusTimedOut, status); +ASSERT_EQ(0u, bytes_read); + +// Write some data, and make sure it arrives. +const char data[] = {1, 2, 3, 4}; +size_t bytes_written = sizeof data; +error = socket_b_up->Write(data, bytes_written); +ASSERT_TRUE(error.Success()) << error.AsCString(); +ASSERT_EQ(sizeof data, bytes_written); +bytes_read = connection_a.Read(buffer, sizeof data, k_reasonable_timeout_us, read_full_buffer, status, &error); +ASSERT_TRUE(error.Success()) << error.AsCString(); +ASSERT_EQ(eConnectionStatusSuccess, status); +ASSERT_EQ(sizeof data, bytes_read); +ASSERT_EQ(0, memcmp(buffer, data, sizeof data)); +memset(buffer, 0, sizeof buffer); + +// Write the data in two chunks. Make sure we read all of it. +std::future future_error = std::async(std::launch::async, [&socket_b_up, data]() { +size_t bytes_written = sizeof(data) / 2; +Error error = socket_b_up->Write(data, bytes_written); +if (error.Fail()) +return error; +std::this_thread::sleep_for(std::chrono::microseconds(k_reasonable_timeout_us / 10)); +bytes_written = sizeof(data) / 2; +return socket_b_up->Write(data + bytes_written, bytes_written); +}); +bytes_read = connection_a.Read(buffer, sizeof data, k_reasonable_timeout_us, read_full_buffer, status, &error); +ASSERT_TRUE(error.Success()) << error.AsCString(); +ASSERT_EQ(eConnectionStatusSuccess, status); +ASSERT_EQ(sizeof data, bytes_read); +ASSERT_TRUE(future_error.get().Success()) << future_error.get().AsCString(); +ASSERT_EQ(0, memcmp(buffer, data, sizeof data)); + +// Close the remote end, make sure Read result is reasonable. +socket_b_up.reset(); +bytes_read = connection_a.Read(buffer, sizeof buffer, k_reasonable_timeout_us, read_full_buffer, status, &error); +ASSERT_TRUE(error.Success()) << error.AsCString(); +ASSERT_EQ(eConnectionStatusEndOfFile, status); +ASSERT_EQ(0u, bytes_read); +} + +TEST_F(ConnectionFile
[Lldb-commits] [lldb] r268384 - Revert "Add a read_full_buffer argument to ConnectionFileDescriptor::Read"
Author: labath Date: Tue May 3 09:07:41 2016 New Revision: 268384 URL: http://llvm.org/viewvc/llvm-project?rev=268384&view=rev Log: Revert "Add a read_full_buffer argument to ConnectionFileDescriptor::Read" This reverts commit r268380 as it breaks windows build (I forgot to make neccesary adjustments to ConnectionGenericFileWindows). Removed: lldb/trunk/unittests/Host/ConnectionFileDescriptorPosixTest.cpp lldb/trunk/unittests/Host/SocketUtil.h Modified: lldb/trunk/include/lldb/Core/Connection.h lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/ConnectionSharedMemory.cpp lldb/trunk/source/Host/common/Editline.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp lldb/trunk/unittests/Host/CMakeLists.txt lldb/trunk/unittests/Host/SocketTest.cpp Modified: lldb/trunk/include/lldb/Core/Connection.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Connection.h?rev=268384&r1=268383&r2=268384&view=diff == --- lldb/trunk/include/lldb/Core/Connection.h (original) +++ lldb/trunk/include/lldb/Core/Connection.h Tue May 3 09:07:41 2016 @@ -114,14 +114,6 @@ public: /// @param[in] timeout_usec /// The number of microseconds to wait for the data. /// -/// @param[in] read_full_buffer -/// If true, continues reading until the specified number of bytes is -/// read or some exceptional event occurs, which would prevent the -/// buffer from being filled (timeout, end of file, I/O error, etc.). -/// If false, the function returns as soon as at least some part of -/// the data is available (traditional behavior of the read system -/// call). -/// /// @param[out] status /// On return, indicates whether the call was successful or terminated /// due to some error condition. @@ -137,8 +129,11 @@ public: /// @see size_t Communication::Read (void *, size_t, uint32_t); //-- virtual size_t -Read(void *dst, size_t dst_len, uint32_t timeout_usec, bool read_full_buffer, lldb::ConnectionStatus &status, - Error *error_ptr) = 0; +Read (void *dst, + size_t dst_len, + uint32_t timeout_usec, + lldb::ConnectionStatus &status, + Error *error_ptr) = 0; //-- /// The actual write function that attempts to write to the Modified: lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h?rev=268384&r1=268383&r2=268384&view=diff == --- lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h (original) +++ lldb/trunk/include/lldb/Core/ConnectionSharedMemory.h Tue May 3 09:07:41 2016 @@ -43,8 +43,11 @@ public: Disconnect (Error *error_ptr) override; size_t -Read(void *dst, size_t dst_len, uint32_t timeout_usec, bool read_full_buffer, lldb::ConnectionStatus &status, - Error *error_ptr) override; +Read (void *dst, + size_t dst_len, + uint32_t timeout_usec, + lldb::ConnectionStatus &status, + Error *error_ptr) override; size_t Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override; Modified: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h?rev=268384&r1=268383&r2=268384&view=diff == --- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h (original) +++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h Tue May 3 09:07:41 2016 @@ -59,9 +59,7 @@ class ConnectionFileDescriptor : public lldb::ConnectionStatus Disconnect(Error *error_ptr) override; -size_t -Read(void *dst, size_t dst_len, uint32_t timeout_usec, bool read_full_buffer, lldb::ConnectionStatus &status, - Error *error_ptr) override; +size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override; size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override; Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=268384&r1=268383&r2=268384&view=diff ===
Re: [Lldb-commits] [PATCH] D19533: Introduce Connection::ReadAll and fix AdbClient
labath added a comment. This is going to be messier than I expected. I would need to introduce the same repeat-until-the-buffer-is-full loop into ConnectionGenericFileWindows, which I don't think is good for code reuse. I see two possibilities: - go back to the version with a separate function for this behavior (with the timeout problem fixed) - keep the fix completely within the AdbClient class. Which one do you prefer? Repository: rL LLVM http://reviews.llvm.org/D19533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15067: Design building out of sources
krytarowski added a comment. In http://reviews.llvm.org/D15067#419632, @labath wrote: > Looks good. Thanks! Are you accepting it with the patch in `scripts/CMakeLists.txt` as noted in the comment? Repository: rL LLVM http://reviews.llvm.org/D15067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15067: Design building out of sources
labath added a comment. Good question. I don't really have an opinion on that... Is it just that single line? (this would be simpler if you uploaded the final version :) ). If it just that single line, then I think it's fine. If you also need to play with the ADDITIONAL_VERSIONS and such, then we should think about making a macro or doing something else to avoid code duplication (there is already a FIXME in scripts/Python/modules/readline mentioning the additional versions). Repository: rL LLVM http://reviews.llvm.org/D15067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r268397 - Split out console and file writing cases in TestCommandScriptImmediateOutput
Author: fjricci Date: Tue May 3 11:31:36 2016 New Revision: 268397 URL: http://llvm.org/viewvc/llvm-project?rev=268397&view=rev Log: Split out console and file writing cases in TestCommandScriptImmediateOutput Summary: As these are really testing separate issues, they should be run as separate tests. Reviewers: zturner, granata.enrico, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D19690 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py?rev=268397&r1=268396&r2=268397&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py Tue May 3 11:31:36 2016 @@ -24,17 +24,25 @@ class CommandScriptImmediateOutputTestCa @skipIfRemote # test not remote-ready llvm.org/pr24813 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139") -def test_command_script_immediate_output (self): -"""Test that LLDB correctly allows scripted commands to set an immediate output file.""" -self.launch(timeout=60) +def test_command_script_immediate_output_console (self): +"""Test that LLDB correctly allows scripted commands to set immediate output to the console.""" +self.launch(timeout=10) script = os.path.join(os.getcwd(), 'custom_command.py') prompt = "\(lldb\) " - + self.sendline('command script import %s' % script, patterns=[prompt]) self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt]) self.sendline('mycommand', patterns='this is a test string, just a test string') self.sendline('command script delete mycommand', patterns=[prompt]) +self.quit(gracefully=False) + +@skipIfRemote # test not remote-ready llvm.org/pr24813 +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") +@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139") +def test_command_script_immediate_output_file (self): +"""Test that LLDB correctly allows scripted commands to set immediate output to a file.""" +self.launch(timeout=10) test_files = {os.path.join(os.getcwd(), 'read.txt'):'r', os.path.join(os.getcwd(), 'write.txt') :'w', @@ -50,6 +58,11 @@ class CommandScriptImmediateOutputTestCa with open(path, 'w+') as init: init.write(starter_string) +script = os.path.join(os.getcwd(), 'custom_command.py') +prompt = "\(lldb\) " + +self.sendline('command script import %s' % script, patterns=[prompt]) + self.sendline('command script add -f custom_command.write_file mywrite', patterns=[prompt]) for path, mode in test_files.iteritems(): command = 'mywrite "' + path + '" ' + mode ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19608: Checkout release_38 branches of llvm and clang when building lldb 3.8
sas accepted this revision. sas added a reviewer: sas. sas added a comment. This revision is now accepted and ready to land. I did the same thing back when 3.7 was the current release branch and I think @clayborg reviewed it at that point. Without this, we simply can't build the release branch. http://reviews.llvm.org/D19608 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19690: Split out console and file writing cases in TestCommandScriptImmediateOutput
This revision was automatically updated to reflect the committed changes. Closed by commit rL268397: Split out console and file writing cases in TestCommandScriptImmediateOutput (authored by fjricci). Changed prior to commit: http://reviews.llvm.org/D19690?vs=55619&id=56020#toc Repository: rL LLVM http://reviews.llvm.org/D19690 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py @@ -24,17 +24,25 @@ @skipIfRemote # test not remote-ready llvm.org/pr24813 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139") -def test_command_script_immediate_output (self): -"""Test that LLDB correctly allows scripted commands to set an immediate output file.""" -self.launch(timeout=60) +def test_command_script_immediate_output_console (self): +"""Test that LLDB correctly allows scripted commands to set immediate output to the console.""" +self.launch(timeout=10) script = os.path.join(os.getcwd(), 'custom_command.py') prompt = "\(lldb\) " - + self.sendline('command script import %s' % script, patterns=[prompt]) self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt]) self.sendline('mycommand', patterns='this is a test string, just a test string') self.sendline('command script delete mycommand', patterns=[prompt]) +self.quit(gracefully=False) + +@skipIfRemote # test not remote-ready llvm.org/pr24813 +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") +@expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139") +def test_command_script_immediate_output_file (self): +"""Test that LLDB correctly allows scripted commands to set immediate output to a file.""" +self.launch(timeout=10) test_files = {os.path.join(os.getcwd(), 'read.txt'):'r', os.path.join(os.getcwd(), 'write.txt') :'w', @@ -50,6 +58,11 @@ with open(path, 'w+') as init: init.write(starter_string) +script = os.path.join(os.getcwd(), 'custom_command.py') +prompt = "\(lldb\) " + +self.sendline('command script import %s' % script, patterns=[prompt]) + self.sendline('command script add -f custom_command.write_file mywrite', patterns=[prompt]) for path, mode in test_files.iteritems(): command = 'mywrite "' + path + '" ' + mode Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py @@ -24,17 +24,25 @@ @skipIfRemote # test not remote-ready llvm.org/pr24813 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @expectedFailureAll(oslist=["freebsd","linux"], bugnumber="llvm.org/pr26139") -def test_command_script_immediate_output (self): -"""Test that LLDB correctly allows scripted commands to set an immediate output file.""" -self.launch(timeout=60) +def test_command_script_immediate_output_console (self): +"""Test that LLDB correctly allows scripted commands to set immediate output to the console.""" +self.launch(timeout=10) script = os.path.join(os.getcwd(), 'custom_command.py') prompt = "\(lldb\) " - + self.sendline('command script import %s' % script, patterns=[prompt]) self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt]) self.sendline('mycommand', patterns='this is a test string, just a test string') self.sendline('command script delete mycommand', patterns=[prompt]) +self.quit(gracefully=False) + +@skipIfRemote # test not remot
Re: [Lldb-commits] [PATCH] D19606: XFail TestLambdas.py on Windows after fixing some of the problems
amccarth added a comment. Zach is hoping to enable tests on our Windows build bot this week, so I'd like to land this in the next day or two if possible. If not, I can just xfail this test on Windows and postpone the other fixes until there's more time for a review. Thanks. http://reviews.llvm.org/D19606 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19533: Introduce Connection::ReadAll and fix AdbClient
clayborg added a comment. I would prefer a fix in the ADB client only if I had to pick. I don't think anyone else will use this functionality and prefer to the keep the API as simple as possible for Connection subclasses. Repository: rL LLVM http://reviews.llvm.org/D19533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r268433 - Added a testcase for the ptr_refs tool so we catch if it stops working.
Author: spyffe Date: Tue May 3 15:36:06 2016 New Revision: 268433 URL: http://llvm.org/viewvc/llvm-project?rev=268433&view=rev Log: Added a testcase for the ptr_refs tool so we catch if it stops working. Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile?rev=268433&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile Tue May 3 15:36:06 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py?rev=268433&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py Tue May 3 15:36:06 2016 @@ -0,0 +1,43 @@ +""" +Test the ptr_refs tool on Darwin +""" + +from __future__ import print_function + +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestPtrRefs(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +def test_ptr_refs(self): +"""Test format string functionality.""" +self.build() +exe_name = 'a.out' +exe = os.path.join(os.getcwd(), exe_name) + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +main_file_spec = lldb.SBFileSpec ('main.c') +breakpoint = target.BreakpointCreateBySourceRegex('break', main_file_spec) +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +process = target.LaunchSimple (None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +# Frame #0 should be on self.line1 and the break condition should hold. +thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) +self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition") + +frame = thread.GetFrameAtIndex(0) + +self.dbg.HandleCommand("script import lldb.macosx.heap") +self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"]); Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c?rev=268433&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c Tue May 3 15:36:06 2016 @@ -0,0 +1,27 @@ +//===-- main.c --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include +#include +#include + +struct referent { +const char *p; +}; + +int main (int argc, char const *argv[]) +{ +const char *my_ptr = strdup("hello"); +struct referent *r = malloc(sizeof(struct referent)); +r->p = my_ptr; + +printf("%p\n", r); // break here + +return 0; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r268467 - You have to call setHasLoadedFieldsFromExternalStorage AFTER calling
Author: jingham Date: Tue May 3 19:06:23 2016 New Revision: 268467 URL: http://llvm.org/viewvc/llvm-project?rev=268467&view=rev Log: You have to call setHasLoadedFieldsFromExternalStorage AFTER calling the field_begin that starts the copy or it won't do anything. This causes failures, but only in complex apps, I haven't found a reduced test case for this yet. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=268467&r1=268466&r2=268467&view=diff == --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue May 3 19:06:23 2016 @@ -2618,8 +2618,8 @@ GetCompleteQualType (clang::ASTContext * external_ast_source->CompleteType(cxx_record_decl); if (cxx_record_decl->isCompleteDefinition()) { - cxx_record_decl->setHasLoadedFieldsFromExternalStorage (true); cxx_record_decl->field_begin(); + cxx_record_decl->setHasLoadedFieldsFromExternalStorage (true); } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.
jasonmolenda added a subscriber: jasonmolenda. jasonmolenda added a comment. fwiw, there are ARM cores that only support thumb - the Cortex M series. I doubt a windows phone is running one of those low-power chips though. The importance of the triple used will come in to play when you try to evaluate an expression on the device -- lldb will call into llvm to parse/jit the expression into machine code for the device. For instance, if "arm-windows" translates to a minimum arm target, llvm may not think it has any fp/NEON instructions. As for lldb disassembling as arm/thumb (or instruction emulation for unwinding), today it doesn't use the CPSR/XPSR T bit to tell if the current instruction is thumb or not, it depends on annotations in the symbol file to do this correctly. I don't think it uses the 0th bit of saved pc values up the stack to tell this either -- it is a pretty fixed model of depending on the symbols to indicate whether they're arm or thumb. If you look in the disassembler, lldb creates both an armv7 MCDisassembler and a thumbv7 MCDisassembler and picks one or the other depending on the symbol's "alternate ISA" flag or something along those lines. http://reviews.llvm.org/D19604 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r268475 - Add a way for an ObjectFile to indicate that assembly emulation
Author: jmolenda Date: Tue May 3 22:09:40 2016 New Revision: 268475 URL: http://llvm.org/viewvc/llvm-project?rev=268475&view=rev Log: Add a way for an ObjectFile to indicate that assembly emulation should not be used for this module -- for use when an ObjectFile knows that it does not have meaningful or accurate function start addresses. More commonly, it is not clear that function start addresses are missing in a module. There are certain cases on Mac OS X where we can tell that a Mach-O binary has been stripped of this essential information, and the unwinder can end up emulating many megabytes of instructions for a single "function" in the binary. When a Mach-O binary is missing both an LC_FUNCTION_STARTS load command (very unusual) and an eh_frame section, then we will assume it has also been stripped of symbols and that instruction emulation will not be useful on this module. Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/include/lldb/Symbol/UnwindTable.h lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/UnwindTable.cpp Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=268475&r1=268474&r2=268475&view=diff == --- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original) +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Tue May 3 22:09:40 2016 @@ -551,6 +551,35 @@ public: GetUnwindTable () { return m_unwind_table; } //-- +/// Returns if the function bounds for symbols in this symbol file +/// are likely accurate. +/// +/// The unwinder can emulate the instructions of functions to understand +/// prologue/epilogue code sequences, where registers are spilled on +/// the stack, etc. This feature relies on having the correct start +/// addresses of all functions. If the ObjectFile has a way to tell +/// that symbols have been stripped and there's no way to reconstruct +/// start addresses (e.g. LC_FUNCTION_STARTS on Mach-O, or eh_frame +/// unwind info), the ObjectFile should indicate that assembly emulation +/// should not be used for this module. +/// +/// It is uncommon for this to return false. An ObjectFile needs to +/// be sure that symbol start addresses are unavailable before false +/// is returned. If it is unclear, this should return true. +/// +/// @return +/// Returns true if assembly emulation should be used for this +/// module. +/// Only returns false if the ObjectFile is sure that symbol +/// addresses are insufficient for accurate assembly emulation. +//-- +virtual bool +AllowAssemblyEmulationUnwindPlans () +{ +return true; +} + +//-- /// Similar to Process::GetImageInfoAddress(). /// /// Some platforms embed auxiliary structures useful to debuggers in the Modified: lldb/trunk/include/lldb/Symbol/UnwindTable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindTable.h?rev=268475&r1=268474&r2=268475&view=diff == --- lldb/trunk/include/lldb/Symbol/UnwindTable.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindTable.h Tue May 3 22:09:40 2016 @@ -40,6 +40,9 @@ public: lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc); +bool +GetAllowAssemblyEmulationUnwindPlans (); + // Normally when we create a new FuncUnwinders object we track it in this UnwindTable so it can // be reused later. But for the target modules show-unwind we want to create brand new // UnwindPlans for the function of interest - so ignore any existing FuncUnwinders for that Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=268475&r1=268474&r2=268475&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue May 3 22:09:40 2016 @@ -1130,7 +1130,9 @@ ObjectFileMachO::ObjectFileMachO(const l m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(), -m_thread_context_offsets_valid(false) +m_thread_context_offsets_valid(false), +m_reexported_dylibs (), +m_allow_assembly_emulation_unwind_