[Lldb-commits] [PATCH] D112212: [lldb/test] Print build commands in trace mode

2021-10-22 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In D112212#3081828 , @JDevlieghere 
wrote:

> In D112212#3080491 , @teemperor 
> wrote:
>
>> This LGTM, but `shlex.join` is actually Py3 exclusive and I don't think 
>> there is a good Py2 replacement. I think we're just in time for the Py2->3 
>> migration according to the timeline Jonas posted last year 
>> , so 
>> let's use this patch to actually do that? Then we can also get rid of all 
>> the `six` stuff etc.
>>
>> Let's see if Jonas has any objections against dropping Py2 with this, 
>> otherwise this is good to go.
>
> We're planning to branch from open source on October 26th. If there's no 
> urgency, it would really be great if we can hold off breaking Py2 until then.
>
> I'm all in favor for getting rid of Python 2 support, but sweeping changes 
> like dropping the `six` stuff will introduce a lot of headaches (merge 
> conflicts) for us. If we could postpone that for another release that would 
> save us a bunch of engineering time.

No judgment (I think it's a reasonable request to punt a patch like this a few 
days if it helps out major contributors) - but I'm curious/just not quite 
wrapping my head around: Why would it be easier if this sort of patch went in 
after you branch? I'd have thought it'd be easier if it goes in before the 
branch. That way when you're backporting patches from upstream after the branch 
there will be fewer unrelated changes/merge conflicts, yeah?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112212

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


[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

this seems like a better solution. I like it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Jonas, let me know if this new layout works for you! I updated the tests for 
the new output format.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 381693.
clayborg added a comment.

Updated "statistics dump" command to always outout a dictionary that represents 
DebuggerStats. This means a top level dictionary will contain "modules", a list 
of all modules from the global module list, and "targets" which will be one 
target, or multiple if "--all" was supplied. With "modules" at the top level, 
it represents how modules are represented in LLDB better having them at the 
DebuggerStats level. Then target dictionaries can refer to these modules with 
"identifiers" which are unique integers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Target/Statistics.h
  lldb/source/API/SBTarget.cpp
  lldb/source/Commands/CommandObjectStats.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/source/Target/Statistics.cpp
  lldb/source/Target/Target.cpp
  lldb/test/API/commands/statistics/basic/TestStats.py
  lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py

Index: lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
===
--- lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
+++ lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
@@ -28,11 +28,16 @@
 stats = target.GetStatistics()
 stream = lldb.SBStream()
 res = stats.GetAsJSON(stream)
-stats_json = json.loads(stream.GetData())
+debug_stats = json.loads(stream.GetData())
+self.assertEqual('targets' in debug_stats, True,
+'Make sure the "targets" key in in target.GetStatistics()')
+self.assertEqual('modules' in debug_stats, True,
+'Make sure the "modules" key in in target.GetStatistics()')
+stats_json = debug_stats['targets'][0]
 self.assertEqual('expressionEvaluation' in stats_json, True,
-'Make sure the "expressionEvaluation" key in in target.GetStatistics()')
+'Make sure the "expressionEvaluation" key in in target.GetStatistics()["targets"][0]')
 self.assertEqual('frameVariable' in stats_json, True,
-'Make sure the "frameVariable" key in in target.GetStatistics()')
+'Make sure the "frameVariable" key in in target.GetStatistics()["targets"][0]')
 expressionEvaluation = stats_json['expressionEvaluation']
 self.assertEqual('successes' in expressionEvaluation, True,
 'Make sure the "successes" key in in "expressionEvaluation" dictionary"')
Index: lldb/test/API/commands/statistics/basic/TestStats.py
===
--- lldb/test/API/commands/statistics/basic/TestStats.py
+++ lldb/test/API/commands/statistics/basic/TestStats.py
@@ -82,12 +82,18 @@
 f.write(metrics_json)
 return json.loads(metrics_json)
 
+
+def get_target_stats(self, debug_stats):
+if "targets" in debug_stats:
+return debug_stats["targets"][0]
+return None
+
 def test_expressions_frame_var_counts(self):
 lldbutil.run_to_source_breakpoint(self, "// break here",
   lldb.SBFileSpec("main.c"))
 
 self.expect("expr patatino", substrs=['27'])
-stats = self.get_stats()
+stats = self.get_target_stats(self.get_stats())
 self.verify_success_fail_count(stats, 'expressionEvaluation', 1, 0)
 self.expect("expr doesnt_exist", error=True,
 substrs=["undeclared identifier 'doesnt_exist'"])
@@ -103,13 +109,13 @@
 self.expect("expr -Z 3 -- 1", error=True,
 substrs=["expression cannot be used with --element-count"])
 # We should have gotten 3 new failures and the previous success.
-stats = self.get_stats()
+stats = self.get_target_stats(self.get_stats())
 self.verify_success_fail_count(stats, 'expressionEvaluation', 2, 2)
 
 self.expect("statistics enable")
 # 'frame var' with enabled statistics will change stats.
 self.expect("frame var", substrs=['27'])
-stats = self.get_stats()
+stats = self.get_target_stats(self.get_stats())
 self.verify_success_fail_count(stats, 'frameVariable', 1, 0)
 
 def test_default_no_run(self):
