[Lldb-commits] [PATCH] D113760: [formatters] Add a libstdcpp formatter for for unordered_map, unordered_set, unordered_multimap, unordered_multiset

2021-11-14 Thread Danil Stefaniuc via Phabricator via lldb-commits
danilashtefan updated this revision to Diff 387084.
danilashtefan added a comment.

Some naming corrections


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113760/new/

https://reviews.llvm.org/D113760

Files:
  lldb/examples/synthetic/gnu_libstdcpp.py
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/main.cpp

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/main.cpp
@@ -0,0 +1,78 @@
+#include 
+#include 
+#include 
+
+using std::string;
+
+#define intstr_map std::unordered_map
+#define intstr_mmap std::unordered_multimap
+
+#define int_set std::unordered_set
+#define str_set std::unordered_set
+#define int_mset std::unordered_multiset
+#define str_mset std::unordered_multiset
+
+int g_the_foo = 0;
+
+int thefoo_rw(int arg = 1) {
+  if (arg < 0)
+arg = 0;
+  if (!arg)
+arg = 1;
+  g_the_foo += arg;
+  return g_the_foo;
+}
+
+int main() {
+  intstr_map map;
+  map.emplace(1, "hello");
+  map.emplace(2, "world");
+  map.emplace(3, "this");
+  map.emplace(4, "is");
+  map.emplace(5, "me");
+  thefoo_rw(); // Set break point at this line.
+
+  intstr_mmap mmap;
+  mmap.emplace(1, "hello");
+  mmap.emplace(2, "hello");
+  mmap.emplace(2, "world");
+  mmap.emplace(3, "this");
+  mmap.emplace(3, "this");
+  mmap.emplace(3, "this");
+  thefoo_rw(); // Set break point at this line.
+
+  int_set iset;
+  iset.emplace(1);
+  iset.emplace(2);
+  iset.emplace(3);
+  iset.emplace(4);
+  iset.emplace(5);
+  thefoo_rw(); // Set break point at this line.
+
+  str_set sset;
+  sset.emplace("hello");
+  sset.emplace("world");
+  sset.emplace("this");
+  sset.emplace("is");
+  sset.emplace("me");
+  thefoo_rw(); // Set break point at this line.
+
+  int_mset imset;
+  imset.emplace(1);
+  imset.emplace(2);
+  imset.emplace(2);
+  imset.emplace(3);
+  imset.emplace(3);
+  imset.emplace(3);
+  thefoo_rw(); // Set break point at this line.
+
+  str_mset smset;
+  smset.emplace("hello");
+  smset.emplace("world");
+  smset.emplace("world");
+  smset.emplace("is");
+  smset.emplace("is");
+  thefoo_rw(); // Set break point at this line.
+
+  return 0;
+}
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py
@@ -0,0 +1,78 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class GenericUnorderedDataFormatterTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+self.namespace = 'std'
+
+@add_test_categories(["libstdcxx"])
+def test_with_run_command(self):
+self.build()
+self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_source_regexp(
+self, "Set break point at this line.")
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# This is the function to remove the custom formats in order to have a
+# clean slate for the next test case.
+def cleanup():
+self.runCmd('type format clear', check=False)
+self.runCmd('type summary clear', check=False)
+self.runCmd('type filter clear', check=False)
+self.runCmd('type synth clear', check=False)
+self.runCmd(
+"settings set target.max-children-count 256",
+check=False)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+ns = self.namespace
+self.look_for_content_and_continue(
+"map", ['%s::unordered_map' %
+ns, 'size=5 {', 'hello', 'world', 'this', 'is', 'me'])
+
+self.look_for_content_and_continue(
+"mmap", ['%s::unordered_multimap' % ns, 'size=6 {', 'first = 3', 'second = "this"',
+ 'first = 2', 'second = "hello"'])
+
+self.look_for_content_and_conti

Re: [Lldb-commits] [lldb] 6438a52 - Revert "[clang] retain type sugar in auto / template argument deduction"

2021-11-14 Thread David Blaikie via lldb-commits
On Sun, Nov 14, 2021 at 3:30 PM Matheus Izvekov via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

>
> Author: Matheus Izvekov
> Date: 2021-11-15T00:29:05+01:00
> New Revision: 6438a52df1c7f36952b6126ff7b978861b76ad45
>
> URL:
> https://github.com/llvm/llvm-project/commit/6438a52df1c7f36952b6126ff7b978861b76ad45
> DIFF:
> https://github.com/llvm/llvm-project/commit/6438a52df1c7f36952b6126ff7b978861b76ad45.diff
>
> LOG: Revert "[clang] retain type sugar in auto / template argument
> deduction"
>
> This reverts commit 4d8fff477e024698facd89741cc6cf996708d598.
>

Would be good to include some details about the reason for reverting
patches in the commit message - helps folks identify whether a particular
revert will address issues they might be investigating, and increases the
chance folks might avoid the same mistakes if they're pursuing a similar
direction in the future.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] 6438a52 - Revert "[clang] retain type sugar in auto / template argument deduction"

2021-11-14 Thread David Blaikie via lldb-commits
Thanks for the details!

On Sun, Nov 14, 2021 at 3:39 PM Matheus Izvekov  wrote:

> Oops, my bad!
>
> The reason for reverting this is that this is a recent commit, and
> there are reports of breakage building libANGLE which have not been
> investigated.
>
> See https://reviews.llvm.org/D110216 for details / future developments.
>
> Thanks!
>
> On Mon, Nov 15, 2021 at 12:33 AM David Blaikie  wrote:
> >
> >
> >
> > On Sun, Nov 14, 2021 at 3:30 PM Matheus Izvekov via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >>
> >>
> >> Author: Matheus Izvekov
> >> Date: 2021-11-15T00:29:05+01:00
> >> New Revision: 6438a52df1c7f36952b6126ff7b978861b76ad45
> >>
> >> URL:
> https://github.com/llvm/llvm-project/commit/6438a52df1c7f36952b6126ff7b978861b76ad45
> >> DIFF:
> https://github.com/llvm/llvm-project/commit/6438a52df1c7f36952b6126ff7b978861b76ad45.diff
> >>
> >> LOG: Revert "[clang] retain type sugar in auto / template argument
> deduction"
> >>
> >> This reverts commit 4d8fff477e024698facd89741cc6cf996708d598.
> >
> >
> > Would be good to include some details about the reason for reverting
> patches in the commit message - helps folks identify whether a particular
> revert will address issues they might be investigating, and increases the
> chance folks might avoid the same mistakes if they're pursuing a similar
> direction in the future.
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113821: [LLDB][NativePDB] Fix image lookup by address

2021-11-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp:8
+// RUN: FileCheck --input-file=%t.out %s --check-prefix=NAME
+// RUN: address=`grep "Address:" %t.out | sed "s/.*Address: 
lookup-by-address.cpp.tmp.exe\[\(.*\)\].*/\1/"`
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -O "target create %t.exe" -o 
"image lookup -a $address" -o "exit" | FileCheck %s --check-prefix=ADDRESS

These fancy shell operations don't usually work on windows (which is pretty 
unfortunate, given this is a windows format).

Since the test executable will literally contain just the main function, maybe 
we could just pass a /base:BASE argument to the linker, and rely on the fact 
that the linker will place the function at BASE+0x1000 ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113821/new/

https://reviews.llvm.org/D113821

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits