[Lldb-commits] [lldb] r358846 - modify-python-lldb.py: Remove docstring formatting code
Author: labath Date: Sun Apr 21 05:48:53 2019 New Revision: 358846 URL: http://llvm.org/viewvc/llvm-project?rev=358846&view=rev Log: modify-python-lldb.py: Remove docstring formatting code The strings have been already cleaned up in r358683, so this code is not doing anything anymore. While comparing the outputs before and after removing the formatting code, I've found a couple of docstrings that managed to escape my perl script in r358683, so I format them manually with this patch. Modified: lldb/trunk/scripts/Python/modify-python-lldb.py lldb/trunk/scripts/interface/SBProcess.i lldb/trunk/scripts/interface/SBTarget.i Modified: lldb/trunk/scripts/Python/modify-python-lldb.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=358846&r1=358845&r2=358846&view=diff == --- lldb/trunk/scripts/Python/modify-python-lldb.py (original) +++ lldb/trunk/scripts/Python/modify-python-lldb.py Sun Apr 21 05:48:53 2019 @@ -43,9 +43,6 @@ else: # # Residues to be removed. # -c_comment_marker = "//" -# The pattern for recognizing the doxygen comment block line. -doxygen_comment_start = re.compile("^\s*(/// ?)") # The demarcation point for turning on/off residue removal state. # When bracketed by the lines, the CLEANUP_DOCSTRING state (see below) is ON. toggle_docstring_cleanup_line = '"""' @@ -119,25 +116,14 @@ for line in content.splitlines(): if line == toggle_docstring_cleanup_line: if state & CLEANUP_DOCSTRING: -# Special handling of the trailing blank line right before the '"""' -# end docstring marker. -new_content.del_blank_line() state ^= CLEANUP_DOCSTRING else: state |= CLEANUP_DOCSTRING if (state & CLEANUP_DOCSTRING): -# Remove the comment marker line. -if c_comment_marker in line: -continue - -# Also remove the '\a ' and '\b 'substrings. +# Remove the '\a ' and '\b 'substrings. line = line.replace('\a ', '') line = line.replace('\b ', '') -# And the leading '///' substring. -doxygen_comment_match = doxygen_comment_start.match(line) -if doxygen_comment_match: -line = line.replace(doxygen_comment_match.group(1), '', 1) line = char_to_str_xform(line) Modified: lldb/trunk/scripts/interface/SBProcess.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBProcess.i?rev=358846&r1=358845&r2=358846&view=diff == --- lldb/trunk/scripts/interface/SBProcess.i (original) +++ lldb/trunk/scripts/interface/SBProcess.i Sun Apr 21 05:48:53 2019 @@ -289,8 +289,7 @@ public: if error.Success(): print('integer: %u' % uint) else -print('error: ', error) -") ReadUnsignedFromMemory; +print('error: ', error)") ReadUnsignedFromMemory; uint64_t ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error); @@ -304,8 +303,7 @@ public: if error.Success(): print('pointer: 0x%x' % ptr) else -print('error: ', error) -") ReadPointerFromMemory; +print('error: ', error)") ReadPointerFromMemory; lldb::addr_t ReadPointerFromMemory (addr_t addr, lldb::SBError &error); Modified: lldb/trunk/scripts/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=358846&r1=358845&r2=358846&view=diff == --- lldb/trunk/scripts/interface/SBTarget.i (original) +++ lldb/trunk/scripts/interface/SBTarget.i Sun Apr 21 05:48:53 2019 @@ -180,7 +180,6 @@ public: @return A process object for the newly created process. -//-- For example, @@ -232,7 +231,6 @@ public: @return A process object for the newly created process. -//-- For example, @@ -260,7 +258,6 @@ public: @return A process object for the newly created core file. -//-- For example, @@ -688,63 +685,63 @@ public: BreakpointCreateBySBAddress (SBAddress &sb_address); %feature("docstring", " - /// Create a breakpoint using a scripted resolver. - /// - /// @param[in] class_name - ///This is the name of the class that implements a scripted resolver. - ///The class should have the following signature: - ///class Resolver: - ///def __init__(self, bkpt, extra_args): - ///# bkpt - the breakpoint for which this is the resolver. When - ///# the resolver finds an interesting address, call AddLocation
[Lldb-commits] [lldb] r358848 - @skipIfLinux flaky lldb-mi tests
Author: labath Date: Sun Apr 21 06:02:49 2019 New Revision: 358848 URL: http://llvm.org/viewvc/llvm-project?rev=358848&view=rev Log: @skipIfLinux flaky lldb-mi tests Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py?rev=358848&r1=358847&r2=358848&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py Sun Apr 21 06:02:49 2019 @@ -19,6 +19,7 @@ class MiSignalTestCase(lldbmi_testcase.M @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions @expectedFailureNetBSD @skipIfRemote # We do not currently support remote debugging via the MI. +@skipIfLinux def test_lldbmi_stopped_when_interrupt(self): """Test that 'lldb-mi --interpreter' interrupt and resume a looping app.""" Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=358848&r1=358847&r2=358848&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py Sun Apr 21 06:02:49 2019 @@ -261,6 +261,7 @@ class MiStartupOptionsTestCase(lldbmi_te @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfDarwin +@skipIfLinux def test_lldbmi_log_option(self): """Test that 'lldb-mi --log' creates a log file in the current directory.""" Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=358848&r1=358847&r2=358848&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py Sun Apr 21 06:02:49 2019 @@ -20,6 +20,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfRemote # We do not currently support remote debugging via the MI. @skipIfDarwin +@skipIfLinux def test_lldbmi_tokens(self): """Test that 'lldb-mi --interpreter' prints command tokens.""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r358847 - Make TestVSCode_step pass reliably
Author: labath Date: Sun Apr 21 06:02:41 2019 New Revision: 358847 URL: http://llvm.org/viewvc/llvm-project?rev=358847&view=rev Log: Make TestVSCode_step pass reliably Summary: The test was failing occasionally (1% of runs or so), because of unpredictable timings between the two threads spawned by the test. If the second thread hit the breakpoint right as we were stepping out of the function on the first thread, we would still be stuck at the inner frame when the process stopped. This would cause errors like: File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm/tools/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py", line 67, in test_step self.assertEqual(x1, x3, 'verify step out variable') AssertionError: 2 != 1 : verify step out variable AFAICT, lldb-vscode is doing the right thing here, and the problem is that the test is not taking this sequence of events into account. Since the test is about testing stepping, it does not seem necessary to have threads in the inferior at all, so I just rewrite the test to execute the code we're supposed to step through directly on the main thread. Reviewers: clayborg, jgorbe Subscribers: jfb, lldb-commits Differential Revision: https://reviews.llvm.org/D60608 Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp?rev=358847&r1=358846&r2=358847&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp Sun Apr 21 06:02:41 2019 @@ -1,5 +1,3 @@ -#include - int function(int x) { if ((x % 2) == 0) return function(x-1) + x; // breakpoint 1 @@ -8,9 +6,5 @@ int function(int x) { } int main(int argc, char const *argv[]) { - std::thread thread1(function, 2); - std::thread thread2(function, 4); - thread1.join(); - thread2.join(); - return 0; + return function(2); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60608: Make TestVSCode_step pass reliably
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL358847: Make TestVSCode_step pass reliably (authored by labath, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60608/new/ https://reviews.llvm.org/D60608 Files: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp @@ -1,5 +1,3 @@ -#include - int function(int x) { if ((x % 2) == 0) return function(x-1) + x; // breakpoint 1 @@ -8,9 +6,5 @@ } int main(int argc, char const *argv[]) { - std::thread thread1(function, 2); - std::thread thread2(function, 4); - thread1.join(); - thread2.join(); - return 0; + return function(2); } Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/step/main.cpp @@ -1,5 +1,3 @@ -#include - int function(int x) { if ((x % 2) == 0) return function(x-1) + x; // breakpoint 1 @@ -8,9 +6,5 @@ } int main(int argc, char const *argv[]) { - std::thread thread1(function, 2); - std::thread thread2(function, 4); - thread1.join(); - thread2.join(); - return 0; + return function(2); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r358850 - Minidump: yamlify module-related unit tests
Author: labath Date: Sun Apr 21 06:12:40 2019 New Revision: 358850 URL: http://llvm.org/viewvc/llvm-project?rev=358850&view=rev Log: Minidump: yamlify module-related unit tests The tests reading the untouched module list are now not using any lldb code (as module list loading lives in llvm now), so they can be removed. The "filtering" of the module list remains (and probably will remain) an lldb concept, so I keep those tests, but replace the checked-in binaries with their yaml equivalents. The binaries which are no longer referenced by any tests have been removed. Removed: lldb/trunk/unittests/Process/minidump/Inputs/module-list-not-padded.dmp lldb/trunk/unittests/Process/minidump/Inputs/module-list-padded.dmp lldb/trunk/unittests/Process/minidump/Inputs/modules-dup-min-addr.dmp lldb/trunk/unittests/Process/minidump/Inputs/modules-order.dmp Modified: lldb/trunk/unittests/Process/minidump/CMakeLists.txt lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/unittests/Process/minidump/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/CMakeLists.txt?rev=358850&r1=358849&r2=358850&view=diff == --- lldb/trunk/unittests/Process/minidump/CMakeLists.txt (original) +++ lldb/trunk/unittests/Process/minidump/CMakeLists.txt Sun Apr 21 06:12:40 2019 @@ -23,10 +23,6 @@ set(test_inputs linux-x86_64_not_crashed.dmp memory-list-not-padded.dmp memory-list-padded.dmp - module-list-not-padded.dmp - module-list-padded.dmp - modules-dup-min-addr.dmp - modules-order.dmp regions-linux-map.dmp regions-memlist.dmp regions-memlist64.dmp Removed: lldb/trunk/unittests/Process/minidump/Inputs/module-list-not-padded.dmp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/module-list-not-padded.dmp?rev=358849&view=auto == Binary file - no diff available. Removed: lldb/trunk/unittests/Process/minidump/Inputs/module-list-padded.dmp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/module-list-padded.dmp?rev=358849&view=auto == Binary file - no diff available. Removed: lldb/trunk/unittests/Process/minidump/Inputs/modules-dup-min-addr.dmp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/modules-dup-min-addr.dmp?rev=358849&view=auto == Binary file - no diff available. Removed: lldb/trunk/unittests/Process/minidump/Inputs/modules-order.dmp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/modules-order.dmp?rev=358849&view=auto == Binary file - no diff available. Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=358850&r1=358849&r2=358850&view=diff == --- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original) +++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Sun Apr 21 06:12:40 2019 @@ -126,30 +126,6 @@ TEST_F(MinidumpParserTest, GetThreadList EXPECT_EQ(0x55667788UL, thread_list[1].thread_id); } -TEST_F(MinidumpParserTest, GetModuleListNotPadded) { - // Verify that we can load a module list that doesn't have 4 bytes of padding - // after the module count. - SetUpData("module-list-not-padded.dmp"); - auto module_list = parser->GetModuleList(); - ASSERT_EQ(2UL, module_list.size()); - EXPECT_EQ(0x1000UL, module_list[0].BaseOfImage); - EXPECT_EQ(0x2000UL, module_list[0].SizeOfImage); - EXPECT_EQ(0x5000UL, module_list[1].BaseOfImage); - EXPECT_EQ(0x3000UL, module_list[1].SizeOfImage); -} - -TEST_F(MinidumpParserTest, GetModuleListPadded) { - // Verify that we can load a module list that has 4 bytes of padding - // after the module count as found in breakpad minidump files. - SetUpData("module-list-padded.dmp"); - auto module_list = parser->GetModuleList(); - ASSERT_EQ(2UL, module_list.size()); - EXPECT_EQ(0x1000UL, module_list[0].BaseOfImage); - EXPECT_EQ(0x2000UL, module_list[0].SizeOfImage); - EXPECT_EQ(0x5000UL, module_list[1].BaseOfImage); - EXPECT_EQ(0x3000UL, module_list[1].SizeOfImage); -} - TEST_F(MinidumpParserTest, GetMemoryListNotPadded) { // Verify that we can load a memory list that doesn't have 4 bytes of padding // after the memory range count. @@ -218,47 +194,31 @@ TEST_F(MinidumpParserTest, GetPid) { ASSERT_EQ(16001UL, pid.getValue()); } -TEST_F(MinidumpParserTest, GetModuleList) { - SetUpData("linux-x86_64.d
[Lldb-commits] [PATCH] D60948: yamlify TestMiniDumpUUID binaries
labath created this revision. labath added a reviewer: clayborg. Herald added a subscriber: javed.absar. labath marked an inline comment as done. labath added inline comments. Comment at: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml:5 +Processor Arch: AMD64 +Platform ID: MacOSX +CSD Version: '15E216' @clayborg: The OS in this minidump is inconsistent with the file name. Do you want me to rename the file, or change the OS in the minidump? Instead of checking in raw minidump binaries, check in their yaml form, and call yaml2obj in the test. https://reviews.llvm.org/D60948 Files: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml @@ -0,0 +1,21 @@ +--- !minidump +Streams: + - Type:SystemInfo +Processor Arch: AMD64 +Platform ID: MacOSX +CSD Version: '15E216' +CPU: + Vendor ID: GenuineIntel + Version Info:0x + Feature Info:0x + - Type:ModuleList +Modules: + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/tmp/a' +CodeView Record: 525344530102030405060708090A0B0C0D0E0F1000 + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/tmp/b' +CodeView Record: 525344530A141E28323C46505A646E78828C96A000 +... Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml @@ -0,0 +1,21 @@ +--- !minidump +Streams: + - Type:SystemInfo +Processor Arch: AMD64 +Platform ID: MacOSX +CSD Version: '15E216' +CPU: + Vendor ID: GenuineIntel + Version Info:0x + Feature Info:0x + - Type:ModuleList +Modules: + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/file/does/not/exist/a' +CodeView Record: '5253445300' + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/file/does/not/exist/b' +CodeView Record: '5253445300' +... Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.yaml =
[Lldb-commits] [PATCH] D60948: yamlify TestMiniDumpUUID binaries
labath marked an inline comment as done. labath added inline comments. Comment at: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml:5 +Processor Arch: AMD64 +Platform ID: MacOSX +CSD Version: '15E216' @clayborg: The OS in this minidump is inconsistent with the file name. Do you want me to rename the file, or change the OS in the minidump? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60948/new/ https://reviews.llvm.org/D60948 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60949: UnwindPlan: pretty-print dwarf expressions
labath created this revision. labath added reviewers: jasonmolenda, clayborg. Herald added a subscriber: aprantl. Previously we were printing the dwarf expressions in unwind rules simply as "dwarf-expr". This patch uses the existing dwarf-printing capabilities in lldb to enhance this dump output, and print the full decoded dwarf expression. https://reviews.llvm.org/D60949 Files: lit/Unwind/Inputs/unwind-plan-dwarf-dump.s lit/Unwind/unwind-plan-dwarf-dump.test source/Symbol/UnwindPlan.cpp Index: source/Symbol/UnwindPlan.cpp === --- source/Symbol/UnwindPlan.cpp +++ source/Symbol/UnwindPlan.cpp @@ -8,8 +8,10 @@ #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Expression/DWARFExpression.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Log.h" @@ -64,6 +66,30 @@ m_location.expr.length = len; } +static llvm::Optional> +GetByteOrderAndAddrSize(Thread *thread) { + if (!thread) +return llvm::None; + ProcessSP process_sp = thread->GetProcess(); + if (!process_sp) +return llvm::None; + ArchSpec arch = process_sp->GetTarget().GetArchitecture(); + return std::make_pair(arch.GetByteOrder(), arch.GetAddressByteSize()); +} + +static void DumpDWARFExpr(Stream &s, llvm::ArrayRef expr, Thread *thread) { + if (auto order_and_width = GetByteOrderAndAddrSize(thread)) { +DataExtractor extractor(expr.data(), expr.size(), order_and_width->first, +order_and_width->second); +if (!DWARFExpression::PrintDWARFExpression(s, extractor, + order_and_width->second, + /*dwarf_ref_size*/ 4, + /*location_expression*/ false)) + s.PutCString("invalid-dwarf-expr"); + } else +s.PutCString("dwarf-expr"); +} + void UnwindPlan::Row::RegisterLocation::Dump(Stream &s, const UnwindPlan *unwind_plan, const UnwindPlan::Row *row, @@ -120,9 +146,12 @@ case isDWARFExpression: { s.PutChar('='); if (m_type == atDWARFExpression) - s.PutCString("[dwarf-expr]"); -else - s.PutCString("dwarf-expr"); + s.PutChar('['); +DumpDWARFExpr( +s, llvm::makeArrayRef(m_location.expr.opcodes, m_location.expr.length), +thread); +if (m_type == atDWARFExpression) + s.PutChar(']'); } break; } } @@ -172,7 +201,9 @@ s.PutChar(']'); break; case isDWARFExpression: -s.PutCString("dwarf-expr"); +DumpDWARFExpr(s, + llvm::makeArrayRef(m_value.expr.opcodes, m_value.expr.length), + thread); break; default: s.PutCString("unspecified"); Index: lit/Unwind/unwind-plan-dwarf-dump.test === --- /dev/null +++ lit/Unwind/unwind-plan-dwarf-dump.test @@ -0,0 +1,14 @@ +# REQUIRES: target-x86_64, system-linux, native + +# RUN: %clang %p/Inputs/unwind-plan-dwarf-dump.s -o %t +# RUN: %lldb %t -s %s -o exit | FileCheck %s + +breakpoint set -n main +# CHECK: Breakpoint 1: + +process launch +# CHECK: stop reason = breakpoint 1.1 + +target modules show-unwind -n main +# CHECK: eh_frame UnwindPlan: +# CHECK: row[0]:0: CFA=DW_OP_breg7 +0, DW_OP_const1u 0x00, DW_OP_plus => rip=DW_OP_const1s -8, DW_OP_plus , DW_OP_deref Index: lit/Unwind/Inputs/unwind-plan-dwarf-dump.s === --- /dev/null +++ lit/Unwind/Inputs/unwind-plan-dwarf-dump.s @@ -0,0 +1,13 @@ +.text +.globl main +.type main, @function +main: +.LFB0: +.cfi_startproc +.cfi_escape 0x0f, 0x05, 0x77, 0x00, 0x08, 0x00, 0x22 +.cfi_escape 0x16, 0x10, 0x04, 0x09, 0xf8, 0x22, 0x06 +movl$47, %eax +ret +.cfi_endproc +.LFE0: +.size main, .-main ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D55376: Generate LLDB website/documentation from rst with Sphinx
thakis added a comment. Herald added a subscriber: ormris. This (I'm guessing) broke https://lldb.llvm.org/lldb-gdb.html which is still present in many search indices. Could we make that page redirect to whatever is the new replacement? (https://www.w3.org/Provider/Style/URI etc) Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55376/new/ https://reviews.llvm.org/D55376 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60949: UnwindPlan: pretty-print dwarf expressions
jasonmolenda accepted this revision. jasonmolenda added a comment. This revision is now accepted and ready to land. very nice. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60949/new/ https://reviews.llvm.org/D60949 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60817: [NativePDB] Add anonymous namespaces support
aleksandr.urakov added a comment. Thanks for the review! Sorry, I've forgot to include context in the updated patch. Yes, it's exactly the case that is broken, I've left FIXME there until it will be fixed. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60817/new/ https://reviews.llvm.org/D60817 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60957: Read ObjC class names in one large read, instead of reading them individually
jasonmolenda created this revision. jasonmolenda added a reviewer: jingham. Herald added subscribers: teemperor, abidh. Herald added a project: LLDB. There's a perf problem with Objective-C programs as we add more classes to the Darwin libraries over time - when lldb goes to run its first expression on one of these systems, it will load the ObjC class names from the run time, both the shared cache libraries and any app-contributed classes. lldb has two expressions it runs in the inferior to collect this information into a buffer allocated by lldb - returning the isa pointers and a hash of each class name used to id them. lldb would then read the names of the classes out of memory, which were not localized to one region of memory, and this has become a larger and larger performance issue. This patch modifies: 1. The two jitted functions, g_get_dynamic_class_info_body and g_get_shared_cache_class_info_body, now take the address of an allocated string pool buffer and size. If the address of the string pool is 0, no names are copied. The functions will copy the class names in to the string pool buffer and add an offset to the (isa, hash) that were previously being returned. If an entry in the (isa, hash, stroffset) array does not have an entry in the string pool, UINT32_MAX is used. If lldb's pre-allocated string pool buffer is too small, entries that did not fit will get UINT32_MAX and lldb will read the class names the old slow way. 2. Modifies the two methods that call these jitted functions, AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic and AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache, to allocate the string pool buffer, pass the address and size to the jitted expression, scan the array of (isa, hash, stroffset) tuples to find the highest stroffset, read that part of the string pool out of the inferior with a single read [*], pass the buffer to ParseClassInfoArray, deallocate the stringpool from the inferior. [X] nb: I just saw an unintended behavior on the last class name as I was writing this. Given that it uses the highest stroffset it finds to read the string pool back out of the inferior, the final class name won't be copied up. The test in ParseClassInfoArray will not 3. Modifies AppleObjCRuntimeV2::ParseClassInfoArray to grab the class name from the stringpool buffer if the stroffset is != UINT32_MAX and is within the copied buffer size. [X] nb: I just saw an unintended behavior on the last class name as I was writing this. Given that it uses the highest stroffset it finds to read the string pool back out of the inferior, the final class name won't be copied up. The test in ParseClassInfoArray to check that the stroffset is within the bounds of the copied buffer should mean that we read the last class name out of the inferior aka the old method. I'll double check this is handled correctly tomorrow. This patch also includes a change that Frederic Riss wrote the other month but hadn't upstreamed yet, where we detect swift names in the shared cache and don't compute the hash in the jitted function, doing it up in lldb later. Testing the patch shows no testsuite difference on Mac native. As an experiment, I intentionally introduced a bug where the class names in the string pool were corrupted and it caused the testsuite failures I expected. From a performance point of view, this shows the packet behavior I was aiming for. rdar://problem/27798609 Repository: rLLDB LLDB https://reviews.llvm.org/D60957 Files: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h === --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -297,7 +297,8 @@ UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table); uint32_t ParseClassInfoArray(const lldb_private::DataExtractor &data, - uint32_t num_class_infos); + uint32_t num_class_infos, + lldb::DataBufferSP strpool_buffer_sp); DescriptorMapUpdateResult UpdateISAToDescriptorMapSharedCache(); Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp === --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -79,10 +79,11 @@ extern "C" { size_t strlen(const char *); -char *strncpy (char * s1, const char * s2, size_t n); +char *strcpy (char * dst, const char * src); int printf(const char * format, ...); } #define DEBUG_PRINTF(fm