@@ -123,22 +129,39 @@
 
 (lldb) statistics dump
 {
-  "targetCreateTime": 0.265668995,
-  "expressionEvaluation": {
-"failures": 0,
-"successes": 0
-  },
-  "frameVariable": {
-"failures": 0,
-"successes": 0
-

[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

After reading Jonas' comment about the module information being at the wrong 
level, I came up with a solution I think will work well. Instead of "statistics 
dump" emitting a dictionary for a single target when --all isn't specified, and 
then emitting a dictionary with a top level "targets" array when it is, we can 
always emit the top level dictionary that is equivalent to the DebuggerStats 
object. This top level dictionary will contain "modules" which is the global 
list of all modules that is currently loaded into LLDB, including all .o files 
from DWARF in .o, "targets" which is a list of target JSON stats, and then the 
total symbol table index/parse times are aggregated at this top level instead 
of in the target. The actual output now looks like:

  {
"modules": [
  {
"identifier": 5837856648,
"path": "/Users/gclayton/Documents/src/args/build/a.out",
"symbolTableIndexTime": 1.4625e-05,
"symbolTableParseTime": 0.000643833001,
"triple": "arm64-apple-macosx11.0.0",
"uuid": "B7F60DCD-68BF-3F2D-AE27-85253725636A"
  },
  {
"identifier": 5837128360,
"path": "/usr/lib/dyld",
"symbolTableIndexTime": 0.011349625,
"symbolTableParseTime": 0.00667604201,
"triple": "arm64e-apple-macosx11.6.0",
"uuid": "38657979-1ABE-3C9A-BF64-EF3B746216AB"
  },
],
"targets": [
  {
"expressionEvaluation": {
  "failures": 0,
  "successes": 0
},
"firstStopTime": 0.352985582,
"frameVariable": {
  "failures": 0,
  "successes": 0
},
"launchOrAttachTime": 0.3319405830001,
"moduleIdentifiers": [
  5837856648,
  5837128360
],
"targetCreateTime": 0.1691044580001
  }
],
"totalSymbolTableIndexTime": 0.04841712200014,
"totalSymbolTableParseTime": 0.0764286704
  }

Then each "target contains a "moduleIdentifiers" array, that identify the 
modules that are currently part of that target. Each module JSON now has a new 
"identifier" that can be matched up. We can't use the "UUID" from the module 
since not all modules have UUIDs.

Jonas, does this alleviate your concerns and fix the representation for the 
statistics?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/include/lldb/Target/Statistics.h:106
   StatsSuccessFail m_frame_var{"frameVariable"};
+  std::vector m_modules;
+

JDevlieghere wrote:
> As modules can span (and survive) targets, I'm confused this is part of the 
> target stats? 
In order to create performance tests that can track and identify regressions, 
and because modules have no backlink to the lldb_private::Target object that is 
eventually might get added to, we can't get any signal in how long a target 
takes to load up and parse the modules (and soon debug info) that the target 
contains without asking each module to report the time it took the parse/index 
itself. 

The stats of how long it took to load the module in the first place is very 
important information for tracking regressions. Not sure if there is a better 
way to do this. 

We could iterate over all of the modules from the global module list, but I do 
like the idea of adding up the contributions for a given target by iterating 
over its current modules. But if you have more than one debug session going, I 
would hate to report all of the modules from both targets, possibly including 
all of the .o files from DWARF in .o files and then try to make any sense of 
the information. 

One idea would be to emit stats on all modules in a top level list like 
"modules", which would contain all of the stats for all modules loaded into 
LLDB in the global module list, and then have a "targetModules" which could 
just be an array of UUID values that refer to the modules in the global 
"modules" list of dicts? But this still doesn't change the fact that 
aggregating the values at the target level would be off.

I am open to ideas on how to report this better. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112212: [lldb/test] Print build commands in trace mode

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D112212#3080491 , @teemperor wrote:

> This LGTM, but `shlex.join` is actually Py3 exclusive and I don't think there 
> is a good Py2 replacement. I think we're just in time for the Py2->3 
> migration according to the timeline Jonas posted last year 
> , so let's 
> use this patch to actually do that? Then we can also get rid of all the `six` 
> stuff etc.
>
> Let's see if Jonas has any objections against dropping Py2 with this, 
> otherwise this is good to go.

We're planning to branch from open source on October 26th. If there's no 
urgency, it would really be great if we can hold off breaking Py2 until then.

I'm all in favor for getting rid of Python 2 support, but sweeping changes like 
dropping the `six` stuff will introduce a lot of headaches (merge conflicts) 
for us. If we could postpone that for another release that would save us a 
bunch of engineering time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112212

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


[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Target/Statistics.h:106
   StatsSuccessFail m_frame_var{"frameVariable"};
+  std::vector m_modules;
+

As modules can span (and survive) targets, I'm confused this is part of the 
target stats? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112180: Libcpp bitset syntethic children and tests

2021-10-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 381655.
wallace added a comment.

nit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112180

Files:
  lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.h
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
+++ /dev/null
@@ -1,61 +0,0 @@
-"""
-Test lldb data formatter subsystem.
-"""
-
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class TestDataFormatterLibcxxBitset(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-def setUp(self):
-TestBase.setUp(self)
-
-primes = [1]*300
-primes[0] = primes[1] = 0
-for i in range(2, len(primes)):
-for j in range(2*i, len(primes), i):
-primes[j] = 0
-self.primes = primes
-
-def check(self, name, size):
-var = self.frame().FindVariable(name)
-self.assertTrue(var.IsValid())
-self.assertEqual(var.GetNumChildren(), size)
-for i in range(size):
-child = var.GetChildAtIndex(i)
-self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
-"variable: %s, index: %d"%(name, size))
-
-@add_test_categories(["libc++"])
-def test_value(self):
-"""Test that std::bitset is displayed correctly"""
-self.build()
-lldbutil.run_to_source_breakpoint(self, '// break here',
-lldb.SBFileSpec("main.cpp", False))
-
-self.check("empty", 0)
-self.check("small", 13)
-self.check("large", 200)
-
-@add_test_categories(["libc++"])
-def test_ptr_and_ref(self):
-"""Test that ref and ptr to std::bitset is displayed correctly"""
-self.build()
-(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(self,
-'Check ref and ptr',
-lldb.SBFileSpec("main.cpp", False))
-
-self.check("ref", 13)
-self.check("ptr", 13)
-
-lldbutil.continue_to_breakpoint(process, bkpt)
-
-self.check("ref", 200)
-self.check("ptr", 200)
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
@@ -1,27 +1,26 @@
 #include 
 #include 
 
-template
-void fill(std::bitset ) {
+template  void fill(std::bitset ) {
   b.set();
   b[0] = b[1] = false;
   for (std::size_t i = 2; i < N; ++i) {
-for (std::size_t j = 2*i; j < N; j+=i)
+for (std::size_t j = 2 * i; j < N; j += i)
   b[j] = false;
   }
 }
 
-template
+template 
 void by_ref_and_ptr(std::bitset , std::bitset *ptr) {
-// Check ref and ptr
-return;
+  // Check ref and ptr
+  return;
 }
 
 int main() {
   std::bitset<0> empty;
   std::bitset<13> small;
   fill(small);
-  std::bitset<200> large;
+  std::bitset<70> large;
   fill(large);
   by_ref_and_ptr(small, ); // break here
   by_ref_and_ptr(large, );
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
@@ -0,0 +1,250 @@
+"""
+Test lldb data formatter subsystem for bitset for libcxx and libstdcpp.
+"""
+
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+USE_LIBSTDCPP = "USE_LIBSTDCPP"
+USE_LIBCPP = "USE_LIBCPP"
+
+class GenericBitsetDataFormatterTestCase(TestBase):
+
+mydir = 

[Lldb-commits] [PATCH] D112180: Libcpp bitset syntethic children and tests

2021-10-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 381653.
wallace added a comment.

addressed all comments.
I was able to dedup all the implementation files and the tests, and indeed 
passing
the make flags to the build method was a good trick.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112180

Files:
  lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.h
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
+++ /dev/null
@@ -1,61 +0,0 @@
-"""
-Test lldb data formatter subsystem.
-"""
-
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class TestDataFormatterLibcxxBitset(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-def setUp(self):
-TestBase.setUp(self)
-
-primes = [1]*300
-primes[0] = primes[1] = 0
-for i in range(2, len(primes)):
-for j in range(2*i, len(primes), i):
-primes[j] = 0
-self.primes = primes
-
-def check(self, name, size):
-var = self.frame().FindVariable(name)
-self.assertTrue(var.IsValid())
-self.assertEqual(var.GetNumChildren(), size)
-for i in range(size):
-child = var.GetChildAtIndex(i)
-self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
-"variable: %s, index: %d"%(name, size))
-
-@add_test_categories(["libc++"])
-def test_value(self):
-"""Test that std::bitset is displayed correctly"""
-self.build()
-lldbutil.run_to_source_breakpoint(self, '// break here',
-lldb.SBFileSpec("main.cpp", False))
-
-self.check("empty", 0)
-self.check("small", 13)
-self.check("large", 200)
-
-@add_test_categories(["libc++"])
-def test_ptr_and_ref(self):
-"""Test that ref and ptr to std::bitset is displayed correctly"""
-self.build()
-(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(self,
-'Check ref and ptr',
-lldb.SBFileSpec("main.cpp", False))
-
-self.check("ref", 13)
-self.check("ptr", 13)
-
-lldbutil.continue_to_breakpoint(process, bkpt)
-
-self.check("ref", 200)
-self.check("ptr", 200)
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp
@@ -1,27 +1,26 @@
 #include 
 #include 
 
-template
-void fill(std::bitset ) {
+template  void fill(std::bitset ) {
   b.set();
   b[0] = b[1] = false;
   for (std::size_t i = 2; i < N; ++i) {
-for (std::size_t j = 2*i; j < N; j+=i)
+for (std::size_t j = 2 * i; j < N; j += i)
   b[j] = false;
   }
 }
 
-template
+template 
 void by_ref_and_ptr(std::bitset , std::bitset *ptr) {
-// Check ref and ptr
-return;
+  // Check ref and ptr
+  return;
 }
 
 int main() {
   std::bitset<0> empty;
   std::bitset<13> small;
   fill(small);
-  std::bitset<200> large;
+  std::bitset<70> large;
   fill(large);
   by_ref_and_ptr(small, ); // break here
   by_ref_and_ptr(large, );
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/TestDataFormatterGenericBitset.py
@@ -0,0 +1,250 @@
+"""
+Test lldb data formatter subsystem for bitset for libcxx and libstdcpp.
+"""
+
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from 

[Lldb-commits] [PATCH] D112279: Add modules stats into the "statistics dump" command.

2021-10-22 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

looks good, does anyone else have any objections?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112279

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


[Lldb-commits] [PATCH] D112046: [lldb/bindings] Change ScriptedThread initializer parameters

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Makes sense. LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112046

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


[Lldb-commits] [PATCH] D112047: [lldb/test] Update TestScriptedProcess to use skinny corefiles

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: 
lldb/examples/python/scripted_process/stack_core_scripted_process.py:1
+import os,struct,signal
+

This should live next to the test. I don't see a point of shipping this to 
users. 



Comment at: 
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py:94
 
-@skipIfDarwin
+def create_stack_skinny_corefile(self):
+self.build()

This function does more than creating a stack core file: it deletes the current 
target and replaces it with the stack core file one. I would split this up in 
two functions, and maybe pass in the temporary file so you can do 

```
with tempfile.NamedTemporaryFile() as file:
```

in the caller to make it clear what the scope of the temporary file is. 
Currently, I assume it gets garbage collected after this function exits? 



Comment at: 
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py:124
 
-scripted_process_example_relpath = 
['..','..','..','..','examples','python','scripted_process','my_scripted_process.py']
-self.runCmd("command script import " + 
os.path.join(self.getSourceDir(),
-
*scripted_process_example_relpath))
+os.environ['SKIP_SCRIPTED_PROCESS_LAUNCH'] = '1'
+self.runCmd("command script import " + 
os.path.join(self.scripted_process_example_abspath,

We should really find a better way to do this. Can you remind me why we can't 
pass that in the structured data? Other than for you test, I assume we rarely 
want a process launch for a scripted process, so maybe the default should be 
inverted. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112047

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


[Lldb-commits] [PATCH] D112046: [lldb/bindings] Change ScriptedThread initializer parameters

2021-10-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D112046#3081556 , @mib wrote:

> In D112046#3081547 , @JDevlieghere 
> wrote:
>
>> Given that there's a 1:1 mapping between the target and the process, why did 
>> you change the interface as opposed to say extracting the process from the 
>> target?
>
> A process is guaranteed to have a target, but the inverse is not true: if the 
> process didn't launch or failed to launch, the target has no process.

To add more to this, I can't think of any reason, at the moment, to create a 
ScriptedThread if you don't have ScriptedProcess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112046

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


[Lldb-commits] [PATCH] D112046: [lldb/bindings] Change ScriptedThread initializer parameters

2021-10-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D112046#3081547 , @JDevlieghere 
wrote:

> Given that there's a 1:1 mapping between the target and the process, why did 
> you change the interface as opposed to say extracting the process from the 
> target?

A process is guaranteed to have a target, but the inverse is not true: process 
didn't launch or failed to launch, the target has no process.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112046

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


[Lldb-commits] [PATCH] D111964: [lldb] [lldb-gdbserver] Unify listen/connect code to use ConnectionFileDescriptor

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 381645.
mgorny retitled this revision from "[lldb] [lldb-server] Allow any protocol 
supported by lldb" to "[lldb] [lldb-gdbserver] Unify listen/connect code to use 
ConnectionFileDescriptor".
mgorny edited the summary of this revision.
mgorny added a comment.

Turned it into an überpatch upgrading CFD and refactoring lldb-server to reduce 
duplication of code.


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

https://reviews.llvm.org/D111964

Files:
  lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/test/API/tools/lldb-server/TestPtyServer.py
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp

Index: lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
===
--- lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
+++ lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
@@ -43,3 +43,62 @@
 return;
   TestGetURI("::1");
 }
+
+TEST(ConnectionFileDescriptorUtilityTest, LLGSArgToURL) {
+  // LLGS new-style URLs should be passed through (indepenently of
+  // --reverse-connect)
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("listen://127.0.0.1:1234", false),
+   llvm::HasValue("listen://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("listen://127.0.0.1:1234", true),
+   llvm::HasValue("listen://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("connect://127.0.0.1:1234", false),
+   llvm::HasValue("connect://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("connect://127.0.0.1:1234", true),
+   llvm::HasValue("connect://127.0.0.1:1234"));
+
+  // LLGS legacy listen URLs should be converted if !reverse_connect
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("tcp://127.0.0.1:1234", false),
+   llvm::HasValue("listen://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("unix:///tmp/foo", false),
+   llvm::HasValue("unix-accept:///tmp/foo"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("unix-abstract://foo", false),
+   llvm::HasValue("unix-abstract-accept://foo"));
+
+  // LLGS listen host:port pairs should be converted to listen://
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("127.0.0.1:1234", false),
+   llvm::HasValue("listen://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("[::1]:1234", false),
+   llvm::HasValue("listen://[::1]:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("[[::1]:1234]", false),
+   llvm::HasValue("listen://[[::1]:1234]"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("localhost:1234", false),
+   llvm::HasValue("listen://localhost:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("*:1234", false),
+   llvm::HasValue("listen://*:1234"));
+
+  // LLGS listen :port special-case should be converted to listen://
+  EXPECT_THAT_EXPECTED(LLGSArgToURL(":1234", false),
+   llvm::HasValue("listen://localhost:1234"));
+
+  // LLGS listen UNIX sockets should be converted to unix-accept://
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("/tmp/foo", false),
+   llvm::HasValue("unix-accept:///tmp/foo"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("127.0.0.1", false),
+   llvm::HasValue("unix-accept://127.0.0.1"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("[::1]", false),
+   llvm::HasValue("unix-accept://[::1]"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("localhost", false),
+   llvm::HasValue("unix-accept://localhost"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL(":frobnicate", false),
+   llvm::HasValue("unix-accept://:frobnicate"));
+
+  // LLGS reverse connect host:port pairs should be converted to listen://
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("127.0.0.1:1234", true),
+   llvm::HasValue("connect://127.0.0.1:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("[::1]:1234", true),
+   llvm::HasValue("connect://[::1]:1234"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("[[::1]:1234]", true),
+   llvm::HasValue("connect://[[::1]:1234]"));
+  EXPECT_THAT_EXPECTED(LLGSArgToURL("localhost:1234", true),
+   llvm::HasValue("connect://localhost:1234"));
+}
Index: lldb/tools/lldb-server/lldb-gdbserver.cpp
===
--- lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -17,7 +17,6 @@
 #include 
 #endif
 
-#include "Acceptor.h"
 #include "LLDBServerUtilities.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
@@ -164,15 +163,14 @@
   }
 }
 
-Status writeSocketIdToPipe(Pipe _pipe, const std::string _id) {

[Lldb-commits] [PATCH] D112046: [lldb/bindings] Change ScriptedThread initializer parameters

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Given that there's a 1:1 mapping between the target and the process, why did 
you change the interface as opposed to say extracting the process from the 
target?




Comment at: lldb/examples/python/scripted_process/my_scripted_process.py:137
 % (__name__, MyScriptedProcess.__name__))
\ No newline at end of file


> No newline at end of file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112046

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


[Lldb-commits] [lldb] e4235bd - Fix locals naming in DNBArchMachARM64::GetGPRState for 32-bit builds

2021-10-22 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2021-10-22T13:24:25-07:00
New Revision: e4235bdf26a2dd3b678daad4581d8e8edbc1aa7b

URL: 
https://github.com/llvm/llvm-project/commit/e4235bdf26a2dd3b678daad4581d8e8edbc1aa7b
DIFF: 
https://github.com/llvm/llvm-project/commit/e4235bdf26a2dd3b678daad4581d8e8edbc1aa7b.diff

LOG: Fix locals naming in DNBArchMachARM64::GetGPRState for 32-bit builds

The local variables names used for logging when built on armv7k
weren't unique, resulting in build error.

rdar://84274006

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp 
b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
index 69a833303c93..305eb14de533 100644
--- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
@@ -157,9 +157,9 @@ kern_return_t DNBArchMachARM64::GetGPRState(bool force) {
 uint64_t log_pc = arm_thread_state64_get_pc(m_state.context.gpr);
 #else
 uint64_t log_fp = m_state.context.gpr.__fp;
-uint64_t log_fp = m_state.context.gpr.__lr;
-uint64_t log_fp = m_state.context.gpr.__sp;
-uint64_t log_fp = m_state.context.gpr.__pc,
+uint64_t log_lr = m_state.context.gpr.__lr;
+uint64_t log_sp = m_state.context.gpr.__sp;
+uint64_t log_pc = m_state.context.gpr.__pc,
 #endif
 DNBLogThreaded(
 "thread_get_state(0x%4.4x, %u, , %u) => 0x%8.8x (count = %u) regs"



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


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D112340#3081532 , @dblaikie wrote:

> Sorry I missed this - are these tested anywhere/should I have been able to 
> discover if these needed to be changed before I made the change?

TestCompactVectors tests this but its unfortunately marked as Darwin-only (as 
it includes the `Accelerate` framework). Providing a platform-neutral test that 
just typedef's the same things as Accelerate (in addition to the test including 
the real framework) seems like a good idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112340

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


[Lldb-commits] [PATCH] D112109: [lldb/Plugins] Serialize ProcessLaunchInfo ScriptedProcess Dictionary

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

I'd like to understand what the actual problem is and whether it can be avoided 
before we use a workaround like this. We have different places where we use 
structured data to communicate between Python and LLDB. What's special about 
this use case? If we really do need the workaround it would be good to keep 
that information somewhere so that the next person doesn't have to go through 
the same process.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112109

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


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

Sorry I missed this - are these tested anywhere/should I have been able to 
discover if these needed to be changed before I made the change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112340

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


Re: [Lldb-commits] [lldb] 71cfce8 - [lldb] Fix TestCompressedVectors after array type name change

2021-10-22 Thread David Blaikie via lldb-commits
Thanks for the fix! (is there a buildbot email I should've got (or did and
failed to understand) about this?)

On Fri, Oct 22, 2021 at 1:16 AM Raphael Isemann via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

>
> Author: Raphael Isemann
> Date: 2021-10-22T10:15:53+02:00
> New Revision: 71cfce832054dfea8e79769f15a3fdc05d23b733
>
> URL:
> https://github.com/llvm/llvm-project/commit/71cfce832054dfea8e79769f15a3fdc05d23b733
> DIFF:
> https://github.com/llvm/llvm-project/commit/71cfce832054dfea8e79769f15a3fdc05d23b733.diff
>
> LOG: [lldb] Fix TestCompressedVectors after array type name change
>
> aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7 turns array names such as `int
> [1]`
> into `int[1]` (without the space). This probably breaks some user
> formatters,
> but let's first get this test running while this is being discussed.
>
> Added:
>
>
> Modified:
>
> lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
>
> Removed:
>
>
>
>
> 
> diff  --git
> a/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
> b/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
> index 4b36d02da14df..d7d5579b5fdbc 100644
> ---
> a/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
> +++
> b/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
> @@ -49,8 +49,8 @@ def cleanup():
>  substrs=[
>  '(vFloat) valueFL = (1.25, 0, 0.25, 0)',
>  '(vDouble) valueDL = (1.25, 2.25)',
> -'(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
> -'(int32_t [4]) valueI32 = (1, 0, 4, 0)',
> +'(int16_t[8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
> +'(int32_t[4]) valueI32 = (1, 0, 4, 0)',
>  '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01,
> 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
>  '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
>  '(vUInt32) valueU32 = (1, 2, 3, 4)',
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG42e4959253e0: [lldb/Formatters] Remove space from vector 
type string summaries (NFCI) (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112340

Files:
  lldb/source/DataFormatters/FormatManager.cpp


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -773,14 +773,11 @@
 
   AddStringSummary(vectors_category_sp, "${var.uint128}",
ConstString("builtin_type_vec128"), vector_flags);
-
-  // FIXME: These probably need the space removed, or made optional - but are
-  // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -773,14 +773,11 @@
 
   AddStringSummary(vectors_category_sp, "${var.uint128}",
ConstString("builtin_type_vec128"), vector_flags);
-
-  // FIXME: These probably need the space removed, or made optional - but are
-  // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 42e4959 - [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2021-10-22T21:18:54+02:00
New Revision: 42e4959253e0045a70ff9d8dcb664ce38434e302

URL: 
https://github.com/llvm/llvm-project/commit/42e4959253e0045a70ff9d8dcb664ce38434e302
DIFF: 
https://github.com/llvm/llvm-project/commit/42e4959253e0045a70ff9d8dcb664ce38434e302.diff

LOG: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

This patch changes the string summaries for vector types by removing the
space between the type and the bracket, conforming to 277623f4d5a6.

This should also fix TestCompactVectors failure.

Differential Revision: https://reviews.llvm.org/D112340

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/DataFormatters/FormatManager.cpp

Removed: 




diff  --git a/lldb/source/DataFormatters/FormatManager.cpp 
b/lldb/source/DataFormatters/FormatManager.cpp
index 92171b67fe96..cda1ae60d857 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -773,14 +773,11 @@ void FormatManager::LoadVectorFormatters() {
 
   AddStringSummary(vectors_category_sp, "${var.uint128}",
ConstString("builtin_type_vec128"), vector_flags);
-
-  // FIXME: These probably need the space removed, or made optional - but are
-  // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);



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


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 381629.
mib added a comment.

Remove FIXME


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112340

Files:
  lldb/source/DataFormatters/FormatManager.cpp


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -773,14 +773,11 @@
 
   AddStringSummary(vectors_category_sp, "${var.uint128}",
ConstString("builtin_type_vec128"), vector_flags);
-
-  // FIXME: These probably need the space removed, or made optional - but are
-  // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -773,14 +773,11 @@
 
   AddStringSummary(vectors_category_sp, "${var.uint128}",
ConstString("builtin_type_vec128"), vector_flags);
-
-  // FIXME: These probably need the space removed, or made optional - but are
-  // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

Please also remove the FIXME, LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112340

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


[Lldb-commits] [PATCH] D112340: [lldb/Formatters] Remove space from vector type string summaries (NFCI)

2021-10-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added a reviewer: dblaikie.
mib added a project: LLDB.
Herald added a subscriber: JDevlieghere.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

This patch changes the string summaries for vector types by removing the
space between the type and the bracket, conforming to 277623f4d5a6 
.

This should also fix TestCompactVectors failure.

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112340

Files:
  lldb/source/DataFormatters/FormatManager.cpp


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -776,11 +776,11 @@
 
   // FIXME: These probably need the space removed, or made optional - but are
   // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);


Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -776,11 +776,11 @@
 
   // FIXME: These probably need the space removed, or made optional - but are
   // they even tested?
-  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("float[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t[4]"),
vector_flags);
-  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t[8]"),
vector_flags);
   AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
vector_flags);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112147: [lldb] Fix lookup for global constants in namespaces

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3281-3282
 if ((parent_tag == DW_TAG_compile_unit ||
- parent_tag == DW_TAG_partial_unit) &&
+ parent_tag == DW_TAG_partial_unit ||
+ parent_tag == DW_TAG_namespace) &&
 Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU(

I think we should just always call this function in regardless of what the 
parent variable tag is since what happens if the parent tag is another value 
decl context like DW_TAG_class_type, DW_TAG_structure_type? 

The call to GetDWARFDeclContext(die) below will calculate the DWARFDeclContext 
for a DIE and then construct an appropriate qualified name, so we can just 
always do this so I would suggest just making this:

```
if (Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU(
  mangled = 
GetDWARFDeclContext(die).GetQualifiedNameAsConstString().GetCString();
```
Then we should always get this right all the time. It doesn't actually make 
sense to call this if the parent is the DW_TAG_compile_unit or 
DW_TAG_partial_unit because then there is no decl context to add to the 
variable name.



Comment at: lldb/test/API/lang/cpp/global_variables/main.cpp:5
+int g_file_global_int = 42;
+const int g_file_global_const_int = 1337;
 }

might be nice to see if we can create constants inside of a class or struct as 
well as mentioned in the above inline comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112147

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


[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f12cf7ebaaf: [lldb] Pass the target triple when determining 
the DWARF version (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D112325?vs=381575=381591#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112325

Files:
  lldb/packages/Python/lldbsuite/test/builders/builder.py
  lldb/packages/Python/lldbsuite/test/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1347,15 +1347,18 @@
 return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
+triple = builder_module().getTriple(self.getArchitecture())
+target = ['-target', triple] if triple else []
 driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+[self.getCompiler()] + target + '-g -c -x c - -o - 
-###'.split(),
 stderr=STDOUT)
 driver_output = driver_output.decode("utf-8")
 for line in driver_output.split(os.linesep):
 m = re.search('dwarf-version=([0-9])', line)
 if m:
 return m.group(1)
-except: pass
+except CalledProcessError:
+pass
 return '0'
 
 def platformIsDarwin(self):
Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -55,6 +55,13 @@
 
 
 class BuilderDarwin(Builder):
+def getTriple(self, arch):
+vendor, os, version, env = get_triple()
+components = [arch, vendor, os, version, env]
+if None in components:
+return None
+return '-'.join(components)
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This
Index: lldb/packages/Python/lldbsuite/test/builders/builder.py
===
--- lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -21,6 +21,10 @@
 compiler = lldbutil.which(compiler)
 return os.path.abspath(compiler)
 
+def getTriple(self, arch):
+"""Returns the triple for the given architecture or None."""
+return None
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1347,15 +1347,18 @@
 return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
+triple = builder_module().getTriple(self.getArchitecture())
+target = ['-target', triple] if triple else []
 driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(),
 stderr=STDOUT)
 driver_output = driver_output.decode("utf-8")
 for line in driver_output.split(os.linesep):
 m = re.search('dwarf-version=([0-9])', line)
 if m:
 return m.group(1)
-except: pass
+except CalledProcessError:
+pass
 return '0'
 
 def platformIsDarwin(self):
Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -55,6 +55,13 @@
 
 
 class BuilderDarwin(Builder):
+def getTriple(self, arch):
+vendor, os, version, env = get_triple()
+components = [arch, vendor, os, version, env]
+if None in components:
+return None
+return '-'.join(components)
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This
Index: lldb/packages/Python/lldbsuite/test/builders/builder.py

[Lldb-commits] [lldb] 0f12cf7 - [lldb] Pass the target triple when determining the DWARF version

2021-10-22 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-10-22T10:13:24-07:00
New Revision: 0f12cf7ebaaf9f2a52be3baef7d25562a5ac15cb

URL: 
https://github.com/llvm/llvm-project/commit/0f12cf7ebaaf9f2a52be3baef7d25562a5ac15cb
DIFF: 
https://github.com/llvm/llvm-project/commit/0f12cf7ebaaf9f2a52be3baef7d25562a5ac15cb.diff

LOG: [lldb] Pass the target triple when determining the DWARF version

When targeting iOS, the default dwarf version is 2 and not 4. Currently,
the test suite does not pick up on that because it invokes the test
compiler without a target triple. This patch fixes that and now
correctly skips tests that have a dwarf version specified in a skipIf
decorator.

rdar://84530477

Differential revision: https://reviews.llvm.org/D112325

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/builders/builder.py
lldb/packages/Python/lldbsuite/test/builders/darwin.py
lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py 
b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 38e64220ed63..8b17b585ae6c 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -21,6 +21,10 @@ def getCompiler(self):
 compiler = lldbutil.which(compiler)
 return os.path.abspath(compiler)
 
+def getTriple(self, arch):
+"""Returns the triple for the given architecture or None."""
+return None
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This

diff  --git a/lldb/packages/Python/lldbsuite/test/builders/darwin.py 
b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
index 360533f7ad6b..e182f2d70b02 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -55,6 +55,13 @@ def get_triple():
 
 
 class BuilderDarwin(Builder):
+def getTriple(self, arch):
+vendor, os, version, env = get_triple()
+components = [arch, vendor, os, version, env]
+if None in components:
+return None
+return '-'.join(components)
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 169f43f59c2f..3ba3084690fa 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1347,15 +1347,18 @@ def getDwarfVersion(self):
 return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
+triple = builder_module().getTriple(self.getArchitecture())
+target = ['-target', triple] if triple else []
 driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+[self.getCompiler()] + target + '-g -c -x c - -o - 
-###'.split(),
 stderr=STDOUT)
 driver_output = driver_output.decode("utf-8")
 for line in driver_output.split(os.linesep):
 m = re.search('dwarf-version=([0-9])', line)
 if m:
 return m.group(1)
-except: pass
+except CalledProcessError:
+pass
 return '0'
 
 def platformIsDarwin(self):



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


[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version

2021-10-22 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Thanks! Lgtm as well, but with the same nits as Raphael.


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

https://reviews.llvm.org/D112325

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


[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version

2021-10-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

Some nits but otherwise LGTM




Comment at: lldb/packages/Python/lldbsuite/test/builders/builder.py:26
+"""Returns the triple for the given architecture or an empty string."""
+return ""
+

Maybe return `None`? Then the calling code crashes if it doesn't handle the 
value instead of silently picking the next arg as some bogus triple value.



Comment at: lldb/packages/Python/lldbsuite/test/builders/darwin.py:60
+vendor, os, version, env = get_triple()
+if arch is None or vendor is None or os is None or version is None or 
env is None:
+return ""


```
lang=python
values = [arch, vendor, os, version, env]
if None in values:
return ""
return '-'.join(values)
```


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

https://reviews.llvm.org/D112325

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


[Lldb-commits] [PATCH] D112310: [lldb/DWARF] Don't create lldb_private::Functions for gc'ed DW_TAG_subprograms

2021-10-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Thanks for getting to this, this will be nice to avoid creating extra DWARF!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112310

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


[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version

2021-10-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, teemperor, vsk.
JDevlieghere requested review of this revision.

When targeting iOS, the default dwarf version is 2 and not 4. Currently, the 
test suite does not pick up on that because it invokes the test compiler 
without a target triple. This patch fixes that and now correctly skips tests 
that have a dwarf version specified in a `skipIf` decorator.


https://reviews.llvm.org/D112325

Files:
  lldb/packages/Python/lldbsuite/test/builders/builder.py
  lldb/packages/Python/lldbsuite/test/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1347,15 +1347,19 @@
 return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
+module = builder_module()
+triple = module.getTriple(self.getArchitecture())
+target = ['-target', triple] if triple else []
 driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+[self.getCompiler()] + target + '-g -c -x c - -o - 
-###'.split(),
 stderr=STDOUT)
 driver_output = driver_output.decode("utf-8")
 for line in driver_output.split(os.linesep):
 m = re.search('dwarf-version=([0-9])', line)
 if m:
 return m.group(1)
-except: pass
+except CalledProcessError:
+pass
 return '0'
 
 def platformIsDarwin(self):
Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -55,6 +55,12 @@
 
 
 class BuilderDarwin(Builder):
+def getTriple(self, arch):
+vendor, os, version, env = get_triple()
+if arch is None or vendor is None or os is None or version is None or 
env is None:
+return ""
+return '-'.join([arch, vendor, os, version, env])
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This
Index: lldb/packages/Python/lldbsuite/test/builders/builder.py
===
--- lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -21,6 +21,10 @@
 compiler = lldbutil.which(compiler)
 return os.path.abspath(compiler)
 
+def getTriple(self, arch):
+"""Returns the triple for the given architecture or an empty string."""
+return ""
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. This


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1347,15 +1347,19 @@
 return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
+module = builder_module()
+triple = module.getTriple(self.getArchitecture())
+target = ['-target', triple] if triple else []
 driver_output = check_output(
-[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
+[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(),
 stderr=STDOUT)
 driver_output = driver_output.decode("utf-8")
 for line in driver_output.split(os.linesep):
 m = re.search('dwarf-version=([0-9])', line)
 if m:
 return m.group(1)
-except: pass
+except CalledProcessError:
+pass
 return '0'
 
 def platformIsDarwin(self):
Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -55,6 +55,12 @@
 
 
 class BuilderDarwin(Builder):
+def getTriple(self, arch):
+vendor, os, version, env = get_triple()
+if arch is None or vendor is None or os is None or version is None or env is None:
+return ""
+return '-'.join([arch, vendor, os, version, env])
+
 def getExtraMakeArgs(self):
 """
 Helper function to return extra argumentsfor the make system. 

[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 marked an inline comment as done.
Ericson2314 added a comment.

Respond to last open thing




Comment at: llvm/CMakeLists.txt:589
 CACHE STRING "Doxygen-generated HTML documentation install directory")
-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
+set(LLVM_INSTALL_OCAMLDOC_HTML_DIR 
"${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
 CACHE STRING "OCamldoc-generated HTML documentation install directory")

Ericson2314 wrote:
> Ericson2314 wrote:
> > compnerd wrote:
> > > Why the change from `llvm` -> `${project}`?  (not that it really makes a 
> > > difference)
> > To be honest, I forgot. I might have just been OCD deduping on the fly. 
> > Happy to change back,
> Which would you like me to do, @compnerd?
Erred on the size of caution and put it back.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 379975.
Ericson2314 added a comment.

Skip ${project} change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

Files:
  clang/tools/scan-build/CMakeLists.txt
  libclc/CMakeLists.txt
  lldb/cmake/modules/FindLibEdit.cmake
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/AddSphinxTarget.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/docs/CMake.rst
  llvm/examples/Bye/CMakeLists.txt
  llvm/include/llvm/CMakeLists.txt
  llvm/tools/llvm-config/BuildVariables.inc.in
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/tools/lto/CMakeLists.txt
  llvm/tools/opt-viewer/CMakeLists.txt
  llvm/tools/remarks-shlib/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt

Index: openmp/runtime/src/CMakeLists.txt
===
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -323,7 +323,7 @@
 install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
   \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
 install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
-  \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
+  \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
   endforeach()
 else()
 
@@ -335,7 +335,7 @@
 foreach(alias IN LISTS LIBOMP_ALIASES)
   install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
 \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
-\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
+\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
 endforeach()
   endif()
 endif()
Index: llvm/tools/remarks-shlib/CMakeLists.txt
===
--- llvm/tools/remarks-shlib/CMakeLists.txt
+++ llvm/tools/remarks-shlib/CMakeLists.txt
@@ -19,7 +19,7 @@
   endif()
   
   install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
-DESTINATION include/llvm-c
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
 COMPONENT Remarks)
 
   if (APPLE)
Index: llvm/tools/opt-viewer/CMakeLists.txt
===
--- llvm/tools/opt-viewer/CMakeLists.txt
+++ llvm/tools/opt-viewer/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 foreach (file ${files})
   install(PROGRAMS ${file}
-DESTINATION share/opt-viewer
+DESTINATION "${CMAKE_INSTALL_DATADIR}/opt-viewer"
 COMPONENT opt-viewer)
 endforeach (file)
 
Index: llvm/tools/lto/CMakeLists.txt
===
--- llvm/tools/lto/CMakeLists.txt
+++ llvm/tools/lto/CMakeLists.txt
@@ -33,7 +33,7 @@
 ${SOURCES} DEPENDS intrinsics_gen)
 
 install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
-  DESTINATION include/llvm-c
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
   COMPONENT LTO)
 
 if (APPLE)
Index: llvm/tools/llvm-config/llvm-config.cpp
===
--- llvm/tools/llvm-config/llvm-config.cpp
+++ llvm/tools/llvm-config/llvm-config.cpp
@@ -357,10 +357,16 @@
 ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
   } else {
 ActivePrefix = CurrentExecPrefix;
-ActiveIncludeDir = ActivePrefix + "/include";
-SmallString<256> path(LLVM_TOOLS_INSTALL_DIR);
-sys::fs::make_absolute(ActivePrefix, path);
-ActiveBinDir = std::string(path.str());
+{
+  SmallString<256> Path(LLVM_INSTALL_INCLUDEDIR);
+  sys::fs::make_absolute(ActivePrefix, Path);
+  ActiveIncludeDir = std::string(Path.str());
+}
+{
+  SmallString<256> Path(LLVM_INSTALL_BINDIR);
+  sys::fs::make_absolute(ActivePrefix, Path);
+  ActiveBinDir = std::string(Path.str());
+}
 ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
 ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
 ActiveIncludeOption = "-I" + ActiveIncludeDir;
Index: llvm/tools/llvm-config/BuildVariables.inc.in
===
--- llvm/tools/llvm-config/BuildVariables.inc.in
+++ llvm/tools/llvm-config/BuildVariables.inc.in
@@ -23,6 +23,8 @@
 #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
 #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
 #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
 #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
Index: 

[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 379976.
Ericson2314 added a comment.

Rebase again because previous diff changed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -86,10 +88,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -83,14 +83,15 @@
 set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+get_filename_component(base_includedir "${CMAKE_INSTALL_INCLUDEDIR}" ABSOLUTE BASE_DIR "${POLLY_INSTALL_PREFIX}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
-"${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -100,12 +101,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/")
   endif()
 
-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
 
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
Index: polly/CMakeLists.txt
===
--- 

[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 marked 2 inline comments as done.
Ericson2314 added a comment.

Removed extraneous StringRef conversion after previous D111322 
 was landed.




Comment at: llvm/tools/llvm-config/llvm-config.cpp:361
+{
+  SmallString<256> Path(StringRef(LLVM_INSTALL_INCLUDEDIR));
+  sys::fs::make_absolute(ActivePrefix, Path);

Ericson2314 wrote:
> Ericson2314 wrote:
> > Ericson2314 wrote:
> > > compnerd wrote:
> > > > Why the temporary `StringRef`?  Can you not just initialize `Path` with 
> > > > the literal?
> > > I'm not sure. I would think so too, but the old code was also using 
> > > `StringRef` so I just followed cargo culted and went with it.
> > Should I, say, submit a separate patch trying to remove the existing one?
> I opened D111322  for this. If that passes CI and lands, I have the next 
> version of this without `StringRef` ready to go.
Fix issue now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 378392.
Ericson2314 added a comment.
Herald added a project: Flang.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -86,10 +88,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -83,14 +83,15 @@
 set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+get_filename_component(base_includedir "${CMAKE_INSTALL_INCLUDEDIR}" ABSOLUTE BASE_DIR "${POLLY_INSTALL_PREFIX}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
-"${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -100,12 +101,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/")
   endif()
 
-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
 
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
Index: polly/CMakeLists.txt
===
--- 

[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 378391.
Ericson2314 added a comment.

Rebase, avoid extra string ref conversions in llvm-config


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

Files:
  clang/tools/scan-build/CMakeLists.txt
  libclc/CMakeLists.txt
  lldb/cmake/modules/FindLibEdit.cmake
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/AddSphinxTarget.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/docs/CMake.rst
  llvm/examples/Bye/CMakeLists.txt
  llvm/include/llvm/CMakeLists.txt
  llvm/tools/llvm-config/BuildVariables.inc.in
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/tools/lto/CMakeLists.txt
  llvm/tools/opt-viewer/CMakeLists.txt
  llvm/tools/remarks-shlib/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt

Index: openmp/runtime/src/CMakeLists.txt
===
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -323,7 +323,7 @@
 install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
   \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)")
 install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
-  \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
+  \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
   endforeach()
 else()
 
@@ -335,7 +335,7 @@
 foreach(alias IN LISTS LIBOMP_ALIASES)
   install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
 \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
-\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
+\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
 endforeach()
   endif()
 endif()
Index: llvm/tools/remarks-shlib/CMakeLists.txt
===
--- llvm/tools/remarks-shlib/CMakeLists.txt
+++ llvm/tools/remarks-shlib/CMakeLists.txt
@@ -19,7 +19,7 @@
   endif()
   
   install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
-DESTINATION include/llvm-c
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
 COMPONENT Remarks)
 
   if (APPLE)
Index: llvm/tools/opt-viewer/CMakeLists.txt
===
--- llvm/tools/opt-viewer/CMakeLists.txt
+++ llvm/tools/opt-viewer/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 foreach (file ${files})
   install(PROGRAMS ${file}
-DESTINATION share/opt-viewer
+DESTINATION "${CMAKE_INSTALL_DATADIR}/opt-viewer"
 COMPONENT opt-viewer)
 endforeach (file)
 
Index: llvm/tools/lto/CMakeLists.txt
===
--- llvm/tools/lto/CMakeLists.txt
+++ llvm/tools/lto/CMakeLists.txt
@@ -33,7 +33,7 @@
 ${SOURCES} DEPENDS intrinsics_gen)
 
 install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
-  DESTINATION include/llvm-c
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
   COMPONENT LTO)
 
 if (APPLE)
Index: llvm/tools/llvm-config/llvm-config.cpp
===
--- llvm/tools/llvm-config/llvm-config.cpp
+++ llvm/tools/llvm-config/llvm-config.cpp
@@ -357,10 +357,16 @@
 ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
   } else {
 ActivePrefix = CurrentExecPrefix;
-ActiveIncludeDir = ActivePrefix + "/include";
-SmallString<256> path(LLVM_TOOLS_INSTALL_DIR);
-sys::fs::make_absolute(ActivePrefix, path);
-ActiveBinDir = std::string(path.str());
+{
+  SmallString<256> Path(LLVM_INSTALL_INCLUDEDIR);
+  sys::fs::make_absolute(ActivePrefix, Path);
+  ActiveIncludeDir = std::string(Path.str());
+}
+{
+  SmallString<256> Path(LLVM_INSTALL_BINDIR);
+  sys::fs::make_absolute(ActivePrefix, Path);
+  ActiveBinDir = std::string(Path.str());
+}
 ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
 ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
 ActiveIncludeOption = "-I" + ActiveIncludeDir;
Index: llvm/tools/llvm-config/BuildVariables.inc.in
===
--- llvm/tools/llvm-config/BuildVariables.inc.in
+++ llvm/tools/llvm-config/BuildVariables.inc.in
@@ -23,6 +23,8 @@
 #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
 #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
 #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
 #define LLVM_BUILD_SYSTEM 

[Lldb-commits] [PATCH] D111454: Move TargetRegistry.(h|cpp) from Support to MC

2021-10-22 Thread Lang Hames via Phabricator via lldb-commits
lhames added a comment.

Yeah -- this seems like a good idea to me. Thanks Reid!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111454

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


[Lldb-commits] [PATCH] D111454: Move TargetRegistry.(h|cpp) from Support to MC

2021-10-22 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111454

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


[Lldb-commits] [PATCH] D111454: Move TargetRegistry.(h|cpp) from Support to MC

2021-10-22 Thread Duncan P. N. Exon Smith via Phabricator via lldb-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111454

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


[Lldb-commits] [PATCH] D111454: Move TargetRegistry.(h|cpp) from Support to MC

2021-10-22 Thread Reid Kleckner via Phabricator via lldb-commits
rnk added a comment.

Thanks for the review! I uploaded it a bit quickly because I wanted to kick off 
Bazel presubmit testing, since I haven't replicated that locally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111454

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


[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-10-22 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added inline comments.



Comment at: llvm/tools/llvm-config/llvm-config.cpp:361
+{
+  SmallString<256> Path(StringRef(LLVM_INSTALL_INCLUDEDIR));
+  sys::fs::make_absolute(ActivePrefix, Path);

Ericson2314 wrote:
> Ericson2314 wrote:
> > compnerd wrote:
> > > Why the temporary `StringRef`?  Can you not just initialize `Path` with 
> > > the literal?
> > I'm not sure. I would think so too, but the old code was also using 
> > `StringRef` so I just followed cargo culted and went with it.
> Should I, say, submit a separate patch trying to remove the existing one?
I opened D111322  for this. If that passes CI and lands, I have the next 
version of this without `StringRef` ready to go.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D111454: Move TargetRegistry.(h|cpp) from Support to MC

2021-10-22 Thread Duncan P. N. Exon Smith via Phabricator via lldb-commits
dexonsmith added a comment.

Seems like a reasonable move to me.




Comment at: llvm/include/llvm/MC/TargetRegistry.h:18-19
 
 #ifndef LLVM_SUPPORT_TARGETREGISTRY_H
 #define LLVM_SUPPORT_TARGETREGISTRY_H
 

Should be `LLVM_MC_TARGETREGISTRY_H` now.



Comment at: llvm/include/llvm/MC/TargetRegistry.h:1376
 
 #endif // LLVM_SUPPORT_TARGETREGISTRY_H

Same here.



Comment at: llvm/lib/MC/TargetRegistry.cpp:52-53
 if (!TheTarget) {
-  Error = ": error: unable to get target for '"
-+ TheTriple.getTriple()
-+ "', see --version and --triple.\n";
+  Error = ": error: unable to get target for '" + TheTriple.getTriple() +
+  "', see --version and --triple.\n";
   return nullptr;

I'm guessing this formatting crept in because of the file move (also in the 
header). Might be nice to reduce the diff by clang-formatting the two files 
ahead of time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111454

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


[Lldb-commits] [PATCH] D112314: [lldb] [Utility/UriParser] Return results as 'struct URI'

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 381535.
mgorny added a comment.

Replace `UriParser::Parse()` with `URI::Parse()`. Simplify tests.


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

https://reviews.llvm.org/D112314

Files:
  lldb/include/lldb/Utility/UriParser.h
  lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Utility/UriParser.cpp
  lldb/tools/lldb-server/Acceptor.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
  lldb/unittests/Host/SocketTest.cpp
  lldb/unittests/Utility/UriParserTest.cpp

Index: lldb/unittests/Utility/UriParserTest.cpp
===
--- lldb/unittests/Utility/UriParserTest.cpp
+++ lldb/unittests/Utility/UriParserTest.cpp
@@ -3,174 +3,95 @@
 
 using namespace lldb_private;
 
-// result strings (scheme/hostname/port/path) passed into UriParser::Parse
-// are initialized to kAsdf so we can verify that they are unmodified if the
-// URI is invalid
-static const char *kAsdf = "asdf";
-
-class UriTestCase {
-public:
-  UriTestCase(const char *uri, const char *scheme, const char *hostname,
-  llvm::Optional port, const char *path)
-  : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
-m_port(port), m_path(path) {}
-
-  UriTestCase(const char *uri)
-  : m_uri(uri), m_result(false), m_scheme(kAsdf), m_hostname(kAsdf),
-m_port(1138), m_path(kAsdf) {}
-
-  const char *m_uri;
-  bool m_result;
-  const char *m_scheme;
-  const char *m_hostname;
-  llvm::Optional m_port;
-  const char *m_path;
-};
-
-#define VALIDATE   \
-  llvm::StringRef scheme(kAsdf);   \
-  llvm::StringRef hostname(kAsdf); \
-  llvm::Optional port(1138); \
-  llvm::StringRef path(kAsdf); \
-  EXPECT_EQ(testCase.m_result, \
-UriParser::Parse(testCase.m_uri, scheme, hostname, port, path));   \
-  EXPECT_STREQ(testCase.m_scheme, scheme.str().c_str());   \
-  EXPECT_STREQ(testCase.m_hostname, hostname.str().c_str());   \
-  EXPECT_EQ(testCase.m_port, port);\
-  EXPECT_STREQ(testCase.m_path, path.str().c_str());
-
 TEST(UriParserTest, Minimal) {
-  const UriTestCase testCase("x://y", "x", "y", llvm::None, "/");
-  VALIDATE
+  EXPECT_EQ((URI{"x", "y", llvm::None, "/"}), URI::Parse("x://y"));
 }
 
 TEST(UriParserTest, MinimalPort) {
-  const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
-  llvm::StringRef scheme(kAsdf);
-  llvm::StringRef hostname(kAsdf);
-  llvm::Optional port(1138);
-  llvm::StringRef path(kAsdf);
-  bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
-  EXPECT_EQ(testCase.m_result, result);
-
-  EXPECT_STREQ(testCase.m_scheme, scheme.str().c_str());
-  EXPECT_STREQ(testCase.m_hostname, hostname.str().c_str());
-  EXPECT_EQ(testCase.m_port, port);
-  EXPECT_STREQ(testCase.m_path, path.str().c_str());
+  EXPECT_EQ((URI{"x", "y", 1, "/"}), URI::Parse("x://y:1"));
 }
 
 TEST(UriParserTest, MinimalPath) {
-  const UriTestCase testCase("x://y/", "x", "y", llvm::None, "/");
-  VALIDATE
+  EXPECT_EQ((URI{"x", "y", llvm::None, "/"}), URI::Parse("x://y/"));
 }
 
 TEST(UriParserTest, MinimalPortPath) {
-  const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
-  VALIDATE
+  EXPECT_EQ((URI{"x", "y", 1, "/"}), URI::Parse("x://y:1/"));
 }
 
 TEST(UriParserTest, LongPath) {
-  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", llvm::None,
- "/abc/def/xyz");
-  VALIDATE
+  EXPECT_EQ((URI{"x", "y", llvm::None, "/abc/def/xyz"}),
+URI::Parse("x://y/abc/def/xyz"));
 }
 
 TEST(UriParserTest, TypicalPortPathIPv4) {
-  const UriTestCase testCase("connect://192.168.100.132:5432/", "connect",
- "192.168.100.132", 5432, "/");
-  VALIDATE;
+  EXPECT_EQ((URI{"connect", "192.168.100.132", 5432, "/"}),
+URI::Parse("connect://192.168.100.132:5432/"));
 }
 
 TEST(UriParserTest, TypicalPortPathIPv6) {
-  const UriTestCase testCase(
-  "connect://[2601:600:107f:db64:a42b:4faa:284:3082]:5432/", "connect",
-  "2601:600:107f:db64:a42b:4faa:284:3082", 5432, "/");
-  VALIDATE;
+  EXPECT_EQ(
+  (URI{"connect", "2601:600:107f:db64:a42b:4faa:284:3082", 5432, "/"}),
+  URI::Parse("connect://[2601:600:107f:db64:a42b:4faa:284:3082]:5432/"));
 }
 
 TEST(UriParserTest, BracketedHostnamePort) {
-  const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect",
- 

[Lldb-commits] [PATCH] D112314: [lldb] [Utility/UriParser] Return results as 'struct URI'

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

nice




Comment at: lldb/include/lldb/Utility/UriParser.h:31-34
 class UriParser {
 public:
-  // Parses
-  // RETURN VALUE
-  //   if url is valid, function returns true and
-  //   scheme/hostname/port/path are set to the parsed values
-  //   port it set to llvm::None if it is not included in the URL
-  //
-  //   if the url is invalid, function returns false and
-  //   output parameters remain unchanged
-  static bool Parse(llvm::StringRef uri, llvm::StringRef ,
-llvm::StringRef , llvm::Optional ,
-llvm::StringRef );
+  static llvm::Optional Parse(llvm::StringRef uri);
 };

As we're touching these anyway, let's also move the parse method into the URI 
class. Having a separate class for a single static method is (and was) useless.



Comment at: lldb/unittests/Utility/UriParserTest.cpp:6-16
 class UriTestCase {
 public:
   UriTestCase(const char *uri, const char *scheme, const char *hostname,
   llvm::Optional port, const char *path)
-  : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
-m_port(port), m_path(path) {}
+  : m_uri(uri), m_result(URI{scheme, hostname, port, path}) {}
 
+  UriTestCase(const char *uri) : m_uri(uri), m_result(llvm::None) {}

I don't think this class makes sense anymore. You can just inline the values.


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

https://reviews.llvm.org/D112314

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


[Lldb-commits] [PATCH] D112314: [lldb] [Utility/UriParser] Return results as 'struct URI'

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, teemperor, krytarowski, emaste.
mgorny requested review of this revision.

Return results of URI parsing as 'struct URI' instead of assigning them
via output parameters.


https://reviews.llvm.org/D112314

Files:
  lldb/include/lldb/Utility/UriParser.h
  lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Utility/UriParser.cpp
  lldb/tools/lldb-server/Acceptor.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
  lldb/unittests/Host/SocketTest.cpp
  lldb/unittests/Utility/UriParserTest.cpp

Index: lldb/unittests/Utility/UriParserTest.cpp
===
--- lldb/unittests/Utility/UriParserTest.cpp
+++ lldb/unittests/Utility/UriParserTest.cpp
@@ -3,118 +3,74 @@
 
 using namespace lldb_private;
 
-// result strings (scheme/hostname/port/path) passed into UriParser::Parse
-// are initialized to kAsdf so we can verify that they are unmodified if the
-// URI is invalid
-static const char *kAsdf = "asdf";
-
 class UriTestCase {
 public:
   UriTestCase(const char *uri, const char *scheme, const char *hostname,
   llvm::Optional port, const char *path)
-  : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
-m_port(port), m_path(path) {}
+  : m_uri(uri), m_result(URI{scheme, hostname, port, path}) {}
 
-  UriTestCase(const char *uri)
-  : m_uri(uri), m_result(false), m_scheme(kAsdf), m_hostname(kAsdf),
-m_port(1138), m_path(kAsdf) {}
+  UriTestCase(const char *uri) : m_uri(uri), m_result(llvm::None) {}
 
   const char *m_uri;
-  bool m_result;
-  const char *m_scheme;
-  const char *m_hostname;
-  llvm::Optional m_port;
-  const char *m_path;
+  llvm::Optional m_result;
 };
 
-#define VALIDATE   \
-  llvm::StringRef scheme(kAsdf);   \
-  llvm::StringRef hostname(kAsdf); \
-  llvm::Optional port(1138); \
-  llvm::StringRef path(kAsdf); \
-  EXPECT_EQ(testCase.m_result, \
-UriParser::Parse(testCase.m_uri, scheme, hostname, port, path));   \
-  EXPECT_STREQ(testCase.m_scheme, scheme.str().c_str());   \
-  EXPECT_STREQ(testCase.m_hostname, hostname.str().c_str());   \
-  EXPECT_EQ(testCase.m_port, port);\
-  EXPECT_STREQ(testCase.m_path, path.str().c_str());
-
 TEST(UriParserTest, Minimal) {
   const UriTestCase testCase("x://y", "x", "y", llvm::None, "/");
-  VALIDATE
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));
 }
 
 TEST(UriParserTest, MinimalPort) {
   const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
-  llvm::StringRef scheme(kAsdf);
-  llvm::StringRef hostname(kAsdf);
-  llvm::Optional port(1138);
-  llvm::StringRef path(kAsdf);
-  bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
-  EXPECT_EQ(testCase.m_result, result);
-
-  EXPECT_STREQ(testCase.m_scheme, scheme.str().c_str());
-  EXPECT_STREQ(testCase.m_hostname, hostname.str().c_str());
-  EXPECT_EQ(testCase.m_port, port);
-  EXPECT_STREQ(testCase.m_path, path.str().c_str());
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));
 }
 
 TEST(UriParserTest, MinimalPath) {
   const UriTestCase testCase("x://y/", "x", "y", llvm::None, "/");
-  VALIDATE
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));
 }
 
 TEST(UriParserTest, MinimalPortPath) {
   const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
-  VALIDATE
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));
 }
 
 TEST(UriParserTest, LongPath) {
   const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", llvm::None,
  "/abc/def/xyz");
-  VALIDATE
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));
 }
 
 TEST(UriParserTest, TypicalPortPathIPv4) {
   const UriTestCase testCase("connect://192.168.100.132:5432/", "connect",
  "192.168.100.132", 5432, "/");
-  VALIDATE;
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));;
 }
 
 TEST(UriParserTest, TypicalPortPathIPv6) {
   const UriTestCase testCase(
   "connect://[2601:600:107f:db64:a42b:4faa:284:3082]:5432/", "connect",
   "2601:600:107f:db64:a42b:4faa:284:3082", 5432, "/");
-  VALIDATE;
+  EXPECT_EQ(testCase.m_result, UriParser::Parse(testCase.m_uri));;
 }
 
 TEST(UriParserTest, BracketedHostnamePort) {
   const UriTestCase testCase("connect://[192.168.100.132]:5432/", 

[Lldb-commits] [lldb] f37463b - [lldb] Another build fix for 8b8070e23

2021-10-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-10-22T15:29:38+02:00
New Revision: f37463b2eef66dfae3ed669d1cbb2a34b643d071

URL: 
https://github.com/llvm/llvm-project/commit/f37463b2eef66dfae3ed669d1cbb2a34b643d071
DIFF: 
https://github.com/llvm/llvm-project/commit/f37463b2eef66dfae3ed669d1cbb2a34b643d071.diff

LOG: [lldb] Another build fix for 8b8070e23

This particular usage was guarded by !__linux__, so it broke everywhere
else. It should probably be replaced by something else.

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
index 3e31b1274597d..ea93d9944879c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
@@ -161,7 +161,7 @@ lldb_private::Status PlatformRemoteMacOSX::GetFileWithUUID(
   if (m_remote_platform_sp) {
 std::string local_os_build;
 #if !defined(__linux__)
-HostInfo::GetOSBuildString(local_os_build);
+local_os_build = HostInfo::GetOSBuildString().getValueOr("");
 #endif
 std::string remote_os_build;
 m_remote_platform_sp->GetOSBuildString(remote_os_build);



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


[Lldb-commits] [PATCH] D112147: [lldb] Fix lookup for global constants in namespaces

2021-10-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added reviewers: clayborg, jankratochvil.
teemperor added a comment.

LGTM, but I have never touched this function so +Greg and Jan.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112147

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


[Lldb-commits] [PATCH] D112212: [lldb/test] Print build commands in trace mode

2021-10-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

This LGTM, but `shlex.join` is actually Py3 exclusive and I don't think there 
is a good Py2 replacement. I think we're just in time for the Py2->3 migration 
according to the timeline Jonas posted last year 
, so let's 
use this patch to actually do that? Then we can also get rid of all the `six` 
stuff etc.

Let's see if Jonas has any objections against dropping Py2 with this, otherwise 
this is good to go.




Comment at: lldb/test/API/test_utils/TestBaseTest.py:1
+"""
+Test TestBase test functions.

Could we move this file into `test_utils/build` or some other subdir? Then I 
can also make the few other 'test'-tests their own subdir of `test_utils` 
(which seems like a good place for all of this).



Comment at: lldb/test/API/test_utils/TestBaseTest.py:18
+
+def trace(self, *args, **kwargs):
+io = six.StringIO()

I think a comment that this overrides the normal test `trace` method would be 
nice (I wish Python had some builtin thing for indicating overrides...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112212

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


[Lldb-commits] [PATCH] D112147: [lldb] Fix lookup for global constants in namespaces

2021-10-22 Thread Andy Yankovsky via Phabricator via lldb-commits
werat accepted this revision.
werat added a comment.
This revision is now accepted and ready to land.

This looks reasonable to me.

@teemperor any thoughts?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112147

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


[Lldb-commits] [PATCH] D112309: [lldb] [Utility/UriParser] Replace port==-1 with llvm::None

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGff569ed03092: [lldb] [Utility/UriParser] Replace port==-1 
with llvm::None (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112309

Files:
  lldb/include/lldb/Utility/UriParser.h
  lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Utility/UriParser.cpp
  lldb/tools/lldb-server/Acceptor.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
  lldb/unittests/Host/SocketTest.cpp
  lldb/unittests/Utility/UriParserTest.cpp

Index: lldb/unittests/Utility/UriParserTest.cpp
===
--- lldb/unittests/Utility/UriParserTest.cpp
+++ lldb/unittests/Utility/UriParserTest.cpp
@@ -11,7 +11,7 @@
 class UriTestCase {
 public:
   UriTestCase(const char *uri, const char *scheme, const char *hostname,
-  int port, const char *path)
+  llvm::Optional port, const char *path)
   : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
 m_port(port), m_path(path) {}
 
@@ -23,14 +23,14 @@
   bool m_result;
   const char *m_scheme;
   const char *m_hostname;
-  int m_port;
+  llvm::Optional m_port;
   const char *m_path;
 };
 
 #define VALIDATE   \
   llvm::StringRef scheme(kAsdf);   \
   llvm::StringRef hostname(kAsdf); \
-  int port(1138);  \
+  llvm::Optional port(1138); \
   llvm::StringRef path(kAsdf); \
   EXPECT_EQ(testCase.m_result, \
 UriParser::Parse(testCase.m_uri, scheme, hostname, port, path));   \
@@ -40,7 +40,7 @@
   EXPECT_STREQ(testCase.m_path, path.str().c_str());
 
 TEST(UriParserTest, Minimal) {
-  const UriTestCase testCase("x://y", "x", "y", -1, "/");
+  const UriTestCase testCase("x://y", "x", "y", llvm::None, "/");
   VALIDATE
 }
 
@@ -48,7 +48,7 @@
   const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
   llvm::StringRef scheme(kAsdf);
   llvm::StringRef hostname(kAsdf);
-  int port(1138);
+  llvm::Optional port(1138);
   llvm::StringRef path(kAsdf);
   bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
   EXPECT_EQ(testCase.m_result, result);
@@ -60,7 +60,7 @@
 }
 
 TEST(UriParserTest, MinimalPath) {
-  const UriTestCase testCase("x://y/", "x", "y", -1, "/");
+  const UriTestCase testCase("x://y/", "x", "y", llvm::None, "/");
   VALIDATE
 }
 
@@ -70,7 +70,8 @@
 }
 
 TEST(UriParserTest, LongPath) {
-  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
+  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", llvm::None,
+ "/abc/def/xyz");
   VALIDATE
 }
 
@@ -92,7 +93,7 @@
  "192.168.100.132", 5432, "/");
   llvm::StringRef scheme(kAsdf);
   llvm::StringRef hostname(kAsdf);
-  int port(1138);
+  llvm::Optional port(1138);
   llvm::StringRef path(kAsdf);
   bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
   EXPECT_EQ(testCase.m_result, result);
@@ -105,14 +106,14 @@
 
 TEST(UriParserTest, BracketedHostname) {
   const UriTestCase testCase("connect://[192.168.100.132]", "connect",
- "192.168.100.132", -1, "/");
+ "192.168.100.132", llvm::None, "/");
   VALIDATE
 }
 
 TEST(UriParserTest, BracketedHostnameWithPortIPv4) {
   // Android device over IPv4: port is a part of the hostname.
   const UriTestCase testCase("connect://[192.168.100.132:1234]", "connect",
- "192.168.100.132:1234", -1, "/");
+ "192.168.100.132:1234", llvm::None, "/");
   VALIDATE
 }
 
@@ -120,7 +121,7 @@
   // Android device over IPv6: port is a part of the hostname.
   const UriTestCase testCase(
   "connect://[[2601:600:107f:db64:a42b:4faa:284]:1234]", "connect",
-  "[2601:600:107f:db64:a42b:4faa:284]:1234", -1, "/");
+  "[2601:600:107f:db64:a42b:4faa:284]:1234", llvm::None, "/");
   VALIDATE
 }
 
Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -173,7 +173,7 @@
 
   

[Lldb-commits] [PATCH] D112069: [lldb][AArch64] Add UnwindPlan for Linux sigreturn

2021-10-22 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: lldb/source/Symbol/AArch64UnwindInfo.cpp:58
+  unwind_plan_sp->SetSourcedFromCompiler(eLazyBoolYes);
+  unwind_plan_sp->SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
+  unwind_plan_sp->SetUnwindPlanForSignalTrap(eLazyBoolYes);

labath wrote:
> DavidSpickett wrote:
> > If this means "at all instructions within that function" this could be yes, 
> > but no one seems to read this field anyway.
> The way I read it is "all locations within the range of this unwind plan" as 
> given by UnwindPlan::GetAddressRange. compiler-generated unwind plans might 
> cover the entire function, but only be valid (correct) at call sites.
So this would be valid at all instructions because at any point in 
`__kernel_rt_sigreturn` the stack pointer is the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112069

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


[Lldb-commits] [lldb] ff569ed - [lldb] [Utility/UriParser] Replace port==-1 with llvm::None

2021-10-22 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-10-22T14:39:18+02:00
New Revision: ff569ed03092dba39effcc45e81d64beff800bb5

URL: 
https://github.com/llvm/llvm-project/commit/ff569ed03092dba39effcc45e81d64beff800bb5
DIFF: 
https://github.com/llvm/llvm-project/commit/ff569ed03092dba39effcc45e81d64beff800bb5.diff

LOG: [lldb] [Utility/UriParser] Replace port==-1 with llvm::None

Use llvm::Optional instead of int for port number
in UriParser::Parse(), and use llvm::None to indicate missing port
instead of a magic value of -1.

Differential Revision: https://reviews.llvm.org/D112309

Added: 


Modified: 
lldb/include/lldb/Utility/UriParser.h
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/source/Utility/UriParser.cpp
lldb/tools/lldb-server/Acceptor.cpp
lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
lldb/unittests/Host/SocketTest.cpp
lldb/unittests/Utility/UriParserTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/UriParser.h 
b/lldb/include/lldb/Utility/UriParser.h
index 6a64c3d747b55..f07df8fb24735 100644
--- a/lldb/include/lldb/Utility/UriParser.h
+++ b/lldb/include/lldb/Utility/UriParser.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_UTILITY_URIPARSER_H
 #define LLDB_UTILITY_URIPARSER_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace lldb_private {
@@ -18,12 +19,12 @@ class UriParser {
   // RETURN VALUE
   //   if url is valid, function returns true and
   //   scheme/hostname/port/path are set to the parsed values
-  //   port it set to -1 if it is not included in the URL
+  //   port it set to llvm::None if it is not included in the URL
   //
   //   if the url is invalid, function returns false and
   //   output parameters remain unchanged
   static bool Parse(llvm::StringRef uri, llvm::StringRef ,
-llvm::StringRef , int ,
+llvm::StringRef , llvm::Optional ,
 llvm::StringRef );
 };
 }

diff  --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp 
b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 1e66b86e26615..f9b5cfd758d89 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -155,7 +155,7 @@ Status PlatformAndroid::ConnectRemote(Args ) {
   if (!m_remote_platform_sp)
 m_remote_platform_sp = PlatformSP(new PlatformAndroidRemoteGDBServer());
 
-  int port;
+  llvm::Optional port;
   llvm::StringRef scheme, host, path;
   const char *url = args.GetArgumentAtIndex(0);
   if (!url)

diff  --git 
a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp 
b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index 2847bcfaa9260..3c9a33c93d27b 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -109,7 +109,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args 
) {
 return Status(
 "\"platform connect\" takes a single argument: ");
 
-  int remote_port;
+  llvm::Optional remote_port;
   llvm::StringRef scheme, host, path;
   const char *url = args.GetArgumentAtIndex(0);
   if (!url)
@@ -126,9 +126,8 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args 
) {
 m_socket_namespace = AdbClient::UnixSocketNamespaceAbstract;
 
   std::string connect_url;
-  auto error =
-  MakeConnectURL(g_remote_platform_pid, (remote_port < 0) ? 0 : 
remote_port,
- path, connect_url);
+  auto error = MakeConnectURL(g_remote_platform_pid, remote_port.getValueOr(0),
+  path, connect_url);
 
   if (error.Fail())
 return error;
@@ -207,7 +206,7 @@ lldb::ProcessSP 
PlatformAndroidRemoteGDBServer::ConnectProcess(
   // any other valid pid on android.
   static lldb::pid_t s_remote_gdbserver_fake_pid = 0xULL;
 
-  int remote_port;
+  llvm::Optional remote_port;
   llvm::StringRef scheme, host, path;
   if (!UriParser::Parse(connect_url, scheme, host, remote_port, path)) {
 error.SetErrorStringWithFormat("Invalid URL: %s",
@@ -217,8 +216,7 @@ lldb::ProcessSP 
PlatformAndroidRemoteGDBServer::ConnectProcess(
 
   std::string new_connect_url;
   error = MakeConnectURL(s_remote_gdbserver_fake_pid--,
- (remote_port < 0) ? 0 : remote_port, path,
- new_connect_url);
+ remote_port.getValueOr(0), path, new_connect_url);
   if (error.Fail())
 return nullptr;
 

diff  --git 

[Lldb-commits] [PATCH] D112069: [lldb][AArch64] Add UnwindPlan for Linux sigreturn

2021-10-22 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

> Creating a new Platform entry point to provide the unwind plan (or somehow 
> refactoring the GetTrapHandlerSymbolNames so that it can also provide an 
> unwind plan)

Makes sense, I'll try that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112069

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


[Lldb-commits] [lldb] 43f8845 - [lldb] Fix build errors from 8b8070e23

2021-10-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-10-22T14:28:52+02:00
New Revision: 43f8845dd371a842841a19aad063b735ff0c9ec2

URL: 
https://github.com/llvm/llvm-project/commit/43f8845dd371a842841a19aad063b735ff0c9ec2
DIFF: 
https://github.com/llvm/llvm-project/commit/43f8845dd371a842841a19aad063b735ff0c9ec2.diff

LOG: [lldb] Fix build errors from 8b8070e23

I missed windows and openbsd.

Added: 


Modified: 
lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
lldb/source/Host/windows/HostInfoWindows.cpp

Removed: 




diff  --git a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp 
b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
index 9617375babe1f..18ffa381fbb4e 100644
--- a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
+++ b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
@@ -29,20 +29,16 @@ llvm::VersionTuple HostInfoOpenBSD::GetOSVersion() {
   return llvm::VersionTuple();
 }
 
-bool HostInfoOpenBSD::GetOSBuildString(std::string ) {
+llvm::Optional HostInfoOpenBSD::GetOSBuildString() {
   int mib[2] = {CTL_KERN, KERN_OSREV};
   char osrev_str[12];
   uint32_t osrev = 0;
   size_t osrev_len = sizeof(osrev);
 
-  if (::sysctl(mib, 2, , _len, NULL, 0) == 0) {
-::snprintf(osrev_str, sizeof(osrev_str), "%-8.8u", osrev);
-s.assign(osrev_str);
-return true;
-  }
+  if (::sysctl(mib, 2, , _len, NULL, 0) == 0)
+return llvm::formatv("{0,8:8}", osrev).str();
 
-  s.clear();
-  return false;
+  return llvm::None;
 }
 
 bool HostInfoOpenBSD::GetOSKernelDescription(std::string ) {

diff  --git a/lldb/source/Host/windows/HostInfoWindows.cpp 
b/lldb/source/Host/windows/HostInfoWindows.cpp
index 54a07b71b2cdf..1e6ce0ce5b2df 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -74,19 +74,18 @@ llvm::VersionTuple HostInfoWindows::GetOSVersion() {
 info.wServicePackMajor);
 }
 
-bool HostInfoWindows::GetOSBuildString(std::string ) {
-  s.clear();
+llvm::Optional HostInfoWindows::GetOSBuildString() {
   llvm::VersionTuple version = GetOSVersion();
   if (version.empty())
-return false;
+return llvm::None;
 
-  llvm::raw_string_ostream stream(s);
-  stream << "Windows NT " << version.getAsString();
-  return true;
+  return "Windows NT " + version.getAsString();
 }
 
 bool HostInfoWindows::GetOSKernelDescription(std::string ) {
-  return GetOSBuildString(s);
+  llvm::Optional build = GetOSBuildString();
+  s = build.getValueOr("");
+  return build.hasValue();
 }
 
 bool HostInfoWindows::GetHostname(std::string ) {



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


[Lldb-commits] [PATCH] D112310: [lldb/DWARF] Don't create lldb_private::Functions for gc'ed DW_TAG_subprograms

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, teemperor, shafik.
labath requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: LLDB.

Front-load the first_valid_code_address check, so that we avoid creating
the function object (instead of simply refusing to use it in queries).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112310

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/x86/dead-code-filtering.yaml

Index: lldb/test/Shell/SymbolFile/DWARF/x86/dead-code-filtering.yaml
===
--- lldb/test/Shell/SymbolFile/DWARF/x86/dead-code-filtering.yaml
+++ lldb/test/Shell/SymbolFile/DWARF/x86/dead-code-filtering.yaml
@@ -1,6 +1,16 @@
 # RUN: yaml2obj %s > %t
+# RUN: lldb-test symbols %t | FileCheck %s --check-prefix=TEST
 # RUN: %lldb %t -o "image dump line-table a.c" -o "image lookup -n _start" -o "image lookup -n f" -o exit | FileCheck %s
 
+# TEST: Compile units:
+# TEST-NEXT: CompileUnit{0x}, language = "c", file = 'a.c'
+# TEST-NEXT: Function{0x0043}, demangled = _start, type_uid = 0x0043
+# TEST-NEXT: Block{0x0043}, ranges = [0x0080-0x0086)
+# TEST-EMPTY:
+# TEST-EMPTY:
+# TEST-NEXT: Symtab
+
+
 # CHECK-LABEL: image dump line-table a.c
 # CHECK-NEXT: Line table for a.c
 # CHECK-NEXT: 0x0080: a.c:1
@@ -59,6 +69,8 @@
   Attributes:
 - Attribute:   DW_AT_producer
   Form:DW_FORM_string
+- Attribute:   DW_AT_language
+  Form:DW_FORM_data1
 - Attribute:   DW_AT_name
   Form:DW_FORM_string
 - Attribute:   DW_AT_stmt_list
@@ -86,6 +98,7 @@
 - AbbrCode:0x0001
   Values:
 - CStr:Hand-written DWARF
+- Value:   2
 - CStr:a.c
 - Value:   0x
 - Value:   0x
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -856,7 +856,32 @@
   if (!dwarf_ast)
 return nullptr;
 
-  return dwarf_ast->ParseFunctionFromDWARF(comp_unit, die);
+  DWARFRangeList ranges;
+  if (die.GetDIE()->GetAttributeAddressRanges(die.GetCU(), ranges,
+  /*check_hi_lo_pc=*/true) == 0)
+return nullptr;
+
+  // Union of all ranges in the function DIE (if the function is
+  // discontiguous)
+  AddressRange func_range;
+  lldb::addr_t lowest_func_addr = ranges.GetMinRangeBase(0);
+  lldb::addr_t highest_func_addr = ranges.GetMaxRangeEnd(0);
+  if (lowest_func_addr == LLDB_INVALID_ADDRESS ||
+  lowest_func_addr >= highest_func_addr ||
+  lowest_func_addr < m_first_code_address)
+return nullptr;
+
+  ModuleSP module_sp(die.GetModule());
+  func_range.GetBaseAddress().ResolveAddressUsingFileSections(
+  lowest_func_addr, module_sp->GetSectionList());
+  if (!func_range.GetBaseAddress().IsValid())
+return nullptr;
+
+  func_range.SetByteSize(highest_func_addr - lowest_func_addr);
+  if (!FixupAddress(func_range.GetBaseAddress()))
+return nullptr;
+
+  return dwarf_ast->ParseFunctionFromDWARF(comp_unit, die, func_range);
 }
 
 lldb::addr_t SymbolFileDWARF::FixupAddress(lldb::addr_t file_addr) {
@@ -2263,10 +2288,8 @@
   addr = sc.function->GetAddressRange().GetBaseAddress();
 }
 
-if (addr.IsValid() && addr.GetFileAddress() >= m_first_code_address) {
-  sc_list.Append(sc);
-  return true;
-}
+sc_list.Append(sc);
+return true;
   }
 
   return false;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -47,7 +47,8 @@
 
   lldb_private::Function *
   ParseFunctionFromDWARF(lldb_private::CompileUnit _unit,
- const DWARFDIE ) override;
+ const DWARFDIE ,
+ const lldb_private::AddressRange _range) override;
 
   bool
   CompleteTypeFromDWARF(const DWARFDIE , lldb_private::Type *type,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ 

[Lldb-commits] [PATCH] D112309: [lldb] [Utility/UriParser] Replace port==-1 with llvm::None

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Seems like a (slight) improvement. You don't have to do this, but what I think 
would best help here is if we made a struct for these parsed results:

  struct URI {
static Optional parse(StringRef);
StringRef scheme;
...
  }

throw in an operator== and << and even the unit tests would become nicer.


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

https://reviews.llvm.org/D112309

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


[Lldb-commits] [PATCH] D112309: [lldb] [Utility/UriParser] Replace port==-1 with llvm::None

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, teemperor, krytarowski, emaste.
mgorny requested review of this revision.

Use llvm::Optional instead of int for port number
in UriParser::Parse(), and use llvm::None to indicate missing port
instead of a magic value of -1.


https://reviews.llvm.org/D112309

Files:
  lldb/include/lldb/Utility/UriParser.h
  lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Utility/UriParser.cpp
  lldb/tools/lldb-server/Acceptor.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
  lldb/unittests/Host/SocketTest.cpp
  lldb/unittests/Utility/UriParserTest.cpp

Index: lldb/unittests/Utility/UriParserTest.cpp
===
--- lldb/unittests/Utility/UriParserTest.cpp
+++ lldb/unittests/Utility/UriParserTest.cpp
@@ -11,7 +11,7 @@
 class UriTestCase {
 public:
   UriTestCase(const char *uri, const char *scheme, const char *hostname,
-  int port, const char *path)
+  llvm::Optional port, const char *path)
   : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
 m_port(port), m_path(path) {}
 
@@ -23,14 +23,14 @@
   bool m_result;
   const char *m_scheme;
   const char *m_hostname;
-  int m_port;
+  llvm::Optional m_port;
   const char *m_path;
 };
 
 #define VALIDATE   \
   llvm::StringRef scheme(kAsdf);   \
   llvm::StringRef hostname(kAsdf); \
-  int port(1138);  \
+  llvm::Optional port(1138); \
   llvm::StringRef path(kAsdf); \
   EXPECT_EQ(testCase.m_result, \
 UriParser::Parse(testCase.m_uri, scheme, hostname, port, path));   \
@@ -40,7 +40,7 @@
   EXPECT_STREQ(testCase.m_path, path.str().c_str());
 
 TEST(UriParserTest, Minimal) {
-  const UriTestCase testCase("x://y", "x", "y", -1, "/");
+  const UriTestCase testCase("x://y", "x", "y", llvm::None, "/");
   VALIDATE
 }
 
@@ -48,7 +48,7 @@
   const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
   llvm::StringRef scheme(kAsdf);
   llvm::StringRef hostname(kAsdf);
-  int port(1138);
+  llvm::Optional port(1138);
   llvm::StringRef path(kAsdf);
   bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
   EXPECT_EQ(testCase.m_result, result);
@@ -60,7 +60,7 @@
 }
 
 TEST(UriParserTest, MinimalPath) {
-  const UriTestCase testCase("x://y/", "x", "y", -1, "/");
+  const UriTestCase testCase("x://y/", "x", "y", llvm::None, "/");
   VALIDATE
 }
 
@@ -70,7 +70,8 @@
 }
 
 TEST(UriParserTest, LongPath) {
-  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
+  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", llvm::None,
+ "/abc/def/xyz");
   VALIDATE
 }
 
@@ -92,7 +93,7 @@
  "192.168.100.132", 5432, "/");
   llvm::StringRef scheme(kAsdf);
   llvm::StringRef hostname(kAsdf);
-  int port(1138);
+  llvm::Optional port(1138);
   llvm::StringRef path(kAsdf);
   bool result = UriParser::Parse(testCase.m_uri, scheme, hostname, port, path);
   EXPECT_EQ(testCase.m_result, result);
@@ -105,14 +106,14 @@
 
 TEST(UriParserTest, BracketedHostname) {
   const UriTestCase testCase("connect://[192.168.100.132]", "connect",
- "192.168.100.132", -1, "/");
+ "192.168.100.132", llvm::None, "/");
   VALIDATE
 }
 
 TEST(UriParserTest, BracketedHostnameWithPortIPv4) {
   // Android device over IPv4: port is a part of the hostname.
   const UriTestCase testCase("connect://[192.168.100.132:1234]", "connect",
- "192.168.100.132:1234", -1, "/");
+ "192.168.100.132:1234", llvm::None, "/");
   VALIDATE
 }
 
@@ -120,7 +121,7 @@
   // Android device over IPv6: port is a part of the hostname.
   const UriTestCase testCase(
   "connect://[[2601:600:107f:db64:a42b:4faa:284]:1234]", "connect",
-  "[2601:600:107f:db64:a42b:4faa:284]:1234", -1, "/");
+  "[2601:600:107f:db64:a42b:4faa:284]:1234", llvm::None, "/");
   VALIDATE
 }
 
Index: lldb/unittests/Host/SocketTest.cpp
===
--- lldb/unittests/Host/SocketTest.cpp
+++ lldb/unittests/Host/SocketTest.cpp
@@ -173,7 +173,7 @@
 
   llvm::StringRef scheme;
   llvm::StringRef hostname;
-  int port;
+  llvm::Optional port;
   

[Lldb-commits] [PATCH] D112069: [lldb][AArch64] Add UnwindPlan for Linux sigreturn

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'm sorry for terse response. I wanted to ensure this gets more attention, but 
I wasn't able to look at this straight away. Let me try to elaborate.

We generally try to avoid platform-specific code in the core libraries. The 
unwind code is one of the biggest offenders here, but I'd still want to avoid 
making it worse, particularly if there is a fairly simple way to avoid that. 
And I think there might be one. We already involve the Platform class in the 
unwinding logic (see Platform::GetTrapHandlerSymbolNames). Since it already 
knows about their names, it doesn't seem far-fetched to have it provide a way 
to unwind out of them (if necessary). Creating a new Platform entry point to 
provide the unwind plan (or somehow refactoring the GetTrapHandlerSymbolNames 
so that it can also provide an unwind plan) would enable us to put this code 
into PlatformLinux, which (although not ideal) seems much better than smacking 
it into the middle of the Symbol library. It also seems consistent with the 
intent in one of the comments in the code you modify.




Comment at: lldb/source/Symbol/AArch64UnwindInfo.cpp:58
+  unwind_plan_sp->SetSourcedFromCompiler(eLazyBoolYes);
+  unwind_plan_sp->SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
+  unwind_plan_sp->SetUnwindPlanForSignalTrap(eLazyBoolYes);

DavidSpickett wrote:
> If this means "at all instructions within that function" this could be yes, 
> but no one seems to read this field anyway.
The way I read it is "all locations within the range of this unwind plan" as 
given by UnwindPlan::GetAddressRange. compiler-generated unwind plans might 
cover the entire function, but only be valid (correct) at call sites.



Comment at: lldb/source/Target/RegisterContextUnwind.cpp:900
   // section, so prefer that if available. On other platforms we may need to
   // provide a platform-specific UnwindPlan which encodes the details of how to
   // unwind out of sigtramp.

this comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112069

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


Re: [Lldb-commits] [lldb] 8b8070e - Host::GetOSBuildString

2021-10-22 Thread Pavel Labath via lldb-commits

For posterity, this was meant to have a slightly better commit message:

"Modernize Host::GetOSBuildString"

Oops.

On 22/10/2021 13:00, Pavel Labath via lldb-commits wrote:


Author: Pavel Labath
Date: 2021-10-22T12:59:58+02:00
New Revision: 8b8070e23442351ae153e36a4d05790252c6ad96

URL: 
https://github.com/llvm/llvm-project/commit/8b8070e23442351ae153e36a4d05790252c6ad96
DIFF: 
https://github.com/llvm/llvm-project/commit/8b8070e23442351ae153e36a4d05790252c6ad96.diff

LOG: Host::GetOSBuildString

Added:
 


Modified:
 lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
 lldb/include/lldb/Host/linux/HostInfoLinux.h
 lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
 lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
 lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
 lldb/include/lldb/Host/windows/HostInfoWindows.h
 lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
 lldb/source/Host/linux/HostInfoLinux.cpp
 lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
 lldb/source/Host/netbsd/HostInfoNetBSD.cpp
 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
 lldb/source/Target/Platform.cpp

Removed:
 




diff  --git a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h 
b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
index 56f20bbd23d3b..8207e9093f715 100644
--- a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
+++ b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
  class HostInfoFreeBSD : public HostInfoPosix {
  public:
static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static FileSpec GetProgramFileSpec();
  };

diff  --git a/lldb/include/lldb/Host/linux/HostInfoLinux.h 
b/lldb/include/lldb/Host/linux/HostInfoLinux.h
index 3220046488677..6287670606643 100644
--- a/lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -26,7 +26,7 @@ class HostInfoLinux : public HostInfoPosix {
static void Terminate();
  
static llvm::VersionTuple GetOSVersion();

-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static llvm::StringRef GetDistributionId();
static FileSpec GetProgramFileSpec();

diff  --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h 
b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
index 4623932ab2b4c..42c2872af2182 100644
--- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -24,7 +24,7 @@ class HostInfoMacOSX : public HostInfoPosix {
  public:
static llvm::VersionTuple GetOSVersion();
static llvm::VersionTuple GetMacCatalystVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static FileSpec GetProgramFileSpec();
static FileSpec GetXcodeContentsDirectory();

diff  --git a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h 
b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
index f9ad66eb2b2af..021f8626733b0 100644
--- a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
+++ b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
  class HostInfoNetBSD : public HostInfoPosix {
  public:
static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static FileSpec GetProgramFileSpec();
  };

diff  --git a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h 
b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
index 7ec1d5fc3606d..ba5ac8cbb169f 100644
--- a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
+++ b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
  class HostInfoOpenBSD : public HostInfoPosix {
  public:
static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static FileSpec GetProgramFileSpec();
  };

diff  --git a/lldb/include/lldb/Host/windows/HostInfoWindows.h 
b/lldb/include/lldb/Host/windows/HostInfoWindows.h
index f01113e900493..d7f9e68254c9e 100644
--- a/lldb/include/lldb/Host/windows/HostInfoWindows.h
+++ b/lldb/include/lldb/Host/windows/HostInfoWindows.h
@@ -27,7 +27,7 @@ class HostInfoWindows : public HostInfoBase {
static UserIDResolver ();
  
static llvm::VersionTuple GetOSVersion();

-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
static bool GetOSKernelDescription(std::string );
static bool GetHostname(std::string );
static 

[Lldb-commits] [lldb] 8b8070e - Host::GetOSBuildString

2021-10-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-10-22T12:59:58+02:00
New Revision: 8b8070e23442351ae153e36a4d05790252c6ad96

URL: 
https://github.com/llvm/llvm-project/commit/8b8070e23442351ae153e36a4d05790252c6ad96
DIFF: 
https://github.com/llvm/llvm-project/commit/8b8070e23442351ae153e36a4d05790252c6ad96.diff

LOG: Host::GetOSBuildString

Added: 


Modified: 
lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
lldb/include/lldb/Host/linux/HostInfoLinux.h
lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
lldb/include/lldb/Host/windows/HostInfoWindows.h
lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Host/netbsd/HostInfoNetBSD.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Target/Platform.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h 
b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
index 56f20bbd23d3b..8207e9093f715 100644
--- a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
+++ b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
 class HostInfoFreeBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static FileSpec GetProgramFileSpec();
 };

diff  --git a/lldb/include/lldb/Host/linux/HostInfoLinux.h 
b/lldb/include/lldb/Host/linux/HostInfoLinux.h
index 3220046488677..6287670606643 100644
--- a/lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -26,7 +26,7 @@ class HostInfoLinux : public HostInfoPosix {
   static void Terminate();
 
   static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static llvm::StringRef GetDistributionId();
   static FileSpec GetProgramFileSpec();

diff  --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h 
b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
index 4623932ab2b4c..42c2872af2182 100644
--- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -24,7 +24,7 @@ class HostInfoMacOSX : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
   static llvm::VersionTuple GetMacCatalystVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static FileSpec GetProgramFileSpec();
   static FileSpec GetXcodeContentsDirectory();

diff  --git a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h 
b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
index f9ad66eb2b2af..021f8626733b0 100644
--- a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
+++ b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
 class HostInfoNetBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static FileSpec GetProgramFileSpec();
 };

diff  --git a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h 
b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
index 7ec1d5fc3606d..ba5ac8cbb169f 100644
--- a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
+++ b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
@@ -18,7 +18,7 @@ namespace lldb_private {
 class HostInfoOpenBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static FileSpec GetProgramFileSpec();
 };

diff  --git a/lldb/include/lldb/Host/windows/HostInfoWindows.h 
b/lldb/include/lldb/Host/windows/HostInfoWindows.h
index f01113e900493..d7f9e68254c9e 100644
--- a/lldb/include/lldb/Host/windows/HostInfoWindows.h
+++ b/lldb/include/lldb/Host/windows/HostInfoWindows.h
@@ -27,7 +27,7 @@ class HostInfoWindows : public HostInfoBase {
   static UserIDResolver ();
 
   static llvm::VersionTuple GetOSVersion();
-  static bool GetOSBuildString(std::string );
+  static llvm::Optional GetOSBuildString();
   static bool GetOSKernelDescription(std::string );
   static bool GetHostname(std::string );
   static FileSpec GetProgramFileSpec();

diff  --git a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp 
b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
index 1b9e3ccaf1818..22af5bda66108 100644
--- 

[Lldb-commits] [PATCH] D112212: [lldb/test] Print build commands in trace mode

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I agree with what Raphael said.

Here's my attempt at a test case. Let me know what you think.




Comment at: lldb/packages/Python/lldbsuite/test/lldbtest.py:1422
+def runBuildCommands(self, commands):
+for cmd in commands:
+self.trace(shlex.join(cmd))

DavidSpickett wrote:
> Is this ever going to have more than one command to run?
> 
> Seems like the source is the function above that puts a single command into a 
> list.
Well.. the general idea of the builder plugins was that they could build the 
test executable in any way they see fit, but I don't reallisticaly see it using 
anything other than makefiles any time soon. The whole builder module idea is a 
bit flawed, because it keys everything off of the host platform, but most of 
the customizations need to happen because of target platform specifics. So, I 
guess I'll just drop the multiple command mode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112212

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


[Lldb-commits] [PATCH] D110535: [llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

2021-10-22 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG66e06cc8cba3: [llvm] [ADT] Update llvm::Split() per Pavel 
Labaths suggestions (authored by mgorny).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D110535?vs=381226=381501#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110535

Files:
  lldb/source/Host/common/File.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  llvm/include/llvm/ADT/StringExtras.h
  llvm/lib/IR/DataLayout.cpp
  llvm/unittests/ADT/StringExtrasTest.cpp

Index: llvm/unittests/ADT/StringExtrasTest.cpp
===
--- llvm/unittests/ADT/StringExtrasTest.cpp
+++ llvm/unittests/ADT/StringExtrasTest.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
 using namespace llvm;
@@ -276,7 +277,7 @@
 }
 
 TEST(StringExtrasTest, splitStringRef) {
-  auto Spl = Split("foo<=>bar<=><=>baz", "<=>");
+  auto Spl = split("foo<=>bar<=><=>baz", "<=>");
   auto It = Spl.begin();
   auto End = Spl.end();
 
@@ -291,8 +292,15 @@
   ASSERT_EQ(++It, End);
 }
 
-TEST(StringExtrasTest, splItChar) {
-  auto Spl = Split("foo,bar,,baz", ',');
+TEST(StringExtrasTest, splitStringRefForLoop) {
+  llvm::SmallVector Result;
+  for (StringRef x : split("foo<=>bar<=><=>baz", "<=>"))
+Result.push_back(x);
+  EXPECT_THAT(Result, testing::ElementsAre("foo", "bar", "", "baz"));
+}
+
+TEST(StringExtrasTest, splitChar) {
+  auto Spl = split("foo,bar,,baz", ',');
   auto It = Spl.begin();
   auto End = Spl.end();
 
@@ -306,3 +314,10 @@
   EXPECT_EQ(*It, StringRef("baz"));
   ASSERT_EQ(++It, End);
 }
+
+TEST(StringExtrasTest, splitCharForLoop) {
+  llvm::SmallVector Result;
+  for (StringRef x : split("foo,bar,,baz", ','))
+Result.push_back(x);
+  EXPECT_THAT(Result, testing::ElementsAre("foo", "bar", "", "baz"));
+}
Index: llvm/lib/IR/DataLayout.cpp
===
--- llvm/lib/IR/DataLayout.cpp
+++ llvm/lib/IR/DataLayout.cpp
@@ -260,12 +260,12 @@
   while (!Desc.empty()) {
 // Split at '-'.
 std::pair Split;
-if (Error Err = split(Desc, '-', Split))
+if (Error Err = ::split(Desc, '-', Split))
   return Err;
 Desc = Split.second;
 
 // Split at ':'.
-if (Error Err = split(Split.first, ':', Split))
+if (Error Err = ::split(Split.first, ':', Split))
   return Err;
 
 // Aliases used below.
@@ -274,7 +274,7 @@
 
 if (Tok == "ni") {
   do {
-if (Error Err = split(Rest, ':', Split))
+if (Error Err = ::split(Rest, ':', Split))
   return Err;
 Rest = Split.second;
 unsigned AS;
@@ -315,7 +315,7 @@
   if (Rest.empty())
 return reportError(
 "Missing size specification for pointer in datalayout string");
-  if (Error Err = split(Rest, ':', Split))
+  if (Error Err = ::split(Rest, ':', Split))
 return Err;
   unsigned PointerMemSize;
   if (Error Err = getIntInBytes(Tok, PointerMemSize))
@@ -327,7 +327,7 @@
   if (Rest.empty())
 return reportError(
 "Missing alignment specification for pointer in datalayout string");
-  if (Error Err = split(Rest, ':', Split))
+  if (Error Err = ::split(Rest, ':', Split))
 return Err;
   unsigned PointerABIAlign;
   if (Error Err = getIntInBytes(Tok, PointerABIAlign))
@@ -342,7 +342,7 @@
   // Preferred alignment.
   unsigned PointerPrefAlign = PointerABIAlign;
   if (!Rest.empty()) {
-if (Error Err = split(Rest, ':', Split))
+if (Error Err = ::split(Rest, ':', Split))
   return Err;
 if (Error Err = getIntInBytes(Tok, PointerPrefAlign))
   return Err;
@@ -352,7 +352,7 @@
 
 // Now read the index. It is the second optional parameter here.
 if (!Rest.empty()) {
-  if (Error Err = split(Rest, ':', Split))
+  if (Error Err = ::split(Rest, ':', Split))
 return Err;
   if (Error Err = getIntInBytes(Tok, IndexSize))
 return Err;
@@ -393,7 +393,7 @@
   if (Rest.empty())
 return reportError(
 "Missing alignment specification in datalayout string");
-  if (Error Err = split(Rest, ':', Split))
+  if (Error Err = ::split(Rest, ':', Split))
 return Err;
   unsigned ABIAlign;
   if (Error Err = getIntInBytes(Tok, ABIAlign))
@@ -410,7 +410,7 @@
   // Preferred alignment.
   unsigned PrefAlign = ABIAlign;
   if (!Rest.empty()) {
-if (Error Err = split(Rest, ':', 

[Lldb-commits] [lldb] 66e06cc - [llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

2021-10-22 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-10-22T12:27:46+02:00
New Revision: 66e06cc8cba3c39c760082a8ed469b5292f9ee67

URL: 
https://github.com/llvm/llvm-project/commit/66e06cc8cba3c39c760082a8ed469b5292f9ee67
DIFF: 
https://github.com/llvm/llvm-project/commit/66e06cc8cba3c39c760082a8ed469b5292f9ee67.diff

LOG: [llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

Optimize the iterator comparison logic to compare Current.data()
pointers.  Use std::tie for assignments from std::pair.  Replace
the custom class with a function returning iterator_range.

Differential Revision: https://reviews.llvm.org/D110535

Added: 


Modified: 
lldb/source/Host/common/File.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
llvm/include/llvm/ADT/StringExtras.h
llvm/lib/IR/DataLayout.cpp
llvm/unittests/ADT/StringExtrasTest.cpp

Removed: 




diff  --git a/lldb/source/Host/common/File.cpp 
b/lldb/source/Host/common/File.cpp
index 1c8a0ab7f83e1..5ad5ae6bb2192 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -772,7 +772,7 @@ mode_t File::ConvertOpenOptionsForPOSIXOpen(OpenOptions 
open_options) {
 llvm::Expected
 SerialPort::OptionsFromURL(llvm::StringRef urlqs) {
   SerialPort::Options serial_options;
-  for (llvm::StringRef x : llvm::Split(urlqs, '&')) {
+  for (llvm::StringRef x : llvm::split(urlqs, '&')) {
 if (x.consume_front("baud=")) {
   unsigned int baud_rate;
   if (!llvm::to_integer(x, baud_rate, 10))

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index c68fcc1789d80..9550cb53e9e83 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -355,7 +355,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
 // configuration of the transport before attaching/launching the process.
 m_qSupported_response = response.GetStringRef().str();
 
-for (llvm::StringRef x : llvm::Split(response.GetStringRef(), ';')) {
+for (llvm::StringRef x : llvm::split(response.GetStringRef(), ';')) {
   if (x == "qXfer:auxv:read+")
 m_supports_qXfer_auxv_read = eLazyBoolYes;
   else if (x == "qXfer:libraries-svr4:read+")
@@ -1609,7 +1609,7 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo(
   error.SetErrorString(error_string.c_str());
 } else if (name.equals("dirty-pages")) {
   std::vector dirty_page_list;
-  for (llvm::StringRef x : llvm::Split(value, ',')) {
+  for (llvm::StringRef x : llvm::split(value, ',')) {
 addr_t page;
 x.consume_front("0x");
 if (llvm::to_integer(x, page, 16))

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 8a86734b3da9e..2080e09da3c2a 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3637,7 +3637,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(
   StringRef packet_str{packet.GetStringRef()};
   assert(packet_str.startswith("qSaveCore"));
   if (packet_str.consume_front("qSaveCore;")) {
-for (auto x : llvm::Split(packet_str, ';')) {
+for (auto x : llvm::split(packet_str, ';')) {
   if (x.consume_front("path-hint:"))
 StringExtractor(x).GetHexByteString(path_hint);
   else

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3c2476c6b730e..92e1e57f84260 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -375,7 +375,7 @@ static size_t SplitCommaSeparatedRegisterNumberString(
 const llvm::StringRef _separated_register_numbers,
 std::vector , int base) {
   regnums.clear();
-  for (llvm::StringRef x : llvm::Split(comma_separated_register_numbers, ',')) 
{
+  for (llvm::StringRef x : llvm::split(comma_separated_register_numbers, ',')) 
{
 uint32_t reg;
 if (llvm::to_integer(x, reg, base))
   regnums.push_back(reg);
@@ -1405,7 +1405,7 @@ size_t 
ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(
 size_t ProcessGDBRemote::UpdateThreadPCsFromStopReplyThreadsValue(
 llvm::StringRef value) {
   m_thread_pcs.clear();
-  for (llvm::StringRef x : llvm::Split(value, ',')) {
+  for (llvm::StringRef x : llvm::split(value, ',')) {
 lldb::addr_t pc;
 if 

[Lldb-commits] [PATCH] D112212: [lldb/test] Print build commands in trace mode

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 381500.
labath added a comment.

- support single command only
- add a test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112212

Files:
  lldb/packages/Python/lldbsuite/test/builders/builder.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test_event/build_exception.py
  lldb/test/API/test_utils/Makefile
  lldb/test/API/test_utils/TestBaseTest.py
  lldb/test/API/test_utils/return0.cpp

Index: lldb/test/API/test_utils/return0.cpp
===
--- /dev/null
+++ lldb/test/API/test_utils/return0.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
Index: lldb/test/API/test_utils/TestBaseTest.py
===
--- /dev/null
+++ lldb/test/API/test_utils/TestBaseTest.py
@@ -0,0 +1,34 @@
+"""
+Test TestBase test functions.
+"""
+
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test_event import build_exception
+import six
+
+class TestBuildMethod(Base):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+super().setUp()
+self._traces = []
+self.traceAlways = True
+
+def trace(self, *args, **kwargs):
+io = six.StringIO()
+print(*args, file=io, **kwargs)
+self._traces.append(io.getvalue())
+
+def test_build_fails_helpfully(self):
+try:
+self.build(dictionary={"CXX_SOURCES": "nonexisting-file.cpp"})
+except build_exception.BuildError as e:
+self.assertIn("nonexisting-file.cpp", str(e))
+else:
+self.fail("BuildError not raised!")
+
+def test_build_logs_traces(self):
+self.build(dictionary={"CXX_SOURCES": "return0.cpp"})
+self.assertIn("CXX_SOURCES", self._traces[0])
+self.assertIn("return0.o", self._traces[1])
Index: lldb/test/API/test_utils/Makefile
===
--- /dev/null
+++ lldb/test/API/test_utils/Makefile
@@ -0,0 +1 @@
+include Makefile.rules
Index: lldb/packages/Python/lldbsuite/test_event/build_exception.py
===
--- lldb/packages/Python/lldbsuite/test_event/build_exception.py
+++ lldb/packages/Python/lldbsuite/test_event/build_exception.py
@@ -1,10 +1,11 @@
+import shlex
+
 class BuildError(Exception):
 
 def __init__(self, called_process_error):
 super(BuildError, self).__init__("Error when building test subject")
-self.command = called_process_error.lldb_extensions.get(
-"command", "")
-self.build_error = called_process_error.lldb_extensions["combined_output"]
+self.command = shlex.join(called_process_error.cmd)
+self.build_error = called_process_error.output
 
 def __str__(self):
 return self.format_build_error(self.command, self.build_error)
@@ -12,4 +13,4 @@
 @staticmethod
 def format_build_error(command, command_output):
 return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format(
-command, command_output.decode("utf-8", errors='ignore'))
+command, command_output)
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -45,6 +45,7 @@
 import re
 import shutil
 import signal
+import shlex
 from subprocess import *
 import sys
 import time
@@ -68,6 +69,7 @@
 from lldbsuite.support import encoded_file
 from lldbsuite.support import funcutils
 from lldbsuite.test.builders import get_builder
+from lldbsuite.test_event import build_exception
 
 # See also dotest.parseOptionsAndInitTestdirs(), where the environment variables
 # LLDB_COMMAND_TRACE is set from '-t' option.
@@ -469,61 +471,6 @@
 def terminate(self):
 lldb.remote_platform.Kill(self._pid)
 
-# From 2.7's subprocess.check_output() convenience function.
-# Return a tuple (stdoutdata, stderrdata).
-
-
-def system(commands, **kwargs):
-r"""Run an os command with arguments and return its output as a byte string.
-
-If the exit code was non-zero it raises a CalledProcessError.  The
-CalledProcessError object will have the return code in the returncode
-attribute and output in the output attribute.
-
-The arguments are the same as for the Popen constructor.  Example:
-
->>> check_output(["ls", "-l", "/dev/null"])
-'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'
-
-The stdout argument is not allowed as it is used internally.
-To capture standard error in the result, use stderr=STDOUT.
-
->>> check_output(["/bin/sh", "-c",
-...   "ls -l non_existent_file ; exit 0"],
-...  stderr=STDOUT)
-'ls: 

[Lldb-commits] [PATCH] D110535: [llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

2021-10-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

It makes things a bit more complicated, which then makes the case for dropping 
char slightly stronger, but I still don't think it's worth making a fuss of it.




Comment at: llvm/unittests/ADT/StringExtrasTest.cpp:327
+
+  EXPECT_EQ(ArrayRef(Result), ArrayRef(Expected));
+}

maybe `EXPECT_THAT(Result, testing::ElementsAre("foo", "bar", "", "baz"));`


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

https://reviews.llvm.org/D110535

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


[Lldb-commits] [lldb] b5e9f83 - [lldb] Remove ConstString from ABI, Architecture and Disassembler plugin names

2021-10-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-10-22T10:29:19+02:00
New Revision: b5e9f83ea48e29f0fe6d03354303179e5daaec1e

URL: 
https://github.com/llvm/llvm-project/commit/b5e9f83ea48e29f0fe6d03354303179e5daaec1e
DIFF: 
https://github.com/llvm/llvm-project/commit/b5e9f83ea48e29f0fe6d03354303179e5daaec1e.diff

LOG: [lldb] Remove ConstString from ABI, Architecture and Disassembler plugin 
names

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/Core/Disassembler.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h
lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
lldb/source/Plugins/ABI/ARM/ABISysV_arm.h
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h
lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
lldb/source/Plugins/ABI/Mips/ABISysV_mips.h
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h
lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
lldb/source/Plugins/ABI/X86/ABISysV_i386.h
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h
lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h
lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h
lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp
lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 122c63183db27..3c79cd2e6c146 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -54,7 +54,7 @@ class PluginManager {
   static void Terminate();
 
   // ABI
-  static bool RegisterPlugin(ConstString name, const char *description,
+  static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
  ABICreateInstance create_callback);
 
   static bool UnregisterPlugin(ABICreateInstance create_callback);
@@ -62,7 +62,7 @@ class PluginManager {
   static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
 
   // Architecture
-  static void RegisterPlugin(ConstString name, llvm::StringRef description,
+  static void RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
  ArchitectureCreateInstance create_callback);
 
   static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
@@ -71,7 +71,7 @@ class PluginManager {
   CreateArchitectureInstance(const ArchSpec );
 
   // Disassembler
-  static bool RegisterPlugin(ConstString name, const char *description,
+  static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
  DisassemblerCreateInstance create_callback);
 
   static bool UnregisterPlugin(DisassemblerCreateInstance create_callback);
@@ -80,7 +80,7 @@ class PluginManager {
   GetDisassemblerCreateCallbackAtIndex(uint32_t idx);
 
   static DisassemblerCreateInstance
-  GetDisassemblerCreateCallbackForPluginName(ConstString name);
+  GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name);
 
   // DynamicLoader
   static bool

diff  --git a/lldb/source/Core/Disassembler.cpp 
b/lldb/source/Core/Disassembler.cpp
index d147f8fbb0dba..00d92053bc4f5 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -64,9 +64,8 @@ DisassemblerSP Disassembler::FindPlugin(const ArchSpec ,
   DisassemblerCreateInstance create_callback = nullptr;
 
   if (plugin_name) {
-ConstString const_plugin_name(plugin_name);
-create_callback = 

[Lldb-commits] [lldb] 71cfce8 - [lldb] Fix TestCompressedVectors after array type name change

2021-10-22 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-10-22T10:15:53+02:00
New Revision: 71cfce832054dfea8e79769f15a3fdc05d23b733

URL: 
https://github.com/llvm/llvm-project/commit/71cfce832054dfea8e79769f15a3fdc05d23b733
DIFF: 
https://github.com/llvm/llvm-project/commit/71cfce832054dfea8e79769f15a3fdc05d23b733.diff

LOG: [lldb] Fix TestCompressedVectors after array type name change

aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7 turns array names such as `int [1]`
into `int[1]` (without the space). This probably breaks some user formatters,
but let's first get this test running while this is being discussed.

Added: 


Modified: 

lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
 
b/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
index 4b36d02da14df..d7d5579b5fdbc 100644
--- 
a/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
+++ 
b/lldb/test/API/functionalities/data-formatter/compactvectors/TestCompactVectors.py
@@ -49,8 +49,8 @@ def cleanup():
 substrs=[
 '(vFloat) valueFL = (1.25, 0, 0.25, 0)',
 '(vDouble) valueDL = (1.25, 2.25)',
-'(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
-'(int32_t [4]) valueI32 = (1, 0, 4, 0)',
+'(int16_t[8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
+'(int32_t[4]) valueI32 = (1, 0, 4, 0)',
 '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
 '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
 '(vUInt32) valueU32 = (1, 2, 3, 4)',



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