[Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions
zturner updated this revision to Diff 80992. zturner added a comment. Added a format provider for `FileSpec`. Style syntax is documented in this patch. Added some unit tests so you can see the output. To answer Greg's earlier question about printing c-strings, `formatv("'{0}' '{1}' '{2}'", (const char *)nullptr, "", "test");` would print "'' '' 'test'";. So yes that means that nullptr doesn't print "(null)". It could be made to do so if desired, but if it's any consolation the goal is really to move away from c-strings, and StringRef doesn't have any concept of null. There's just empty and not empty. One nice thing about is that you can easily change the behavior of existing formatters using a mechanism which I've called "adapters". You can see an example of a builtin adapter in this patch, where I use `fmt_repeat` to repeat a character 7 times. To write an adapter for const char * that prints (null), you could do this: struct fmt_or_null { explicit fmt_or_null(const char *s) : s(s) {} void format(llvm::raw_ostream , StringRef Style) const { if (!s) Stream << "(null)"; // Override the default behavior for nullptr; else llvm::format_provider::format(s, Stream, Style); // Otherwise just use the default; } const char *s; }; void foo() { const char *s = nullptr; std::string result = llvm::formatv("{0}", fmt_or_null(s)); } https://reviews.llvm.org/D27632 Files: include/lldb/Core/Error.h include/lldb/Core/Log.h include/lldb/Core/ModuleSpec.h include/lldb/Core/Stream.h include/lldb/Host/FileSpec.h include/lldb/Interpreter/CommandReturnObject.h source/Breakpoint/BreakpointOptions.cpp source/Commands/CommandObjectApropos.cpp source/Core/Log.cpp source/Host/common/FileSpec.cpp source/Symbol/ClangASTContext.cpp source/Target/Target.cpp unittests/Host/FileSpecTest.cpp Index: unittests/Host/FileSpecTest.cpp === --- unittests/Host/FileSpecTest.cpp +++ unittests/Host/FileSpecTest.cpp @@ -260,3 +260,27 @@ << "Original path: " << test.first; } } + +TEST(FileSpecTest, FormatFileSpec) { + auto win = FileSpec::ePathSyntaxWindows; + + FileSpec F; + EXPECT_EQ("(empty)", llvm::formatv("{0}", F).str()); + EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str()); + EXPECT_EQ("(empty)", llvm::formatv("{0:F}", F).str()); + + F = FileSpec("C:\\foo\\bar.txt", false, win); + EXPECT_EQ("C:\\foo\\bar.txt", llvm::formatv("{0}", F).str()); + EXPECT_EQ("C:\\foo\\", llvm::formatv("{0:D}", F).str()); + EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str()); + + F = FileSpec("foo\\bar.txt", false, win); + EXPECT_EQ("foo\\bar.txt", llvm::formatv("{0}", F).str()); + EXPECT_EQ("foo\\", llvm::formatv("{0:D}", F).str()); + EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str()); + + F = FileSpec("foo", false, win); + EXPECT_EQ("foo", llvm::formatv("{0}", F).str()); + EXPECT_EQ("foo", llvm::formatv("{0:F}", F).str()); + EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str()); +} \ No newline at end of file Index: source/Target/Target.cpp === --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -1554,11 +1554,9 @@ if (load_addr == LLDB_INVALID_ADDRESS) { ModuleSP addr_module_sp(resolved_addr.GetModule()); if (addr_module_sp && addr_module_sp->GetFileSpec()) -error.SetErrorStringWithFormat( -"%s[0x%" PRIx64 "] can't be resolved, %s in not currently loaded", -addr_module_sp->GetFileSpec().GetFilename().AsCString(""), -resolved_addr.GetFileAddress(), -addr_module_sp->GetFileSpec().GetFilename().AsCString("")); +error.SetErrorStringWithFormatv( +"{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded", +addr_module_sp->GetFileSpec(), resolved_addr.GetFileAddress()); else error.SetErrorStringWithFormat("0x%" PRIx64 " can't be resolved", resolved_addr.GetFileAddress()); Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9,6 +9,9 @@ #include "lldb/Symbol/ClangASTContext.h" +#include "llvm/Support/FormatAdapters.h" +#include "llvm/Support/FormatVariadic.h" + // C Includes // C++ Includes #include // std::once @@ -6739,10 +6742,7 @@ if (array) { CompilerType element_type(getASTContext(), array->getElementType()); if (element_type.GetCompleteType()) { - char element_name[64]; - ::snprintf(element_name, sizeof(element_name), "[%" PRIu64 "]", - static_cast(idx)); - child_name.assign(element_name); + child_name = llvm::formatv("[{0}]", idx); child_byte_size = element_type.GetByteSize(
Re: [Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions
Seems reasonable, I'll make a FileSpec formatter and update the patch On Fri, Dec 9, 2016 at 4:03 PM Greg Clayton via Phabricator < revi...@reviews.llvm.org> wrote: > clayborg requested changes to this revision. > clayborg added a comment. > This revision now requires changes to proceed. > > I would like to see the FileSpec having its formatv stuff done for this > since it will start a whole slew of people wanting to use it and we should > have an example of a class that show how to add your own formatting options. > > > https://reviews.llvm.org/D27632 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. I would like to see the FileSpec having its formatv stuff done for this since it will start a whole slew of people wanting to use it and we should have an example of a class that show how to add your own formatting options. https://reviews.llvm.org/D27632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions
clayborg added a comment. It is nice to be able to use StringRef and std::string as is. I was wondering if you have: StringRef null; StringRef empty(""); StringRef hello("hello") What does this show: formatv("{0} {1} {2}", null, empty, hello); I would hope for: (null) "" "hello" Where "(null)" is used for the empty StringRef since it doesn't have a value. This is what printf does if you pass nullptr in for a %s. The other string has a pointer, but no size, so it should show the empty string. Also for std::string and for StringRef if would be great if we can show binary values since a StringRef and std::string can contain NULL characters and also non printable characters. One option that would be really cool for both StringRef and std::string would be the memory view stuff we did a month back! So we could do: StringRef bytes("\x01\x02\x03"); formatv("{0:memory}", bytes); And get out a memory dump. Comment at: source/Target/Target.cpp:1558-1559 +error.SetErrorStringWithFormatv( +"{0}[{1:x+}] can't be resolved, {0} is not currently loaded", addr_module_sp->GetFileSpec().GetFilename().AsCString(""), +resolved_addr.GetFileAddress()); Can we add lldb_private::FileSpec support with this patch as well? Then the code can be: ``` error.SetErrorStringWithFormatv( "{0}[{1:x+}] can't be resolved, {0;filename} is not currently loaded", addr_module_sp->GetFileSpec(), resolved_addr.GetFileAddress()); ``` https://reviews.llvm.org/D27632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions
zturner created this revision. zturner added reviewers: labath, clayborg, jingham. zturner added a subscriber: lldb-commits. We have various functions like `Stream::Printf()`, and `Error::SetErrorStringWithFormat()`, `Log::Printf()`, and various others. I added functions that delegate to `formatv` in case people want to see some actual usage in practice. I also converted a few various Printfs, etc to this syntax just to demonstrate what it looks like. I tried to find callsites that would illustrate how it makes things simpler, such as : - not needing to call `.c_str()` and being able to pass `std::string` and/or `StringRef` directly as the argument. - places where the same argument is printed multiple times, only having to pass it once (incidentally this fixed a spelling mistake since when passing the argument the 2nd time, there had been a typo. So this also serves as an example of how this is safer than Printf, since less code typed = fewer chances to mess up). - places where complex format strings are constructed, such as using the printf width specifier `*` or `PRIx64` are used and now we can simply pass whatever type we have directly, even if it's architecture dependent like `size_t`. Various other uses. Obviously a change like this is too big to do all in one pass, since it would have a roughly 100% chance of introducing new bugs and be impossible to bisect. This is basically just to get the hookups in place and have a single-digit number of illustrative use cases. https://reviews.llvm.org/D27632 Files: include/lldb/Core/Error.h include/lldb/Core/Log.h include/lldb/Core/ModuleSpec.h include/lldb/Core/Stream.h include/lldb/Interpreter/CommandReturnObject.h source/Breakpoint/BreakpointOptions.cpp source/Commands/CommandObjectApropos.cpp source/Core/Log.cpp source/Symbol/ClangASTContext.cpp source/Target/Target.cpp Index: source/Target/Target.cpp === --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -1554,11 +1554,10 @@ if (load_addr == LLDB_INVALID_ADDRESS) { ModuleSP addr_module_sp(resolved_addr.GetModule()); if (addr_module_sp && addr_module_sp->GetFileSpec()) -error.SetErrorStringWithFormat( -"%s[0x%" PRIx64 "] can't be resolved, %s in not currently loaded", +error.SetErrorStringWithFormatv( +"{0}[{1:x+}] can't be resolved, {0} is not currently loaded", addr_module_sp->GetFileSpec().GetFilename().AsCString(""), -resolved_addr.GetFileAddress(), -addr_module_sp->GetFileSpec().GetFilename().AsCString("")); +resolved_addr.GetFileAddress()); else error.SetErrorStringWithFormat("0x%" PRIx64 " can't be resolved", resolved_addr.GetFileAddress()); Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9,6 +9,9 @@ #include "lldb/Symbol/ClangASTContext.h" +#include "llvm/Support/FormatAdapters.h" +#include "llvm/Support/FormatVariadic.h" + // C Includes // C++ Includes #include // std::once @@ -6739,10 +6742,7 @@ if (array) { CompilerType element_type(getASTContext(), array->getElementType()); if (element_type.GetCompleteType()) { - char element_name[64]; - ::snprintf(element_name, sizeof(element_name), "[%" PRIu64 "]", - static_cast(idx)); - child_name.assign(element_name); + child_name = llvm::formatv("[{0}]", idx); child_byte_size = element_type.GetByteSize( exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL); child_byte_offset = (int32_t)idx * (int32_t)child_byte_size; @@ -8883,8 +8883,8 @@ std::string base_class_type_name(base_class_qual_type.getAsString()); // Indent and print the base class type name - s->Printf("\n%*s%s ", depth + DEPTH_INCREMENT, "", -base_class_type_name.c_str()); + s->Format("\n{0}{1}", llvm::fmt_repeat(" ", depth + DEPTH_INCREMENT), +base_class_type_name); clang::TypeInfo base_class_type_info = getASTContext()->getTypeInfo(base_class_qual_type); Index: source/Core/Log.cpp === --- source/Core/Log.cpp +++ source/Core/Log.cpp @@ -138,20 +138,6 @@ } //-- -// Print debug strings if and only if the global debug option is set to -// a non-zero value. -//-- -void Log::DebugVerbose(const char *format, ...) { - if (!GetOptions().AllSet(LLDB_LOG_OPTION_DEBUG | LLDB_LOG_OPTION_VERBOSE)) -return; - - va_list args; - va_start(args,
[Lldb-commits] [PATCH] D27088: [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS
clayborg added a comment. If we can parse the register info that was retrieved via the GDB remote packets and emulate the DWARF expression that would allow us to do things correctly in the test case. Anything that is agnostic will work and we probably have all the info we need. We will need to write a quick DWARF opcode parser, but we only need to handle the opcodes in the MIPS for now so it should be easy to make work in python. https://reviews.llvm.org/D27088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289233 - Fix i386 being able to show member variables correctly by not returning empty objective C types from the runtime.
Author: gclayton Date: Fri Dec 9 11:54:59 2016 New Revision: 289233 URL: http://llvm.org/viewvc/llvm-project?rev=289233=rev Log: Fix i386 being able to show member variables correctly by not returning empty objective C types from the runtime. We don't parse ObjC v1 types from the runtime metadata like we do for ObjC v2, but doing so by creating empty types was ruining the i386 v1 debugging experience. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py?rev=289233=289232=289233=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py Fri Dec 9 11:54:59 2016 @@ -186,6 +186,7 @@ class FoundationTestCase2(TestBase): "be completed."]) self.runCmd("process continue") +@expectedFailureAll(archs=["i[3-6]86"], bugnumber="") def test_NSError_p(self): """Test that p of the result of an unknown method does require a cast.""" self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m?rev=289233=289232=289233=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m Fri Dec 9 11:54:59 2016 @@ -25,10 +25,10 @@ int main() ThingSummer *summer = [ThingSummer alloc]; struct things_to_sum tts = { 2, 3, 4 }; int ret = [summer sumThings:tts]; - NSRect rect = {{0, 0}, {10, 20}}; - -// Set breakpoint here. -return rect.origin.x; + // The Objective C V1 runtime won't read types from metadata so we need + // NSValue in our debug info to use it in our test. + NSValue *v = [NSValue valueWithRect:rect]; +return rect.origin.x; // Set breakpoint here. } } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=289233=289232=289233=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Fri Dec 9 11:54:59 2016 @@ -435,8 +435,5 @@ void AppleObjCRuntimeV1::UpdateISAToDesc } DeclVendor *AppleObjCRuntimeV1::GetDeclVendor() { - if (!m_decl_vendor_ap.get()) -m_decl_vendor_ap.reset(new AppleObjCDeclVendor(*this)); - - return m_decl_vendor_ap.get(); + return nullptr; } Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=289233=289232=289233=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Fri Dec 9 11:54:59 2016 @@ -249,9 +249,8 @@ clang::QualType AppleObjCTypeEncodingPar } DeclVendor *decl_vendor = m_runtime.GetDeclVendor(); - -assert(decl_vendor); // how are we parsing type encodings for expressions if - // a type vendor isn't in play? +if (!decl_vendor) + return clang::QualType(); const bool append = false; const uint32_t max_matches = 1; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289223 - Fix buildbots that are failing due to this test by adding all expected fails that TestMultipleDebuggers.py has.
Author: gclayton Date: Fri Dec 9 10:25:13 2016 New Revision: 289223 URL: http://llvm.org/viewvc/llvm-project?rev=289223=rev Log: Fix buildbots that are failing due to this test by adding all expected fails that TestMultipleDebuggers.py has. Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py?rev=289223=289222=289223=diff == --- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Fri Dec 9 10:25:13 2016 @@ -20,6 +20,15 @@ class TestMultipleTargets(TestBase): @skipIfNoSBHeaders @skipIfHostIncompatibleWithRemote +@expectedFailureAll( +archs="i[3-6]86", +bugnumber="multi-process-driver.cpp creates an x64 target") +@expectedFailureAll( +oslist=[ +"windows", +"linux", +"freebsd"], +bugnumber="llvm.org/pr20282") def test_multiple_debuggers(self): env = {self.dylibPath: self.getLLDBLibraryEnvVal()} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289222 - Rename multiple target test so it is unique.
Author: gclayton Date: Fri Dec 9 10:22:10 2016 New Revision: 289222 URL: http://llvm.org/viewvc/llvm-project?rev=289222=rev Log: Rename multiple target test so it is unique. Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py?rev=289222=289221=289222=diff == --- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Fri Dec 9 10:22:10 2016 @@ -13,7 +13,7 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class TestMultipleSimultaneousDebuggers(TestBase): +class TestMultipleTargets(TestBase): mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27088: [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS
nitesh.jain added a comment. Hi Greg, The patch https://reviews.llvm.org/D20357 evaluated the DwarfExpression and update the floating point register size. So should we implement SBRegisterContext and SBArchSpec to evaluate dwarf expression and update the floating point register size accordingly for python test cases ? OR Should we implement above approach ? Thanks https://reviews.llvm.org/D27088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289211 - [LLDB][MIPS] Fix TestWatchpointIter failure
Author: nitesh.jain Date: Fri Dec 9 07:54:47 2016 New Revision: 289211 URL: http://llvm.org/viewvc/llvm-project?rev=289211=rev Log: [LLDB][MIPS] Fix TestWatchpointIter failure Reviewers: jingham Subscribers: jaydeep, bhushan, slthakur, lldb-commits Differential Revision: https://reviews.llvm.org/D27124 Modified: lldb/trunk/source/Target/StopInfo.cpp Modified: lldb/trunk/source/Target/StopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=289211=289210=289211=diff == --- lldb/trunk/source/Target/StopInfo.cpp (original) +++ lldb/trunk/source/Target/StopInfo.cpp Fri Dec 9 07:54:47 2016 @@ -692,7 +692,13 @@ protected: if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) .Success()) { if (!wp_triggers_after) { -process_sp->DisableWatchpoint(wp_sp.get(), false); +// We need to preserve the watch_index before watchpoint +// is disable. Since Watchpoint::SetEnabled will clear the +// watch index. +// This will fix TestWatchpointIter failure +Watchpoint *wp = wp_sp.get(); +uint32_t watch_index = wp->GetHardwareIndex(); +process_sp->DisableWatchpoint(wp, false); StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo(); assert(stored_stop_info_sp.get() == this); @@ -710,7 +716,8 @@ protected: process_sp->GetThreadList().SetSelectedThreadByID( thread_sp->GetID()); thread_sp->SetStopInfo(stored_stop_info_sp); -process_sp->EnableWatchpoint(wp_sp.get(), false); +process_sp->EnableWatchpoint(wp, false); +wp->SetHardwareIndex(watch_index); } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27124: [LLDB][MIPS] Fix TestWatchpointIter failure
This revision was automatically updated to reflect the committed changes. Closed by commit rL289211: [LLDB][MIPS] Fix TestWatchpointIter failure (authored by nitesh.jain). Changed prior to commit: https://reviews.llvm.org/D27124?vs=80414=80895#toc Repository: rL LLVM https://reviews.llvm.org/D27124 Files: lldb/trunk/source/Target/StopInfo.cpp Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -692,7 +692,13 @@ if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) .Success()) { if (!wp_triggers_after) { -process_sp->DisableWatchpoint(wp_sp.get(), false); +// We need to preserve the watch_index before watchpoint +// is disable. Since Watchpoint::SetEnabled will clear the +// watch index. +// This will fix TestWatchpointIter failure +Watchpoint *wp = wp_sp.get(); +uint32_t watch_index = wp->GetHardwareIndex(); +process_sp->DisableWatchpoint(wp, false); StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo(); assert(stored_stop_info_sp.get() == this); @@ -710,7 +716,8 @@ process_sp->GetThreadList().SetSelectedThreadByID( thread_sp->GetID()); thread_sp->SetStopInfo(stored_stop_info_sp); -process_sp->EnableWatchpoint(wp_sp.get(), false); +process_sp->EnableWatchpoint(wp, false); +wp->SetHardwareIndex(watch_index); } } } Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -692,7 +692,13 @@ if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) .Success()) { if (!wp_triggers_after) { -process_sp->DisableWatchpoint(wp_sp.get(), false); +// We need to preserve the watch_index before watchpoint +// is disable. Since Watchpoint::SetEnabled will clear the +// watch index. +// This will fix TestWatchpointIter failure +Watchpoint *wp = wp_sp.get(); +uint32_t watch_index = wp->GetHardwareIndex(); +process_sp->DisableWatchpoint(wp, false); StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo(); assert(stored_stop_info_sp.get() == this); @@ -710,7 +716,8 @@ process_sp->GetThreadList().SetSelectedThreadByID( thread_sp->GetID()); thread_sp->SetStopInfo(stored_stop_info_sp); -process_sp->EnableWatchpoint(wp_sp.get(), false); +process_sp->EnableWatchpoint(wp, false); +wp->SetHardwareIndex(watch_index); } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27085: [LLDB][MIPS] Fix TestMultipleHits for MIPS
This revision was automatically updated to reflect the committed changes. Closed by commit rL289210: [LLDB][MIPS] Fix TestMultipleHits for MIPS (authored by nitesh.jain). Changed prior to commit: https://reviews.llvm.org/D27085?vs=79038=80893#toc Repository: rL LLVM https://reviews.llvm.org/D27085 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp @@ -8,9 +8,7 @@ //===--===// #include #include - alignas(16) uint8_t buf[32]; - // This uses inline assembly to generate an instruction that writes to a large // block of memory. If it fails on your compiler/architecture, please add // appropriate code to generate a large write to "buf". If you cannot write at @@ -24,6 +22,8 @@ asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf)); #elif defined(__aarch64__) asm volatile ("stp x0, x1, %0" : : "m"(buf)); +#elif defined(__mips__) + asm volatile ("lw $2, %0" : : "m"(buf)); #endif return 0; } Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp @@ -8,9 +8,7 @@ //===--===// #include #include - alignas(16) uint8_t buf[32]; - // This uses inline assembly to generate an instruction that writes to a large // block of memory. If it fails on your compiler/architecture, please add // appropriate code to generate a large write to "buf". If you cannot write at @@ -24,6 +22,8 @@ asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf)); #elif defined(__aarch64__) asm volatile ("stp x0, x1, %0" : : "m"(buf)); +#elif defined(__mips__) + asm volatile ("lw $2, %0" : : "m"(buf)); #endif return 0; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289210 - [LLDB][MIPS] Fix TestMultipleHits for MIPS
Author: nitesh.jain Date: Fri Dec 9 07:44:15 2016 New Revision: 289210 URL: http://llvm.org/viewvc/llvm-project?rev=289210=rev Log: [LLDB][MIPS] Fix TestMultipleHits for MIPS Reviewers: clayborg, labath, zturner Subscribers: jaydeep, bhushan, slthakur, lldb-commits Differential Revision: https://reviews.llvm.org/D27085 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp?rev=289210=289209=289210=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp Fri Dec 9 07:44:15 2016 @@ -8,9 +8,7 @@ //===--===// #include #include - alignas(16) uint8_t buf[32]; - // This uses inline assembly to generate an instruction that writes to a large // block of memory. If it fails on your compiler/architecture, please add // appropriate code to generate a large write to "buf". If you cannot write at @@ -24,6 +22,8 @@ int main() { asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf)); #elif defined(__aarch64__) asm volatile ("stp x0, x1, %0" : : "m"(buf)); +#elif defined(__mips__) + asm volatile ("lw $2, %0" : : "m"(buf)); #endif return 0; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D26542: [LLDB][MIPS] Fix some test case failures due to "elf_abi" field of qprocessInfo packet
This revision was automatically updated to reflect the committed changes. Closed by commit rL289209: [LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo… (authored by nitesh.jain). Changed prior to commit: https://reviews.llvm.org/D26542?vs=77603=80892#toc Repository: rL LLVM https://reviews.llvm.org/D26542 Files: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -663,6 +663,7 @@ "triple", "vendor", "endian", +"elf_abi", "ptrsize" ] Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -663,6 +663,7 @@ "triple", "vendor", "endian", +"elf_abi", "ptrsize" ] ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289209 - [LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet.
Author: nitesh.jain Date: Fri Dec 9 07:37:14 2016 New Revision: 289209 URL: http://llvm.org/viewvc/llvm-project?rev=289209=rev Log: [LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet. Reviewers: jaydeep, bhushan, clayborg Subscribers: slthakur, lldb-commits Differential Revision: https://reviews.llvm.org/D26542 Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=289209=289208=289209=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Fri Dec 9 07:37:14 2016 @@ -663,6 +663,7 @@ class GdbRemoteTestCaseBase(TestBase): "triple", "vendor", "endian", +"elf_abi", "ptrsize" ] ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27459: Straw-man proposal for new logging syntax
labath added a comment. I'll respond to your comments on the lldb-dev thread. Comment at: include/lldb/Core/Log.h:218-219 + << llvm::formatv( \ + "{0,-60}: ", \ + (llvm::sys::path::filename(__FILE__) + "::" + __FUNCTION__) \ + .str()) \ clayborg wrote: > This is hard coding in the file + line all the time. I would like this to be > an option. We also need to be able to optionally enable the pid/tid, thread > name, stack backtrace and all the other options that are currently supported > by "log enable". Seems like we need a log function that exists in Log.cpp to > take a log mutex, add the extra log prefix stuff (file + line, pid/tid, > thread name, timestamp, delta since last log time, stack etc) and then call > the llvm::formatv() one or more times and then release the mutex. I am planning to make the source information optional. This diff is mainly here to demonstrate the target syntax from the users point of view. The changes are made here are not to be taken as examples of good coding practices - it is just the minimal set of changes I needed to do to make things work. When we agree on the final syntax, I'll implement this more nicely. https://reviews.llvm.org/D27459 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D27459: Straw-man proposal for new logging syntax
jasonmolenda added a comment. A couple of thoughts / two cents. I don't mind the current if (log) { ... } style of logging, even with the PRIx64's and having to do filepath.GetPath().c_str() and all that. I like being able to do extra work in a if (log) block of code -- create a SymbolContext for something or whatever, and as I'm debugging that section of code I like to be able to put a breakpoint there and look more closely. If this is all in a preprocessor macro, a breakpoint is going to stop me on the if() and then I'm trying to step through a macro? And if my computation is down in a lambda I need to figure out how to put a breakpoint in that or step into that somehow to look at the values being computed. How do I create a SymbolContext my_symctx(...); and then include that in what I log if I have to do all of this in the formatv arguments? I'm not thrilled with the formatv reinvention of format specification. The printf formatters are a bizarre little invention, but it's a bizarre invention that we've all worked with for decades and everyone who works in C knows well. The formatv format specification may be superior, but I don't want to see innovation here, I want clarity with the linga franca that every C programmer knows. I think the barrier to adopting something non-standard is very high. The formatv format specification string seems to explicitly mention the ordering of the arguments, like llvm::formatv("{0} {1} {2}", first, second, third). I'm guessing this allows you to print the arguments in different order than they appear? Like llvm::formatv("{0} {2} {2} {1}", first, second, third)? What's the benefit of this vrs. the uncertainty of which arguments are used in different parts of the string (short of counting them out by hand)? If I have a formatv format specification like "{0} {1} {2} {3} {4}" and I want to insert an argument between 2 and 3, I need to renumber 3 and 4 now? Or do I do "{0} {1} {2} {5} {3} {4}" and throw my argument on to the end? Simply *ability* to put the arguments in any order is my concern. Of course I'm never going to do it, but I'm going to have to work on code where other people have done it. I don't personally want to see the file / function / line numbers in my logging. It's fine if that's an option that other people can enable if they want it. There's going to be a growth in the size of our text for the constant strings for every log point having its filename and function, but it will probably not be significant (maybe the strings can be coalesced, I wouldn't bet one way or the other.) If formatv could take something a LOT closer to printf, I'd be better with it. Something like the python string formatters would be a real improvement - just %d for base 10 numbers, not having to worry about the size of the argument in the format string, for instance, and would still be readable & understandable by any C programmer out there. If we're going to start using this alternate logging scheme, eventually there will be a push to use it everywhere, or someone will go through all the other classes in the code base and switch it out without consultation. We need to all sign on to this idea before it goes into the code base at all. https://reviews.llvm.org/D27459 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r289199 - Fix TestMultipleTargets for on x86_64 architectures
Author: labath Date: Fri Dec 9 04:05:07 2016 New Revision: 289199 URL: http://llvm.org/viewvc/llvm-project?rev=289199=rev Log: Fix TestMultipleTargets for on x86_64 architectures This test links against liblldb, so it can only run when the target arch is the same arch as liblldb. We already have a decorator for that, so apply it. While I'm in there, also mark the test as debug-info independent. Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py?rev=289199=289198=289199=diff == --- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Fri Dec 9 04:05:07 2016 @@ -16,8 +16,10 @@ from lldbsuite.test import lldbutil class TestMultipleSimultaneousDebuggers(TestBase): mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True @skipIfNoSBHeaders +@skipIfHostIncompatibleWithRemote def test_multiple_debuggers(self): env = {self.dylibPath: self.getLLDBLibraryEnvVal()} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits