[Lldb-commits] [PATCH] D78337: [lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool

2020-04-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks. The observed difference appears to be (borderline) statistically 
significant, but the difference (~1%) is not very big, so I think that's worth 
reusing the llvm class (and any future performance improvements). I think the 
difference will go down even more if you avoid recreating the thread pool three 
times.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D78337



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


[Lldb-commits] [PATCH] D77970: 2/2: [nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

2020-04-21 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 258920.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77970

Files:
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -32,7 +32,7 @@
   DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash);
 
   void GetObjCMethods(lldb_private::ConstString class_name,
-  llvm::function_ref callback) override;
+  llvm::function_ref callback) override;
 
   llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language) override;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -97,7 +97,7 @@
 
 void SymbolFileDWARFDwo::GetObjCMethods(
 lldb_private::ConstString class_name,
-llvm::function_ref callback) {
+llvm::function_ref callback) {
   GetBaseSymbolFile().GetObjCMethods(class_name, callback);
 }
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -238,7 +238,7 @@
   GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu);
 
   virtual void GetObjCMethods(lldb_private::ConstString class_name,
-  llvm::function_ref callback);
+  llvm::function_ref callback);
 
   bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1464,7 +1464,7 @@
 }
 
 void SymbolFileDWARF::GetObjCMethods(
-ConstString class_name, llvm::function_ref callback) {
+ConstString class_name, llvm::function_ref callback) {
   m_index->GetObjCMethods(class_name, callback);
 }
 
@@ -2051,17 +2051,11 @@
   uint32_t pruned_idx = original_size;
 
   SymbolContext sc;
-  m_index->GetGlobalVariables(ConstString(basename), [&](DIERef die_ref) {
+  m_index->GetGlobalVariables(ConstString(basename), [&](DWARFDIE die) {
 if (!sc.module_sp)
   sc.module_sp = m_objfile_sp->GetModule();
 assert(sc.module_sp);
 
-DWARFDIE die = GetDIE(die_ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
-  return true;
-}
-
 if (die.Tag() != DW_TAG_variable)
   return true;
 
@@ -2123,17 +2117,11 @@
   const uint32_t original_size = variables.GetSize();
 
   SymbolContext sc;
-  m_index->GetGlobalVariables(regex, [&](DIERef die_ref) {
+  m_index->GetGlobalVariables(regex, [&](DWARFDIE die) {
 if (!sc.module_sp)
   sc.module_sp = m_objfile_sp->GetModule();
 assert(sc.module_sp);
 
-DWARFDIE die = GetDIE(die_ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(die_ref, regex.GetText());
-  return true;
-}
-
 DWARFCompileUnit *dwarf_cu = llvm::dyn_cast(die.GetCU());
 if (!dwarf_cu)
   return true;
@@ -2292,14 +2280,8 @@
 regex.GetText().str().c_str());
   }
 
-  DWARFDebugInfo &info = DebugInfo();
   llvm::DenseSet resolved_dies;
-  m_index->GetFunctions(regex, [&](DIERef ref) {
-DWARFDIE die = info.GetDIE(ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(ref, regex.GetText());
-  return true;
-}
+  m_index->GetFunctions(regex, [&](DWARFDIE die) {
 if (resolved_dies.insert(die.GetDIE()).second)
   ResolveFunction(die, include_inlines, sc_list);
 return true;
@@ -2359,13 +2341,7 @@
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
 return;
 
-  m_index->GetTypes(name, [&](DIERef die_ref) {
-DWARFDIE die = GetDIE(die_ref);
-if (!die) {

[Lldb-commits] [PATCH] D75750: [lldb] integrate debuginfod

2020-04-21 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D75750#1991873 , @labath wrote:

> In D75750#1988694 , @jankratochvil 
> wrote:
>
> > The current plan discussed with @kwk is to create the new `SymbolServer` 
> > abstract superclass and some its inherited implementation and move there 
> > the appropriate parts of existing 
> > `lldb/source/Symbol/LocateSymbolFile.cpp`. Current `SymbolVendor` 
> > implementations would then iterate new `SymbolServer`s by the existing 
> > `LocateExecutableSymbolFile` function. That may be enough for a patch of 
> > its own.
>
>
> I'll have to see the actual patch for a definitive opinion, but I have to say 
> that a priori I am sceptical of this direction. And yes, that should 
> definitely be a separate patch.


This separate `SymbolServer` is following @clayborg's comment above 
.
You proposed to merge `SymbolServer` with `SymbolVendor` in @labath's comment 
above .
I found more clean the separate `SymbolServer` variant as there is orthogonal 
functionality of locating the files (on disk or from symbol server - 
`SymbolServer`) vs. extracting the unique ID from current file (extracting 
build-id - `SymbolVendor` functionality). So from the both proposed solutions I 
preferred the @clayborg's comment above 
.
I hope there is no misunderstanding which could lead to @kwk implementing a 
third solution nobody wants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75750



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


[Lldb-commits] [PATCH] D77970: 2/2: [nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

2020-04-21 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 258921.
jankratochvil marked 2 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77970

Files:
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -32,7 +32,7 @@
   DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash);
 
   void GetObjCMethods(lldb_private::ConstString class_name,
-  llvm::function_ref callback) override;
+  llvm::function_ref callback) override;
 
   llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language) override;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -97,7 +97,7 @@
 
 void SymbolFileDWARFDwo::GetObjCMethods(
 lldb_private::ConstString class_name,
-llvm::function_ref callback) {
+llvm::function_ref callback) {
   GetBaseSymbolFile().GetObjCMethods(class_name, callback);
 }
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -238,7 +238,7 @@
   GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu);
 
   virtual void GetObjCMethods(lldb_private::ConstString class_name,
-  llvm::function_ref callback);
+  llvm::function_ref callback);
 
   bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1464,7 +1464,7 @@
 }
 
 void SymbolFileDWARF::GetObjCMethods(
-ConstString class_name, llvm::function_ref callback) {
+ConstString class_name, llvm::function_ref callback) {
   m_index->GetObjCMethods(class_name, callback);
 }
 
@@ -2051,17 +2051,11 @@
   uint32_t pruned_idx = original_size;
 
   SymbolContext sc;
-  m_index->GetGlobalVariables(ConstString(basename), [&](DIERef die_ref) {
+  m_index->GetGlobalVariables(ConstString(basename), [&](DWARFDIE die) {
 if (!sc.module_sp)
   sc.module_sp = m_objfile_sp->GetModule();
 assert(sc.module_sp);
 
-DWARFDIE die = GetDIE(die_ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
-  return true;
-}
-
 if (die.Tag() != DW_TAG_variable)
   return true;
 
@@ -2123,17 +2117,11 @@
   const uint32_t original_size = variables.GetSize();
 
   SymbolContext sc;
-  m_index->GetGlobalVariables(regex, [&](DIERef die_ref) {
+  m_index->GetGlobalVariables(regex, [&](DWARFDIE die) {
 if (!sc.module_sp)
   sc.module_sp = m_objfile_sp->GetModule();
 assert(sc.module_sp);
 
-DWARFDIE die = GetDIE(die_ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(die_ref, regex.GetText());
-  return true;
-}
-
 DWARFCompileUnit *dwarf_cu = llvm::dyn_cast(die.GetCU());
 if (!dwarf_cu)
   return true;
@@ -2292,14 +2280,8 @@
 regex.GetText().str().c_str());
   }
 
-  DWARFDebugInfo &info = DebugInfo();
   llvm::DenseSet resolved_dies;
-  m_index->GetFunctions(regex, [&](DIERef ref) {
-DWARFDIE die = info.GetDIE(ref);
-if (!die) {
-  m_index->ReportInvalidDIERef(ref, regex.GetText());
-  return true;
-}
+  m_index->GetFunctions(regex, [&](DWARFDIE die) {
 if (resolved_dies.insert(die.GetDIE()).second)
   ResolveFunction(die, include_inlines, sc_list);
 return true;
@@ -2359,13 +2341,7 @@
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
 return;
 
-  m_index->GetTypes(name, [&](DIERef die_ref) {
-D

[Lldb-commits] [PATCH] D77970: 2/2: [nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

2020-04-21 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked 4 inline comments as done.
jankratochvil added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h:82
+  /// The object will remain valid during the whole call statement:
+  /// Function(name, DIERefCallback({callback, name}));
+  struct DIERefCallbackArgs {

labath wrote:
> jankratochvil wrote:
> > This calling with curly brackets is a bit tricky but I found it the least 
> > worst option.
> I think it would be much simpler to make this a callable object instead 
> (though I'm not sure we need to worry about optimizing to this level of 
> detail):
> ```
> class ResultProcessor (?) {
>   ResultProcessor(callback, name);
>   bool operator()(DIERef ref);
> };
> ```
Wow, that solved everything, thanks. No more mallocs, no more stale references, 
the most simple calling syntax. No compromises.
I did not know `llvm::function_ref<>` does not need any `std::function`, it is 
fine with a callable object.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:186
 
+  auto dierefcallback = DIERefCallback({callback, class_name.GetStringRef()});
   for (DIERef ref : incomplete_types)

labath wrote:
> dangling `DIERefCallbackArgs` here.
oops, I even did not handle the usage in a patch of mine.  But the stale 
references are no longer possible with the callable object now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77970



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


[Lldb-commits] [PATCH] D76955: [lldb/Test] Decode stdout and stderr in case it contains UTF-8

2020-04-21 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.

This seems like the simplest thing to do while we wait for py2 to die.


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

https://reviews.llvm.org/D76955



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


[Lldb-commits] [PATCH] D78396: [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets

2020-04-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I don't have a vested interested here (the main reason I looked at this was the 
template discussion), but I have made a cursory pass over the patch. I didn't 
check the high level functionality, but it seems like the implementation 
details can be improved upon.




Comment at: lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp:45
+  addr_t addr = m_address.GetLoadAddress(target);
+  size_t size = sizeof(m_ht->base) + sizeof(m_ht->bits);
+

I am not sure, but I think this still may technically be undefined behavior if 
`m_ht` is null even though the application of `sizeof` means the dereference 
will not normally take place.



Comment at: lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp:47-62
+  DataBufferHeap buffer(size, 0);
+  m_exe_ctx_ref.GetProcessSP()->ReadMemory(addr, buffer.GetBytes(), size,
+   error);
+  if (error.Fail())
+return false;
+
+  DataExtractor data_extractor = DataExtractor(

Why don't you just pass `m_ht.get()` to `ReadMemory` ?



Comment at: lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp:71-82
+  m_exe_ctx_ref.GetProcessSP()->ReadMemory(ptr_offset, buffer.GetBytes(), size,
+   error);
+
+  if (error.Fail()) {
+m_ht = nullptr;
+return false;
+  }

`ReadMemory(ptr_offset, m_ht->pointers, ...)` ?



Comment at: lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:692-693
+
+lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::
+~NSCFDictionarySyntheticFrontEnd() {}
+

`= default`? Maybe even implicitly default by not providing a destructor?



Comment at: lldb/source/Plugins/Language/ObjC/NSSet.cpp:666-667
+
+DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(), m_order,
+   m_ptr_size);
+

You've cargo-culted this code, but you've changed `DataBufferSP` to a plain 
`DataBuffer`. If the created valueobject continues to reference this data (I 
haven't checked, but I think it does), this will be a dangling reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78396



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


[Lldb-commits] [PATCH] D78421: Fix out of sync source code/executable when debugging

2020-04-21 Thread Martin Schmidt via Phabricator via lldb-commits
n1tram1 added a comment.

In D78421#1993030 , @jingham wrote:

> So you check the currently selected frame's module - which is libbar.dylib 
> and find that it was built before FileFromNotBar.c and would show me the old 
> version.
>
> Showing me the latest version of the file is not great, but totally 
> explicable.  Whereas this error, when it happens, would be confusing and hard 
> to understand.


So instead I should try to find which module the source file belongs to and 
check that module's modification time (instead of getting the currently 
selected frame) ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78421



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


[Lldb-commits] [PATCH] D78489: [lldb/DWARF] Trust CU DW_AT_low/high_pc information when building address tables

2020-04-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks for the tip about commenting out DW_AT_ranges code. I wanted to do some 
measurements, but I couldn't find a non-contrived non-trivial code base to try 
this on (with c++ most compile units always get DW_AT_ranges due to all of the 
ODR linkage brought in by templates). The results are very interesting. The 
test setup is: release (no assert) lldb debugging a debug clang with 
accelerator tables (to avoid debug info indexing overshadowing everything). I'm 
running `rel/lldb dbg/clang -o "image lookup -a 0x7234567" -b` as a benchmark, 
running it 10 times and averaging. The address is a random address inside 
clang's .text section.

With the current code, where we get this information via DW_AT_ranges from most 
compile units (only 30 CUs don't have it), the command takes 5.15 (+/- .04) 
seconds. With the DW_AT_ranges code commented out, where we get information by 
traversing the DIE tree, it takes 10.38 (+/- 0.05) seconds. With both 
DW_AT_ranges *and* DIE code removed (information retrieved via line tables), 
the time is 6.85 (+/- 0.03) seconds. These results make sense to me, as line 
tables are much simpler and easier to parse than DIE trees, and this makes it 
possible to avoid parsing a lot of compile units

So, not only does this remove code, and improve llvm consistency, it also makes 
things faster, if only for a limited amount of users (those building with 
clang<=3.3, or those building huge amounts of C code  -- the patch is nfc for 
the rest). Sounds like a win-win-win to me (?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78489



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


[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-21 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.

Looks good. I'll leave it up to you to consider whether the `PySys_WriteStderr` 
thingy is a good idea.




Comment at: lldb/bindings/python/python-typemaps.swig:72
+  PythonObject obj = Retain($input);
+  unsigned long long state_type_value = unwrapOrSetPythonException(As(obj)); 
+  if (PyErr_Occurred())

it looks like this line needs wrapping



Comment at: lldb/bindings/python/python-wrapper.swig:585-597
+llvm::Expected result = pfunc.Call(PythonString(child_name));
 
-if (!result.IsAllocated())
-return UINT32_MAX;
+long long retval = unwrapOrSetPythonException(As(std::move(result)));
 
-PythonInteger int_result = result.AsType();
-if (!int_result.IsAllocated())
+if (PyErr_Occurred()) { 
+PyErr_Clear(); // FIXME print this? do something else
 return UINT32_MAX;

If you don't print this, then you could definitely do something like:
```
Expected result = As(pfunc.Call(PythonString(child_name));
if (result)
  return std::max(*result, 0);
consumeError(result.takeError());
return UINT32_MAX;
```



Comment at: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:3153-3159
+  long long py_return = unwrapOrSetPythonException(
+  As(implementor.CallMethod(callee_name)));
 
   // if it fails, print the error but otherwise go on
   if (PyErr_Occurred()) {
 PyErr_Print();
 PyErr_Clear();

lawrence_danna wrote:
> labath wrote:
> > This converts the Expected into a python exception, only to clear (and 
> > print) it at the next line. Is there a more direct way of doing it?
> I don't know, what did you have in mind?   It could just call the Python C 
> API directly and not bother converting it into an Expected, but would that be 
> better?
I was thinking if theres some function to print to stderr directly without 
doing the `PyErr` dance. `PySys_WriteStderr` maybe?

```
if (Expected py_return = As(implementor.CallMethod(callee_name)))
  result = *py_return;
else
  PySys_WriteStderr("%s", toString(py_return.takeError()).c_str());
```
?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462



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


[Lldb-commits] [PATCH] D77759: [lldb/Reproducers] Fix passive replay for functions returning string as (char*, size_t).

2020-04-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D77759#1992670 , @JDevlieghere 
wrote:

> In D77759#1992252 , @labath wrote:
>
> > In D77759#1988419 , @labath wrote:
> >
> > > Hmm... well, I like how this (active&passive) is unified at the template 
> > > level. It still feels like there's too much code to implement this thing 
> > > (coming from the duplication for const, non-const and static variants), 
> > > but I'm not sure what can be done about that. I'll need to ponder this a 
> > > bit more
> >
> >
> > After sleeping on this a couple of times, I've come to believe that the 
> > problem here is that we've let the redirection functions inherit the c++ 
> > function pointer weirdness, which resulted in a need to write template goo 
> > for const, non-const and static methods (and maybe sometimes even 
> > constructors). The goo is (more or less) unavoidable if we want to have 
> > compiler-generated "identifiers" for all these functions, but there's a 
> > difference between writing that once, and once for each redirection we need 
> > to make. Particularly as it doesn't seem like there's a compelling reason 
> > for that. There no reason that the "redirected" function in the replayer 
> > machinery needs be globally unique in the same way as the "original" 
> > functions do. In fact I think it doesn't even have to be a template at all 
> > -- it could just take the function-to-wrap as a regular argument instead of 
> > a templated one.
>
>
> Yeah, I've come to the same conclusion while working on this. Hindsight is 
> 20/20 and changing all that might be a significant amount of work.


That last part makes me thing that we have not come to the same conclusion. :P 
I'm not talking about changing the entire mechanism of how we assign "ids" to 
functions and stuff. While it is true that it's not working out as well as I 
originally hoped, I still think that's ok, and having a bit of template goo to 
enable that is not bad. I'm just talking about changing how the "redirection" 
mechanism works -- the redirected functions don't need to be uniquely 
identifiable in the same way, as they can just be linked to the original 
function id, and so we should be able to come up with a less goo-ey mechanism 
for writing those. While that would certainly be "work" I don't think it would 
be a "significant" amount of work, as we only have a handful of redirected 
functions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77759



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


[Lldb-commits] [PATCH] D77043: Fix process gdb-remote usage of value_regs/invalidate_regs

2020-04-21 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

@labath

I have considered alternatives which can be used to avoid this patch altogether.

We are creating dynamic register infos vector for SVE in D77047 
. This is needed because we have update 
register size and offset of SVE registers.

The reason this problem of register indexes not matching with native register 
number happens because we place SVE register set after debug registers in 
register infos list. Linux does not use debug register and thus we have to jump 
over those register indexes which creates a mismatch in value reg list of SVE Z 
registers. see here 
https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/Utility/RegisterInfos_arm64.h#L719

To solve this problem:

1. First option we have is that also update/correct the value_regs and LLDB 
register no while sharing these register infos to correct register indexes. 
This is more like a hack but should work as long as we correctly keep track of 
LLDB register nos that we assign to SVE register. Register nos are mostly 
considered constant and expected to remain fixed so it will be ugly to change 
them specially when they might also be used by other parts of code.

2. Second option is to avoid the use of debug registers altogether in SVE 
register infos list which will mean that sve register nos may overlap with 
debug registers and in future if some other target wants to implement sve 
register access then will have to correct this and push debug register after 
SVE registers in the list.

3. and final option is what I have already implemented in this patch.

What do you think?


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

https://reviews.llvm.org/D77043



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


[Lldb-commits] [PATCH] D77047: AArch64 SVE register infos and ptrace support

2020-04-21 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid marked 4 inline comments as done.
omjavaid added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:1191
+  size_t vq = sve_vq_from_vl(m_sve_header.vl);
+  SetRegisterInfoMode(vq);
+  m_sve_ptrace_payload.resize(SVE_PT_SIZE(vq, SVE_PT_REGS_SVE));

SetRegisterInfoMode(vq); is getting called over here.



Comment at: lldb/source/Plugins/Process/Linux/NativeThreadLinux.h:42-43
   NativeRegisterContextLinux &GetRegisterContext() override {
+if (m_reg_context_up && IsStopped(nullptr))
+  m_reg_context_up->ConfigureRegisterContext();
+

labath wrote:
> Why can't this work be done in the register context constructor? I believe we 
> are always creating a Thread (and its reg context) while it is stopped...
ConfigureRegisterContext makes sure that sve register offsets and sizes are 
correctly updated and synced from ptrace on every stop. If SVE registers 
reconfigure themselves we ll have to update that information into our dynamic 
register infos array. Although for the context of this patch it assumes it will 
never change its register size during execution. But I will follow up patch 
that implements that behaviour.


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

https://reviews.llvm.org/D77047



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


[Lldb-commits] [PATCH] D78337: [lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool

2020-04-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 259014.
JDevlieghere added a comment.

Share the thread pool instead of recreating it.


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

https://reviews.llvm.org/D78337

Files:
  lldb/include/lldb/Host/TaskPool.h
  lldb/include/lldb/module.modulemap
  lldb/source/Host/CMakeLists.txt
  lldb/source/Host/common/TaskPool.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/unittests/Host/CMakeLists.txt
  lldb/unittests/Host/TaskPoolTest.cpp

Index: lldb/unittests/Host/TaskPoolTest.cpp
===
--- lldb/unittests/Host/TaskPoolTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "gtest/gtest.h"
-
-#include "lldb/Host/TaskPool.h"
-
-using namespace lldb_private;
-
-TEST(TaskPoolTest, AddTask) {
-  auto fn = [](int x) { return x * x + 1; };
-
-  auto f1 = TaskPool::AddTask(fn, 1);
-  auto f2 = TaskPool::AddTask(fn, 2);
-  auto f3 = TaskPool::AddTask(fn, 3);
-  auto f4 = TaskPool::AddTask(fn, 4);
-
-  ASSERT_EQ(10, f3.get());
-  ASSERT_EQ(2, f1.get());
-  ASSERT_EQ(17, f4.get());
-  ASSERT_EQ(5, f2.get());
-}
-
-TEST(TaskPoolTest, RunTasks) {
-  std::vector r(4);
-
-  auto fn = [](int x, int &y) { y = x * x + 1; };
-
-  TaskPool::RunTasks([fn, &r]() { fn(1, r[0]); }, [fn, &r]() { fn(2, r[1]); },
- [fn, &r]() { fn(3, r[2]); }, [fn, &r]() { fn(4, r[3]); });
-
-  ASSERT_EQ(2, r[0]);
-  ASSERT_EQ(5, r[1]);
-  ASSERT_EQ(10, r[2]);
-  ASSERT_EQ(17, r[3]);
-}
-
-TEST(TaskPoolTest, TaskMap) {
-  int data[4];
-  auto fn = [&data](int x) { data[x] = x * x; };
-
-  TaskMapOverInt(0, 4, fn);
-
-  ASSERT_EQ(data[0], 0);
-  ASSERT_EQ(data[1], 1);
-  ASSERT_EQ(data[2], 4);
-  ASSERT_EQ(data[3], 9);
-}
Index: lldb/unittests/Host/CMakeLists.txt
===
--- lldb/unittests/Host/CMakeLists.txt
+++ lldb/unittests/Host/CMakeLists.txt
@@ -11,7 +11,6 @@
   SocketAddressTest.cpp
   SocketTest.cpp
   SocketTestUtilities.cpp
-  TaskPoolTest.cpp
 )
 
 if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
Index: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -13,14 +13,21 @@
 #include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Host/TaskPool.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
+#include "llvm/Support/ThreadPool.h"
 
 using namespace lldb_private;
 using namespace lldb;
 
+static void TaskMapOverInt(llvm::ThreadPool pool, size_t end,
+   const llvm::function_ref &func) {
+  for (size_t i = 0; i < end; i++)
+pool.async(func, i);
+  pool.wait();
+}
+
 void ManualDWARFIndex::Index() {
   if (!m_dwarf)
 return;
@@ -71,20 +78,23 @@
 clear_cu_dies[cu_idx] = units_to_index[cu_idx]->ExtractDIEsScoped();
   };
 
+  // Share one thread pool across operations to avoid the overhead of
+  // recreating the threads.
+  llvm::ThreadPool pool;
+
   // Create a task runner that extracts dies for each DWARF unit in a
-  // separate thread
+  // separate thread.
   // First figure out which units didn't have their DIEs already
   // parsed and remember this.  If no DIEs were parsed prior to this index
   // function call, we are going to want to clear the CU dies after we are
   // done indexing to make sure we don't pull in all DWARF dies, but we need
   // to wait until all units have been indexed in case a DIE in one
   // unit refers to another and the indexes accesses those DIEs.
-  TaskMapOverInt(0, units_to_index.size(), extract_fn);
+  TaskMapOverInt(pool, units_to_index.size(), extract_fn);
 
   // Now create a task runner that can index each DWARF unit in a
   // separate thread so we can index quickly.
-
-  TaskMapOverInt(0, units_to_index.size(), parser_fn);
+  TaskMapOverInt(pool, units_to_index.size(), parser_fn);
 
   auto finalize_fn = [this, &sets](NameToDIE(IndexSet::*index)) {
 NameToDIE &result = m_set.*index;
@@ -93,14 +103,15 @@
 result.Finalize();
   };
 
-  TaskPool::RunTasks([&]() { finalize_fn(&IndexSet::function_basenames); },
- [&]() { finalize_fn(&IndexSet::function_fullnames); },
- [&]() { finalize_fn(&IndexSet::function_methods); },
- [&]() { finalize_fn(&IndexSet::function_selectors); },
- [&]() { finalize_fn(&IndexSet::objc_class_selectors); },
- [&]() { finalize_fn(&IndexSet::globals); },
- [&]() { finalize_fn(&IndexSet::types); },
- [&]() { finalize_fn(&IndexSet::namespaces); });
+  pool.async(finalize_fn, &IndexSet::function_basenames);
+  pool.async(finalize_fn, &Ind

[Lldb-commits] [PATCH] D76955: [lldb/Test] Decode stdout and stderr in case it contains UTF-8

2020-04-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2de52422acf0: [lldb/Test] Decode stdout and stderr in case 
it contains Unicode. (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76955

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -110,6 +110,11 @@
 timeoutInfo = 'Reached timeout of {} seconds'.format(
 litConfig.maxIndividualTestTime)
 
+if sys.version_info.major == 2:
+# In Python 2, string objects can contain Unicode characters.
+out = out.decode('utf-8')
+err = err.decode('utf-8')
+
 output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
 ' '.join(cmd), exitCode)
 if timeoutInfo is not None:


Index: lldb/test/API/lldbtest.py
===
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -110,6 +110,11 @@
 timeoutInfo = 'Reached timeout of {} seconds'.format(
 litConfig.maxIndividualTestTime)
 
+if sys.version_info.major == 2:
+# In Python 2, string objects can contain Unicode characters.
+out = out.decode('utf-8')
+err = err.decode('utf-8')
+
 output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
 ' '.join(cmd), exitCode)
 if timeoutInfo is not None:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Sander de Smalen via Phabricator via lldb-commits
sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

Thanks for all the changes, this patch LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587



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


[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Christopher Tetreault via Phabricator via lldb-commits
ctetreau updated this revision to Diff 259044.
ctetreau added a comment.

Fixup canLosslesslyBitCastTo to use FixedVectorType again


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587

Files:
  lldb/source/Expression/IRInterpreter.cpp
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
  llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Index: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
===
--- mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -168,12 +168,12 @@
   return nullptr;
 return LLVMType::getArrayTy(elementType, type->getArrayNumElements());
   }
-  case llvm::Type::VectorTyID: {
-auto *typeVTy = llvm::cast(type);
-if (typeVTy->isScalable()) {
-  emitError(unknownLoc) << "scalable vector types not supported";
-  return nullptr;
-}
+  case llvm::Type::ScalableVectorTyID: {
+emitError(unknownLoc) << "scalable vector types not supported";
+return nullptr;
+  }
+  case llvm::Type::FixedVectorTyID: {
+auto *typeVTy = llvm::cast(type);
 LLVMType elementType = processType(typeVTy->getElementType());
 if (!elementType)
   return nullptr;
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -488,7 +488,8 @@
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID: {
 auto *STyL = cast(TyL);
 auto *STyR = cast(TyR);
 if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -130,7 +130,8 @@
   default: break;
   case Type::PointerTyID:
 return true;
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID:
 if (cast(Ty)->getElementType()->isPointerTy())
   return true;
 break;
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1184,7 +1184,7 @@
 case Type::IntegerTyID: // Integers larger than 64 bits
 case Type::StructTyID:
 case Type::ArrayTyID:
-case Type::VectorTyID:
+case Type::FixedVectorTyID:
   ElementSize = DL.getTypeStoreSize(ETy);
   // Ptx allows variable initilization only for constant and
   // global state spaces.
@@ -1358,7 +1358,7 @@
   switch (ETy->getTypeID()) {
   case Type::StructTyID:
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
 ElementSize = DL.getTypeStoreSize(ETy);
 O << " .b8 ";
 getSymbol(GVar)->print(O, MAI);
@@ -1892,7 +1892,7 @@
   }
 
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
   case Type::StructTyID: {
 if (isa(CPV) || isa(CPV)) {
   int ElementSize = DL.getTypeAllocSize(CPV->getType());
Index: llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
===
--- llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
@@ -307,7 +307,7 @@
 const ArrayType *ATy = cast(Ty);
 return getSmallestAddressableSize(ATy->getElementType(), GV, TM);
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID: {
 const VectorType *PTy = cast(Ty);
 return getSmallestAddressableSize(PTy->getElementType(), GV, TM);
   }
Index: llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
@@ -408,8 +

Re: [Lldb-commits] [PATCH] D78421: Fix out of sync source code/executable when debugging

2020-04-21 Thread Jim Ingham via lldb-commits
Yes, to do it right you should do that.  I think it would still be worthwhile 
to first check whether the current frame’s source file is the one being asked 
for, since that is a very common way to get to source files and that would make 
going from source file -> module very cheap.  But otherwise, I can’t see a way 
around finding the module the source file is actually used in and comparing 
times with that.  Note, theoretically, you would also have to handle with the 
case where module A used an old version of the file and module B a new one - 
for instance when building two libraries with a common header file.  Not sure 
what a good thing to do there is, maybe just warn?

Jim


> On Apr 21, 2020, at 2:07 AM, Martin Schmidt via Phabricator 
>  wrote:
> 
> n1tram1 added a comment.
> 
> In D78421#1993030 , @jingham wrote:
> 
>> So you check the currently selected frame's module - which is libbar.dylib 
>> and find that it was built before FileFromNotBar.c and would show me the old 
>> version.
>> 
>> Showing me the latest version of the file is not great, but totally 
>> explicable.  Whereas this error, when it happens, would be confusing and 
>> hard to understand.
> 
> 
> So instead I should try to find which module the source file belongs to and 
> check that module's modification time (instead of getting the currently 
> selected frame) ?
> 
> 
> Repository:
> rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D78421/new/
> 
> https://reviews.llvm.org/D78421
> 
> 
> 

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


[Lldb-commits] [PATCH] D77295: [lldb/Core] Fix a race in the Communication class

2020-04-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Hi Pavel,

After this landed I started seeing a bunch of reproducers fail with `SIGPIPE`. 
I ignored the signal and added a check for `EPIPE` to the `::write` call in 
`PipePosix.cpp`. Below is the thread state:

  * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGPIPE
* frame #0: 0x7fff6876c55e libsystem_kernel.dylib`__ulock_wait + 10
  frame #1: 0x7fff6882f5c2 libsystem_pthread.dylib`_pthread_join + 347
  frame #2: 0x00010115ef62 
liblldb.11.0.0git.dylib`lldb_private::HostThreadPosix::Join(this=0x00011e7ca490,
 result=0x7ffeefbfe290) at HostThreadPosix.cpp:28:15
  frame #3: 0x00010110b64f 
liblldb.11.0.0git.dylib`lldb_private::HostThread::Join(this=0x00011e9f09a0, 
result=0x7ffeefbfe290) at HostThread.cpp:21:27
  frame #4: 0x0001012ea5ba 
liblldb.11.0.0git.dylib`lldb_private::Process::ControlPrivateStateThread(this=0x00011e9f0818,
 signal=1) at Process.cpp:3642:30
  frame #5: 0x0001012dbc81 
liblldb.11.0.0git.dylib`lldb_private::Process::StopPrivateStateThread(this=0x00011e9f0818)
 at Process.cpp:3593:5
  frame #6: 0x0001012dc514 
liblldb.11.0.0git.dylib`lldb_private::Process::Destroy(this=0x00011e9f0818, 
force_kill=true) at Process.cpp:3317:7
  frame #7: 0x000100981cc1 
liblldb.11.0.0git.dylib`lldb::SBProcess::Kill(this=0x00011e767de0) at 
SBProcess.cpp:662:35
  
  * thread #2
* frame #0: 0x7fff6876c4ce libsystem_kernel.dylib`__workq_kernreturn + 
10
  frame #1: 0x7fff6882aaa1 libsystem_pthread.dylib`_pthread_wqthread + 
390
  frame #2: 0x7fff68829b77 libsystem_pthread.dylib`start_wqthread + 15
  
  * thread #3, name = ''
* frame #0: 0x7fff6876c55e libsystem_kernel.dylib`__ulock_wait + 10
  frame #1: 0x7fff6882f5c2 libsystem_pthread.dylib`_pthread_join + 347
  frame #2: 0x00010115ef62 
liblldb.11.0.0git.dylib`lldb_private::HostThreadPosix::Join(this=0x00011e7ca510,
 result=0x) at HostThreadPosix.cpp:28:15
  frame #3: 0x00010110b64f 
liblldb.11.0.0git.dylib`lldb_private::HostThread::Join(this=0x00011e9f0e28, 
result=0x) at HostThread.cpp:21:27
  frame #4: 0x000100f46f4e 
liblldb.11.0.0git.dylib`lldb_private::Communication::StopReadThread(this=0x00011e9f0de8,
 error_ptr=0x) at Communication.cpp:239:32
  frame #5: 0x0001012e9d95 
liblldb.11.0.0git.dylib`lldb_private::Process::ShouldBroadcastEvent(this=0x00011e9f0818,
 event_ptr=0x00011e76aa40) at Process.cpp:3390:27
  frame #6: 0x0001012e5e4f 
liblldb.11.0.0git.dylib`lldb_private::Process::HandlePrivateEvent(this=0x00011e9f0818,
 event_sp=std::__1::shared_ptr::element_type @ 
0x00011e76aa40 strong=2 weak=1) at Process.cpp:3697:33
  frame #7: 0x0001012eb147 
liblldb.11.0.0git.dylib`lldb_private::Process::RunPrivateStateThread(this=0x00011e9f0818,
 is_secondary_thread=false) at Process.cpp:3891:7
  frame #8: 0x0001012ea2fa 
liblldb.11.0.0git.dylib`lldb_private::Process::PrivateStateThread(arg=0x00011e7c9a60)
 at Process.cpp:3789:25
  frame #9: 0x00010110b45b 
liblldb.11.0.0git.dylib`lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(arg=0x00011e7ca4e0)
 at HostNativeThreadBase.cpp:68:10
  frame #10: 0x00010726ab83 
liblldb.11.0.0git.dylib`lldb_private::HostThreadMacOSX::ThreadCreateTrampoline(arg=0x00011e7ca4e0)
 at HostThreadMacOSX.mm:68:10
  
  * thread #4, name = '', stop reason = breakpoint 1.1
* frame #0: 0x00010116071a 
liblldb.11.0.0git.dylib`lldb_private::PipePosix::Write(this=0x00011e7ca2b0, 
buf=43698118819080247, size=1, bytes_written=0x776908b8) at 
PipePosix.cpp:312:7
  frame #1: 0x000101156d15 
liblldb.11.0.0git.dylib`lldb_private::ConnectionFileDescriptor::Disconnect(this=0x00011e7ca210,
 error_ptr=0x) at ConnectionFileDescriptorPosix.cpp:321:30
  frame #2: 0x000100f454e6 
liblldb.11.0.0git.dylib`lldb_private::Communication::Disconnect(this=0x00011e9f0de8,
 error_ptr=0x) at Communication.cpp:98:46
  frame #3: 0x000100f46d4e 
liblldb.11.0.0git.dylib`lldb_private::Communication::ReadThread(p=0x00011e9f0de8)
 at Communication.cpp:377:13
  frame #4: 0x00010110b45b 
liblldb.11.0.0git.dylib`lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(arg=0x00011e7ca4e0)
 at HostNativeThreadBase.cpp:68:10
  frame #5: 0x00010726ab83 
liblldb.11.0.0git.dylib`lldb_private::HostThreadMacOSX::ThreadCreateTrampoline(arg=0x00011e7ca4e0)
 at HostThreadMacOSX.mm:68:10
  frame #6: 0x7fff6882e109 libsystem_pthread.dylib`_pthread_start + 148
  frame #7: 0x7fff68829b8b libsystem_pthread.dylib`thread_start + 15

Any chance you might know what's going on here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.or

[Lldb-commits] [lldb] 116c2da - [lldb/Scripts] proc.returncode is set in proc.communicate

2020-04-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-21T11:30:15-07:00
New Revision: 116c2da4b2505af98c1b9652c8f280ec8147d27e

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

LOG: [lldb/Scripts] proc.returncode is set in proc.communicate

Make sure proc.returncode has been assigned before we compare it to 0.

Added: 


Modified: 
lldb/scripts/reproducer-replay.py

Removed: 




diff  --git a/lldb/scripts/reproducer-replay.py 
b/lldb/scripts/reproducer-replay.py
index f16d6e8b146c..4dd347058342 100755
--- a/lldb/scripts/reproducer-replay.py
+++ b/lldb/scripts/reproducer-replay.py
@@ -15,8 +15,8 @@ def run_reproducer(path):
 stderr=subprocess.PIPE)
 reason = None
 try:
-success = proc.returncode == 0
 outs, errs = proc.communicate(timeout=TIMEOUT)
+success = proc.returncode == 0
 result = 'PASSED' if success else 'FAILED'
 if not success:
 outs = outs.decode()



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


[Lldb-commits] [PATCH] D78396: [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets

2020-04-21 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 259084.
mib marked 2 inline comments as done.
mib added a comment.

Address Pavel's comments:

- Fix eventual UB by using the struct type in `sizeof` instead of dereferencing 
the pointer.
- Remove empty destructors.
- Fix dangling reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78396

Files:
  lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
  lldb/source/Plugins/Language/ObjC/CFBasicHash.h
  lldb/source/Plugins/Language/ObjC/CMakeLists.txt
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.h
  lldb/source/Plugins/Language/ObjC/NSSet.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
  lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m

Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
@@ -376,13 +376,19 @@
 	[newMutableDictionary setObject:@"foo" forKey:@"bar19"];
 	[newMutableDictionary setObject:@"foo" forKey:@"bar20"];
 
-	id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" };
-	id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" };
-	NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
-	CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
-
-	NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
-	[attrString isEqual:nil];
+id cfKeys[4] = {@"foo", @"bar", @"baz", @"quux"};
+id cfValues[4] = {@"foo", @"bar", @"baz", @"quux"};
+NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
+NSDictionary *nscfDictionary = CFBridgingRelease(CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil));
+CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(
+nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
+
+NSAttributedString *attrString = [[NSAttributedString alloc]
+initWithString:@"hello world from foo"
+attributes:newDictionary];
+[attrString isEqual:nil];
 	NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
 	[mutableAttrString isEqual:nil];
 
@@ -411,9 +417,11 @@
 
 	NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil];
 	NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil];
-	[nsmutableset addObject:str4];
+[nsmutableset addObject:str4];
+NSSet *nscfSet =
+CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil));
 
-	CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
+CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
 
 	CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8);
 	CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5);
Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
@@ -29,6 +29,8 @@
 ' 2 key/value pairs',
 '(NSDictionary *) newDictionary = ',
 ' 12 key/value pairs',
+'(NSDictionary *) nscfDictionary = ',
+' 4 key/value pairs',
 '(CFDictionaryRef) cfDictionaryRef = ',
 ' 3 key/value pairs',
 '(NSDictionary *) newMutableDictionary = ',
@@ -39,6 +41,36 @@
 ' @"11 elements"',
 ])
 
+self.expect(
+'frame variable -d run-target *nscfDictionary',
+patterns=[
+'\(__NSCFDictionary\) \*nscfDictionary =',
+'key = 0x.* @"foo"',
+'value = 0x.* @"foo"',
+'key = 0x.* @"bar"',
+'value = 0x.* @"bar"',
+'key = 0x.* @"baz"',
+'value = 0x.* @"baz"',
+'key = 0x.* @"quux"',
+'value = 0x.* @"quux"',
+])
+
+
+se

[Lldb-commits] [PATCH] D78396: [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets

2020-04-21 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 7 inline comments as done.
mib added inline comments.



Comment at: lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp:47-62
+  DataBufferHeap buffer(size, 0);
+  m_exe_ctx_ref.GetProcessSP()->ReadMemory(addr, buffer.GetBytes(), size,
+   error);
+  if (error.Fail())
+return false;
+
+  DataExtractor data_extractor = DataExtractor(

labath wrote:
> Why don't you just pass `m_ht.get()` to `ReadMemory` ?
IIUC, `ReadMemory` will read memory matching the inferior endianness. That's 
why, I'm using a `DataExtractor`, to translate, the copied bytes to the host 
endianness.



Comment at: lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp:71-82
+  m_exe_ctx_ref.GetProcessSP()->ReadMemory(ptr_offset, buffer.GetBytes(), size,
+   error);
+
+  if (error.Fail()) {
+m_ht = nullptr;
+return false;
+  }

labath wrote:
> `ReadMemory(ptr_offset, m_ht->pointers, ...)` ?
Same answer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78396



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


[Lldb-commits] [PATCH] D78588: [lldb/Core] Check that ArchSpec is valid.

2020-04-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, clayborg, labath.

A  reproducer replay hit an `llvm_unreachable` in Target.cpp because the 
architecture was not set and therefore the `ArchSpec` was invalid.

  Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode
  UNREACHABLE executed at 
/Users/jonas/llvm/llvm-project/lldb/source/Target/Platform.cpp:1922!

The unhandled case is `llvm::Triple::UnknownArch`. Alternatively we can add a 
case for it to the switch statement, but checking `IsValid` seemed more 
canonical.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D78588

Files:
  lldb/source/Target/Platform.cpp


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,9 @@
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  if (!arch.IsValid())
+return 0;
+
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,9 @@
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  if (!arch.IsValid())
+return 0;
+
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1e566f6 - [lldb/Test] Add skipIfReproducer for tests that diverge during replay

2020-04-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-21T14:42:14-07:00
New Revision: 1e566f6b47fb77812d99c93e0a1b8613d288058c

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

LOG: [lldb/Test] Add skipIfReproducer for tests that diverge during replay

Add the skipIfReproducer decorator to the remaining tests that fail to
replay because the GDB remote packets diverge during replay. This is
*not* expected and should be fixed, but figuring out exactly what caused
the divergence has proven pretty difficult to track down.

I've marked these tests as skipped for now so we can get clean results
and detect new regressions. I have no evidence to believe that these
failures have the same root cause, so I've not assigned them a PR.

Added: 


Modified: 
lldb/test/API/commands/command/script/TestCommandScript.py
lldb/test/API/commands/expression/issue_11588/Test11588.py
lldb/test/API/commands/process/attach-resume/TestAttachResume.py
lldb/test/API/commands/process/attach/TestProcessAttach.py

lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
lldb/test/API/functionalities/signal/TestSendSignal.py
lldb/test/API/functionalities/step_scripted/TestStepScripted.py
lldb/test/API/lang/objc/foundation/TestRuntimeTypes.py
lldb/test/API/lang/objc/modules/TestObjCModules.py
lldb/test/API/lang/objc/print-obj/TestPrintObj.py
lldb/test/API/python_api/hello_world/TestHelloWorld.py

Removed: 




diff  --git a/lldb/test/API/commands/command/script/TestCommandScript.py 
b/lldb/test/API/commands/command/script/TestCommandScript.py
index b103298f24e1..6663c3641452 100644
--- a/lldb/test/API/commands/command/script/TestCommandScript.py
+++ b/lldb/test/API/commands/command/script/TestCommandScript.py
@@ -14,6 +14,7 @@ class CmdPythonTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIfReproducer # Unexpected packet during replay
 def test(self):
 self.build()
 self.pycmd_tests()

diff  --git a/lldb/test/API/commands/expression/issue_11588/Test11588.py 
b/lldb/test/API/commands/expression/issue_11588/Test11588.py
index 626eef6f5511..8ed7797d5fff 100644
--- a/lldb/test/API/commands/expression/issue_11588/Test11588.py
+++ b/lldb/test/API/commands/expression/issue_11588/Test11588.py
@@ -17,6 +17,7 @@ class Issue11581TestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
+@skipIfReproducer # Unexpected packet during replay
 def test_11581_commands(self):
 # This is the function to remove the custom commands in order to have a
 # clean slate for the next test case.

diff  --git a/lldb/test/API/commands/process/attach-resume/TestAttachResume.py 
b/lldb/test/API/commands/process/attach-resume/TestAttachResume.py
index b559f44a6b3d..ebb4345aca91 100644
--- a/lldb/test/API/commands/process/attach-resume/TestAttachResume.py
+++ b/lldb/test/API/commands/process/attach-resume/TestAttachResume.py
@@ -21,6 +21,7 @@ class AttachResumeTestCase(TestBase):
 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr19310')
 @expectedFailureNetBSD
 @skipIfWindows # llvm.org/pr24778, llvm.org/pr21753
+@skipIfReproducer # Unexpected packet during replay
 def test_attach_continue_interrupt_detach(self):
 """Test attach/continue/interrupt/detach"""
 self.build()

diff  --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py 
b/lldb/test/API/commands/process/attach/TestProcessAttach.py
index b85d57133507..792a8cee61f9 100644
--- a/lldb/test/API/commands/process/attach/TestProcessAttach.py
+++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py
@@ -39,6 +39,7 @@ def test_attach_to_process_by_id(self):
 self.assertTrue(process, PROCESS_IS_VALID)
 
 @expectedFailureNetBSD
+@skipIfReproducer # Unexpected packet during replay
 def test_attach_to_process_from_
diff erent_dir_by_id(self):
 """Test attach by process id"""
 newdir = self.getBuildArtifact("newdir")

diff  --git 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
index 02c0aab9149e..ce1328d86d79 100644
--- 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -45,6 +45,7 @@ def test_copy_from_dummy_target(self):
 self.build()
 self.do_test_copy_from_du

[Lldb-commits] [lldb] 400b6f2 - [lldb/Test] Add skipIfReproducer for tests that are not expected to work

2020-04-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-21T14:42:14-07:00
New Revision: 400b6f2bc53915b61f1ed9408819fa898e4c8941

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

LOG: [lldb/Test] Add skipIfReproducer for tests that are not expected to work

Some tests are not expected to work with reproducers, for example tests
that completely circumvent the reproducers (i.e. using the side_effects
Python module) or that rely on changes to the file system.

Added: 


Modified: 

lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
lldb/test/API/functionalities/inferior-changed/TestInferiorChanged.py
lldb/test/API/lang/objc/modules-update/TestClangModulesUpdate.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 77db8f745d7e..9a66df9a798b 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -17,12 +17,14 @@ class BreakpointCommandTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+@skipIfReproducer # side_effect bypasses reproducer
 def not_test_breakpoint_command_sequence(self):
 """Test a sequence of breakpoint command add, list, and delete."""
 self.build()
 self.breakpoint_command_sequence()
 
 @skipIf(oslist=["windows"], bugnumber="llvm.org/pr44431")
+@skipIfReproducer # side_effect bypasses reproducer
 def test_script_parameters(self):
 """Test a sequence of breakpoint command add, list, and delete."""
 self.build()

diff  --git 
a/lldb/test/API/functionalities/inferior-changed/TestInferiorChanged.py 
b/lldb/test/API/functionalities/inferior-changed/TestInferiorChanged.py
index 95cdfb5591fa..16ab1aaeb593 100644
--- a/lldb/test/API/functionalities/inferior-changed/TestInferiorChanged.py
+++ b/lldb/test/API/functionalities/inferior-changed/TestInferiorChanged.py
@@ -16,6 +16,7 @@ class ChangedInferiorTestCase(TestBase):
 
 @skipIf(hostoslist=["windows"])
 @no_debug_info_test
+@skipIfReproducer # VFS is a snapshot.
 def test_inferior_crashing(self):
 """Test lldb reloads the inferior after it was changed during the 
session."""
 self.build()

diff  --git a/lldb/test/API/lang/objc/modules-update/TestClangModulesUpdate.py 
b/lldb/test/API/lang/objc/modules-update/TestClangModulesUpdate.py
index e36a2278daac..13820b56688b 100644
--- a/lldb/test/API/lang/objc/modules-update/TestClangModulesUpdate.py
+++ b/lldb/test/API/lang/objc/modules-update/TestClangModulesUpdate.py
@@ -14,6 +14,7 @@ class TestClangModuleUpdate(TestBase):
 
 @skipUnlessDarwin
 @skipIf(debug_info=no_match(["gmodules"]))
+@skipIfReproducer # VFS is a snapshot.
 def test_expr(self):
 with open(self.getBuildArtifact("module.modulemap"), "w") as f:
 f.write("""



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


[Lldb-commits] [lldb] b707cf0 - [lldb/Test] Add decorator to the right method

2020-04-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-04-21T15:05:32-07:00
New Revision: b707cf096dda9592a2ae1d874f4e760e36c6f1e5

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

LOG: [lldb/Test] Add decorator to the right method

Added: 


Modified: 

lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
index ce1328d86d79..b08dfc78cea3 100644
--- 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -16,6 +16,7 @@ class TestScriptedResolver(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+@skipIfReproducer # Unexpected packet during replay
 def test_scripted_resolver(self):
 """Use a scripted resolver to set a by symbol name breakpoint"""
 self.build()
@@ -45,7 +46,6 @@ def test_copy_from_dummy_target(self):
 self.build()
 self.do_test_copy_from_dummy_target()
 
-@skipIfReproducer # Unexpected packet during replay
 def make_target_and_import(self):
 target = self.make_target()
 self.import_resolver_script()



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


[Lldb-commits] [PATCH] D78000: [ASTImporter] Fix handling of not defined FromRecord in ImportContext(...)

2020-04-21 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 259110.
shafik marked 2 inline comments as done.
shafik added a comment.

- Simplifying the changes in `ASTImporter::ImportContext`
- Removing `DC->setHasExternalLexicalStorage(true);` from unit test since we 
are checking `getExternalSource()`


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

https://reviews.llvm.org/D78000

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp
  
lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
  
lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp

Index: lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp
===
--- /dev/null
+++ lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp
@@ -0,0 +1,35 @@
+struct B {
+  int dump() const;
+};
+
+int B::dump() const { return 42; }
+
+// Derived class D obtains dump() method from base class B
+struct D : public B {
+  // Introduce a TypedefNameDecl
+  using Iterator = D *;
+};
+
+struct C {
+  // This will cause use to invoke VisitTypedefNameDecl(...) when Importing
+  // the DeclContext of C.
+  // We will invoke ImportContext(...) which should force the From Decl to
+  // be defined if it not already defined. We will then Import the definition
+  // to the To Decl.
+  // This will force processing of the base class of D which allows us to see
+  // base class methods such as dump().
+  D::Iterator iter;
+
+  bool f(D *DD) {
+return true; //%self.expect_expr("DD->dump()", result_type="int", result_value="42")
+  }
+};
+
+int main() {
+  C c;
+  D d;
+
+  c.f(&d);
+
+  return 0;
+}
Index: lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
===
--- /dev/null
+++ lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -5922,6 +5922,70 @@
   EXPECT_TRUE(ToA);
 }
 
+struct ImportWithExternalSource : ASTImporterOptionSpecificTestBase {
+  ImportWithExternalSource() {
+Creator = [](ASTContext &ToContext, FileManager &ToFileManager,
+ ASTContext &FromContext, FileManager &FromFileManager,
+ bool MinimalImport,
+ const std::shared_ptr &SharedState) {
+  return new ASTImporter(ToContext, ToFileManager, FromContext,
+ FromFileManager, MinimalImport,
+ // We use the regular lookup.
+ /*SharedState=*/nullptr);
+};
+  }
+};
+
+/// An ExternalASTSource that keeps track of the tags is completed.
+struct SourceWithCompletedTagList : clang::ExternalASTSource {
+  std::vector &CompletedTags;
+  SourceWithCompletedTagList(std::vector &CompletedTags)
+  : CompletedTags(CompletedTags) {}
+  void CompleteType(TagDecl *Tag) override {
+auto *Record = cast(Tag);
+Record->startDefinition();
+Record->completeDefinition();
+CompletedTags.push_back(Tag);
+  }
+  void
+  FindExternalLexicalDecls(const DeclContext *DC,
+   llvm::function_ref IsKindWeWant,
+   SmallVectorImpl &Result) override {}
+};
+
+TEST_P(ImportWithExternalSource, CompleteRecordBeforeImporting) {
+  // Create an empty TU.
+  TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX, "input.cpp");
+
+  // Create and add the test ExternalASTSource.
+  std::vector CompletedTags;
+  IntrusiveRefCntPtr source =
+  new SourceWithCompletedTagList(CompletedTags);
+  clang::ASTContext &context = FromTU->getASTContext();
+  context.setExternalSource(std::move(source));
+
+  // Create a dummy class by hand with external lexical storage.
+  IdentifierInfo &Ident = context.Idents.get("test_class");
+  auto *Record = CXXRecordDecl::Create(
+  context, TTK_Class, FromTU, SourceLocation(), SourceLocation(), &Ident);
+  Record->setHasExternalLexicalStorage();
+  FromTU->addDecl(Record);
+
+  // Do a minimal import of the created class.
+  EXPECT_EQ(0U, CompletedTags.size());
+  Import(Record, Lang_CXX);
+  EXPECT_EQ(0U, CompletedTags.size());
+
+  // Import the definition of the created class.
+  llvm::Error err = findFromTU(Record)->Importer->ImportDefinition(Record);
+  EXPECT_FALSE((bool)err);
+  consumeError(std::move(err));
+
+  // Make sure the class was completed once.
+  EXPECT_EQ(1U, Complete

[Lldb-commits] [PATCH] D78588: [lldb/Core] Check that ArchSpec is valid.

2020-04-21 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

What's exactly the testcase doing?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D78588



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


[Lldb-commits] [PATCH] D78588: [lldb/Core] Check that ArchSpec is valid.

2020-04-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

None of this is exposed through SBPlatform right? No way to test this?




Comment at: lldb/source/Target/Platform.cpp:1825-1826
   ArchSpec arch = target.GetArchitecture();
+  if (!arch.IsValid())
+return 0;
+

would be nice to log something here on the "lldb break" log channel?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D78588



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


[Lldb-commits] [lldb] 7375212 - get rid of PythonInteger::GetInteger()

2020-04-21 Thread Lawrence D'Anna via lldb-commits

Author: Lawrence D'Anna
Date: 2020-04-21T16:55:51-07:00
New Revision: 7375212172951d2fc283c81d03c1a8588c3280c6

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

LOG: get rid of PythonInteger::GetInteger()

Summary:
One small step in my long running quest to improve python exception handling in
LLDB.  Replace GetInteger() which just returns an int with As and
friends, which return Expected types that can track python exceptions

Reviewers: labath, jasonmolenda, JDevlieghere, vadimcn

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/bindings/python/python-typemaps.swig
lldb/bindings/python/python-wrapper.swig
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Removed: 




diff  --git a/lldb/bindings/python/python-typemaps.swig 
b/lldb/bindings/python/python-typemaps.swig
index 46dcaf611a4f..c08aeab71f78 100644
--- a/lldb/bindings/python/python-typemaps.swig
+++ b/lldb/bindings/python/python-typemaps.swig
@@ -59,37 +59,25 @@
   $result = list.release();
 }
 
-
 %typemap(in) lldb::tid_t {
-  if (PythonInteger::Check($input))
-  {
-PythonInteger py_int(PyRefType::Borrowed, $input);
-$1 = static_cast(py_int.GetInteger());
-  }
-  else
-  {
-PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+  PythonObject obj = Retain($input);
+  lldb::tid_t value = unwrapOrSetPythonException(As(obj)); 
+  if (PyErr_Occurred())
 return nullptr;
-  }
+  $1 = value;
 }
 
 %typemap(in) lldb::StateType {
-  if (PythonInteger::Check($input))
-  {
-PythonInteger py_int(PyRefType::Borrowed, $input);
-int64_t state_type_value = py_int.GetInteger() ;
-
-if (state_type_value > lldb::StateType::kLastStateType) {
-  PyErr_SetString(PyExc_ValueError, "Not a valid StateType value");
-  return nullptr;
-}
-$1 = static_cast(state_type_value);
-  }
-  else
-  {
-PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+  PythonObject obj = Retain($input);
+  unsigned long long state_type_value =
+unwrapOrSetPythonException(As(obj));
+  if (PyErr_Occurred())
+return nullptr;
+  if (state_type_value > lldb::StateType::kLastStateType) {
+PyErr_SetString(PyExc_ValueError, "Not a valid StateType value");
 return nullptr;
   }
+  $1 = static_cast(state_type_value);
 }
 
 /* Typemap definitions to allow SWIG to properly handle char buffer. */

diff  --git a/lldb/bindings/python/python-wrapper.swig 
b/lldb/bindings/python/python-wrapper.swig
index 3a63165cf58d..f9e89373fe25 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -444,6 +444,7 @@ LLDBSwigPythonCallBreakpointResolver
 if (PyErr_Occurred())
 {
 PyErr_Print();
+PyErr_Clear();
 return 0;
 }
 
@@ -457,11 +458,13 @@ LLDBSwigPythonCallBreakpointResolver
   return 1;
 }
 
-PythonInteger int_result = result.AsType();
-if (!int_result.IsAllocated())
-return 0;
+long long ret_val = unwrapOrSetPythonException(As(result));
 
-unsigned int ret_val = int_result.GetInteger();
+if (PyErr_Occurred()) {
+PyErr_Print();
+PyErr_Clear();
+return 0;
+}
 
 return ret_val;
 }
@@ -515,26 +518,17 @@ LLDBSwigPython_CalculateNumChildren
 return 0;
 }
 
-PythonObject result;
-
+size_t ret_val;
 if (arg_info.get().max_positional_args < 1)
-result = pfunc();
+ret_val = unwrapOrSetPythonException(As(pfunc.Call()));
 else
-result = pfunc(PythonInteger(max));
-
-if (!result.IsAllocated())
-return 0;
-
-PythonInteger int_result = result.AsType();
-if (!int_result.IsAllocated())
-return 0;
-
-size_t ret_val = int_result.GetInteger();
+ret_val = unwrapOrSetPythonException(As(pfunc.Call(PythonInteger(max;
 
-if (PyErr_Occurred()) //FIXME use Expected to catch python exceptions
+if (PyErr_Occurred())
 {
 PyErr_Print();
 PyErr_Clear();
+return 0;
 }
 
 if (arg_info.get().max_positional_args < 1)
@@ -588,16 +582,15 @@ LLDBSwigPython_GetIndexOfChildWithName
 if (!pfunc.IsAllocated())
 return UINT32_MAX;
 
-PythonObject result = pfunc(PythonString(child_name));
+llvm::Expected result = pfunc.Call(PythonString(child_name));
 
-if (!result.IsAllocated())
-return UINT32_MAX;
+long long retval = unwrapOrSetPythonException(As(std::move(result)));
 
-PythonInteger int_result

[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-21 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 259131.
lawrence_danna marked 4 inline comments as done.
lawrence_danna added a comment.

wrap long line


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462

Files:
  lldb/bindings/python/python-typemaps.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -123,13 +123,11 @@
   EXPECT_TRUE(major_version_field.IsAllocated());
   EXPECT_TRUE(minor_version_field.IsAllocated());
 
-  PythonInteger major_version_value =
-  major_version_field.AsType();
-  PythonInteger minor_version_value =
-  minor_version_field.AsType();
+  auto major_version_value = As(major_version_field);
+  auto minor_version_value = As(minor_version_field);
 
-  EXPECT_EQ(PY_MAJOR_VERSION, major_version_value.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, minor_version_value.GetInteger());
+  EXPECT_THAT_EXPECTED(major_version_value, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(minor_version_value, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionWithDot) {
@@ -137,16 +135,14 @@
   EXPECT_TRUE(sys_path.IsAllocated());
   EXPECT_TRUE(PythonList::Check(sys_path.get()));
 
-  PythonInteger version_major =
-  m_main_module.ResolveName("sys.version_info.major")
-  .AsType();
-  PythonInteger version_minor =
-  m_main_module.ResolveName("sys.version_info.minor")
-  .AsType();
-  EXPECT_TRUE(version_major.IsAllocated());
-  EXPECT_TRUE(version_minor.IsAllocated());
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major =
+  As(m_main_module.ResolveName("sys.version_info.major"));
+
+  auto version_minor =
+  As(m_main_module.ResolveName("sys.version_info.minor"));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestDictionaryResolutionWithDot) {
@@ -155,14 +151,14 @@
   dict.SetItemForKey(PythonString("sys"), m_sys_module);
 
   // Now use that dictionary to resolve `sys.version_info.major`
-  PythonInteger version_major =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict)
-  .AsType();
-  PythonInteger version_minor =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict)
-  .AsType();
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict));
+
+  auto version_minor = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonInteger) {
@@ -176,7 +172,8 @@
   PythonInteger python_int(PyRefType::Owned, py_int);
 
   EXPECT_EQ(PyObjectType::Integer, python_int.GetObjectType());
-  EXPECT_EQ(12, python_int.GetInteger());
+  auto python_int_value = As(python_int);
+  EXPECT_THAT_EXPECTED(python_int_value, llvm::HasValue(12));
 #endif
 
   // Verify that `PythonInteger` works correctly when given a PyLong object.
@@ -187,12 +184,14 @@
 
   // Verify that you can reset the value and that it is reflected properly.
   python_long.SetInteger(40);
-  EXPECT_EQ(40, python_long.GetInteger());
+  auto e = As(python_long);
+  EXPECT_THAT_EXPECTED(e, llvm::HasValue(40));
 
   // Test that creating a `PythonInteger` object works correctly with the
   // int constructor.
   PythonInteger constructed_int(7);
-  EXPECT_EQ(7, constructed_int.GetInteger());
+  auto value = As(constructed_int);
+  EXPECT_THAT_EXPECTED(value, llvm::HasValue(7));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonBoolean) {
@@ -339,7 +338,8 @@
   PythonInteger chk_int(PyRefType::Borrowed, chk_value1.get());
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
-  EXPECT_EQ(long_value0, chk_int.GetInteger());
+  auto chkint = As(chk_value1);
+  ASSERT_THAT_EXPECTED(chkint, llvm::HasValue(long_value0));
   EXPECT_EQ(string_value1, chk_str.GetString());
 }
 
@@ -367,7 +367,8 @@
   PythonInteger chk_int(PyRefType::Borrowed, chk_v

[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-21 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna added inline comments.



Comment at: lldb/bindings/python/python-wrapper.swig:585-597
+llvm::Expected result = pfunc.Call(PythonString(child_name));
 
-if (!result.IsAllocated())
-return UINT32_MAX;
+long long retval = unwrapOrSetPythonException(As(std::move(result)));
 
-PythonInteger int_result = result.AsType();
-if (!int_result.IsAllocated())
+if (PyErr_Occurred()) { 
+PyErr_Clear(); // FIXME print this? do something else
 return UINT32_MAX;

labath wrote:
> If you don't print this, then you could definitely do something like:
> ```
> Expected result = As long>(pfunc.Call(PythonString(child_name));
> if (result)
>   return std::max(*result, 0);
> consumeError(result.takeError());
> return UINT32_MAX;
> ```
aparently this function is not even used... I'll put up a new diff to remove it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462



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


[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

2020-04-21 Thread Lawrence D'Anna via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG737521217295: get rid of PythonInteger::GetInteger() 
(authored by lawrence_danna).

Changed prior to commit:
  https://reviews.llvm.org/D78462?vs=259131&id=259134#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462

Files:
  lldb/bindings/python/python-typemaps.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -123,13 +123,11 @@
   EXPECT_TRUE(major_version_field.IsAllocated());
   EXPECT_TRUE(minor_version_field.IsAllocated());
 
-  PythonInteger major_version_value =
-  major_version_field.AsType();
-  PythonInteger minor_version_value =
-  minor_version_field.AsType();
+  auto major_version_value = As(major_version_field);
+  auto minor_version_value = As(minor_version_field);
 
-  EXPECT_EQ(PY_MAJOR_VERSION, major_version_value.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, minor_version_value.GetInteger());
+  EXPECT_THAT_EXPECTED(major_version_value, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(minor_version_value, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionWithDot) {
@@ -137,16 +135,14 @@
   EXPECT_TRUE(sys_path.IsAllocated());
   EXPECT_TRUE(PythonList::Check(sys_path.get()));
 
-  PythonInteger version_major =
-  m_main_module.ResolveName("sys.version_info.major")
-  .AsType();
-  PythonInteger version_minor =
-  m_main_module.ResolveName("sys.version_info.minor")
-  .AsType();
-  EXPECT_TRUE(version_major.IsAllocated());
-  EXPECT_TRUE(version_minor.IsAllocated());
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major =
+  As(m_main_module.ResolveName("sys.version_info.major"));
+
+  auto version_minor =
+  As(m_main_module.ResolveName("sys.version_info.minor"));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestDictionaryResolutionWithDot) {
@@ -155,14 +151,14 @@
   dict.SetItemForKey(PythonString("sys"), m_sys_module);
 
   // Now use that dictionary to resolve `sys.version_info.major`
-  PythonInteger version_major =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict)
-  .AsType();
-  PythonInteger version_minor =
-  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict)
-  .AsType();
-  EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
-  EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+  auto version_major = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.major", dict));
+
+  auto version_minor = As(
+  PythonObject::ResolveNameWithDictionary("sys.version_info.minor", dict));
+
+  EXPECT_THAT_EXPECTED(version_major, llvm::HasValue(PY_MAJOR_VERSION));
+  EXPECT_THAT_EXPECTED(version_minor, llvm::HasValue(PY_MINOR_VERSION));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonInteger) {
@@ -176,7 +172,8 @@
   PythonInteger python_int(PyRefType::Owned, py_int);
 
   EXPECT_EQ(PyObjectType::Integer, python_int.GetObjectType());
-  EXPECT_EQ(12, python_int.GetInteger());
+  auto python_int_value = As(python_int);
+  EXPECT_THAT_EXPECTED(python_int_value, llvm::HasValue(12));
 #endif
 
   // Verify that `PythonInteger` works correctly when given a PyLong object.
@@ -187,12 +184,14 @@
 
   // Verify that you can reset the value and that it is reflected properly.
   python_long.SetInteger(40);
-  EXPECT_EQ(40, python_long.GetInteger());
+  auto e = As(python_long);
+  EXPECT_THAT_EXPECTED(e, llvm::HasValue(40));
 
   // Test that creating a `PythonInteger` object works correctly with the
   // int constructor.
   PythonInteger constructed_int(7);
-  EXPECT_EQ(7, constructed_int.GetInteger());
+  auto value = As(constructed_int);
+  EXPECT_THAT_EXPECTED(value, llvm::HasValue(7));
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonBoolean) {
@@ -339,7 +338,8 @@
   PythonInteger chk_int(PyRefType::Borrowed, chk_value1.get());
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
-  EXPECT_EQ(long_value0, chk_int.GetInteger());
+  auto chkint = As(chk_value1);
+  ASSERT_THAT_EXPECTED(chkint, llvm::HasValue(long_value0));
   EXPECT_EQ(str

[Lldb-commits] [PATCH] D78603: remove unused function LLDBSwigPython_GetIndexOfChildWithName

2020-04-21 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: labath, jasonmolenda, JDevlieghere.
Herald added subscribers: lldb-commits, arphaman.
Herald added a project: LLDB.

Remove LLDBSwigPython_GetIndexOfChildWithName and associated functions.
They are not used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78603

Files:
  lldb/bindings/python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -147,11 +147,6 @@
   return nullptr;
 }
 
-extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
-  const char *child_name) {
-  return 0;
-}
-
 extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data) {
   return nullptr;
 }
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -146,8 +146,6 @@
   GetChildAtIndex(const StructuredData::ObjectSP &implementor,
   uint32_t idx) override;
 
-  int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor,
-  const char *child_name) override;
 
   bool UpdateSynthProviderInstance(
   const StructuredData::ObjectSP &implementor) override;
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -139,9 +139,6 @@
 extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
 uint32_t idx);
 
-extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
-  const char *child_name);
-
 extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
 
 extern lldb::ValueObjectSP
@@ -2447,28 +2444,6 @@
   return ret_val;
 }
 
-int ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
-const StructuredData::ObjectSP &implementor_sp, const char *child_name) {
-  if (!implementor_sp)
-return UINT32_MAX;
-
-  StructuredData::Generic *generic = implementor_sp->GetAsGeneric();
-  if (!generic)
-return UINT32_MAX;
-  void *implementor = generic->GetValue();
-  if (!implementor)
-return UINT32_MAX;
-
-  int ret_val = UINT32_MAX;
-
-  {
-Locker py_lock(this,
-   Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-ret_val = LLDBSwigPython_GetIndexOfChildWithName(implementor, child_name);
-  }
-
-  return ret_val;
-}
 
 bool ScriptInterpreterPythonImpl::UpdateSynthProviderInstance(
 const StructuredData::ObjectSP &implementor_sp) {
Index: lldb/bindings/python/python-wrapper.swig
===
--- lldb/bindings/python/python-wrapper.swig
+++ lldb/bindings/python/python-wrapper.swig
@@ -567,35 +567,6 @@
 return result.release();
 }
 
-SWIGEXPORT int
-LLDBSwigPython_GetIndexOfChildWithName
-(
-PyObject *implementor,
-const char* child_name
-)
-{
-PyErr_Cleaner py_err_cleaner(true);
-
-PythonObject self(PyRefType::Borrowed, implementor);
-auto pfunc = self.ResolveName("get_child_index");
-
-if (!pfunc.IsAllocated())
-return UINT32_MAX;
-
-llvm::Expected result = pfunc.Call(PythonString(child_name));
-
-long long retval = unwrapOrSetPythonException(As(std::move(result)));
-
-if (PyErr_Occurred()) { 
-PyErr_Clear(); // FIXME print this? do something else
-return UINT32_MAX;
-}
-
-if (retval >= 0)
-return (uint32_t)retval;
-
-return UINT32_MAX;
-}
 
 SWIGEXPORT bool
 LLDBSwigPython_UpdateSynthProviderInstance
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D78489: [lldb/DWARF] Trust CU DW_AT_low/high_pc information when building address tables

2020-04-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Sounds like a win then, as long as we don't get slower I am fine with this. I 
was guessing that line tables might be faster because it is generally very 
compressed and compact compared to debug info, but thanks for verifying.

Might be worth checking the memory consumption of LLDB quickly too with 
DW_AT_ranges compiled out and just make sure we don't take up too much extra 
memory.

We aren't doing anything to unload these line tables like we do with DIEs are 
we? It might make sense to pares the line tables and then throw them away if 
they were not already parsed?  With the DIEs we were throwing them away if they 
weren't already parsed to keep memory consumption down, so might be worth 
throwing the line tables away after running this if we are now going to rely on 
it.

One other thing to verify we want to go this route is to re-enable the old DIE 
parsing for high/low PCs, but put the results in a separate address ranges 
class. After we parse the line tables, verify that all ranges we found in the 
DIEs are in the line tables? It would not be great if we were going to start 
missing some functions if a function doesn't have a line table? Not sure if/how 
this would happen, but you never know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78489



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


[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Christopher Tetreault via Phabricator via lldb-commits
ctetreau updated this revision to Diff 259095.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587

Files:
  lldb/source/Expression/IRInterpreter.cpp
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
  llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Index: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
===
--- mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -168,12 +168,12 @@
   return nullptr;
 return LLVMType::getArrayTy(elementType, type->getArrayNumElements());
   }
-  case llvm::Type::VectorTyID: {
-auto *typeVTy = llvm::cast(type);
-if (typeVTy->isScalable()) {
-  emitError(unknownLoc) << "scalable vector types not supported";
-  return nullptr;
-}
+  case llvm::Type::ScalableVectorTyID: {
+emitError(unknownLoc) << "scalable vector types not supported";
+return nullptr;
+  }
+  case llvm::Type::FixedVectorTyID: {
+auto *typeVTy = llvm::cast(type);
 LLVMType elementType = processType(typeVTy->getElementType());
 if (!elementType)
   return nullptr;
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -488,7 +488,8 @@
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID: {
 auto *STyL = cast(TyL);
 auto *STyR = cast(TyR);
 if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -130,7 +130,8 @@
   default: break;
   case Type::PointerTyID:
 return true;
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID:
 if (cast(Ty)->getElementType()->isPointerTy())
   return true;
 break;
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1184,7 +1184,7 @@
 case Type::IntegerTyID: // Integers larger than 64 bits
 case Type::StructTyID:
 case Type::ArrayTyID:
-case Type::VectorTyID:
+case Type::FixedVectorTyID:
   ElementSize = DL.getTypeStoreSize(ETy);
   // Ptx allows variable initilization only for constant and
   // global state spaces.
@@ -1358,7 +1358,7 @@
   switch (ETy->getTypeID()) {
   case Type::StructTyID:
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
 ElementSize = DL.getTypeStoreSize(ETy);
 O << " .b8 ";
 getSymbol(GVar)->print(O, MAI);
@@ -1892,7 +1892,7 @@
   }
 
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
   case Type::StructTyID: {
 if (isa(CPV) || isa(CPV)) {
   int ElementSize = DL.getTypeAllocSize(CPV->getType());
Index: llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
===
--- llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
@@ -307,7 +307,7 @@
 const ArrayType *ATy = cast(Ty);
 return getSmallestAddressableSize(ATy->getElementType(), GV, TM);
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID: {
 const VectorType *PTy = cast(Ty);
 return getSmallestAddressableSize(PTy->getElementType(), GV, TM);
   }
Index: llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
@@ -408,8 +408,7 @@
 Value *Arg = CI->getArgOperand(Ar

[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Christopher Tetreault via Phabricator via lldb-commits
ctetreau updated this revision to Diff 259114.
ctetreau added a comment.

Catch stragglers in C api


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587

Files:
  lldb/source/Expression/IRInterpreter.cpp
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
  llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  llvm/tools/llvm-c-test/debuginfo.c
  llvm/tools/llvm-c-test/echo.cpp
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Index: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
===
--- mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -168,12 +168,12 @@
   return nullptr;
 return LLVMType::getArrayTy(elementType, type->getArrayNumElements());
   }
-  case llvm::Type::VectorTyID: {
-auto *typeVTy = llvm::cast(type);
-if (typeVTy->isScalable()) {
-  emitError(unknownLoc) << "scalable vector types not supported";
-  return nullptr;
-}
+  case llvm::Type::ScalableVectorTyID: {
+emitError(unknownLoc) << "scalable vector types not supported";
+return nullptr;
+  }
+  case llvm::Type::FixedVectorTyID: {
+auto *typeVTy = llvm::cast(type);
 LLVMType elementType = processType(typeVTy->getElementType());
 if (!elementType)
   return nullptr;
Index: llvm/tools/llvm-c-test/echo.cpp
===
--- llvm/tools/llvm-c-test/echo.cpp
+++ llvm/tools/llvm-c-test/echo.cpp
@@ -137,11 +137,11 @@
   Clone(LLVMGetElementType(Src)),
   LLVMGetPointerAddressSpace(Src)
 );
-  case LLVMVectorTypeKind:
-return LLVMVectorType(
-  Clone(LLVMGetElementType(Src)),
-  LLVMGetVectorSize(Src)
-);
+  case LLVMFixedVectorTypeKind:
+  case LLVMScalableVectorTypeKind:
+return LLVMVectorType(Clone(LLVMGetElementType(Src)),
+  LLVMGetVectorSize(Src),
+  LLVMGetVectorIsScalable(Src));
   case LLVMMetadataTypeKind:
 return LLVMMetadataTypeInContext(Ctx);
   case LLVMX86_MMXTypeKind:
Index: llvm/tools/llvm-c-test/debuginfo.c
===
--- llvm/tools/llvm-c-test/debuginfo.c
+++ llvm/tools/llvm-c-test/debuginfo.c
@@ -92,11 +92,10 @@
   LLVMAddNamedMetadataOperand(M, "FooType",
 LLVMMetadataAsValue(LLVMGetModuleContext(M), StructDbgPtrTy));
 
-
   LLVMTypeRef FooParamTys[] = {
-LLVMInt64Type(),
-LLVMInt64Type(),
-LLVMVectorType(LLVMInt64Type(), 10),
+  LLVMInt64Type(),
+  LLVMInt64Type(),
+  LLVMVectorType(LLVMInt64Type(), 10, false),
   };
   LLVMTypeRef FooFuncTy = LLVMFunctionType(LLVMInt64Type(), FooParamTys, 3, 0);
   LLVMValueRef FooFunction = LLVMAddFunction(M, "foo", FooFuncTy);
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -488,7 +488,8 @@
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID: {
 auto *STyL = cast(TyL);
 auto *STyR = cast(TyR);
 if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -130,7 +130,8 @@
   default: break;
   case Type::PointerTyID:
 return true;
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID:
 if (cast(Ty)->getElementType()->isPointerTy())
   return true;
 break;
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1184,7 +1184,7 @@
 case Type::IntegerTyID: // Integers larger than 64 bits

[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Christopher Tetreault via Phabricator via lldb-commits
ctetreau updated this revision to Diff 259126.
ctetreau added a comment.

split C api stuff into separate commit. Do bare minimum here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587

Files:
  lldb/source/Expression/IRInterpreter.cpp
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
  llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  llvm/tools/llvm-c-test/echo.cpp
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Index: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
===
--- mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -168,12 +168,12 @@
   return nullptr;
 return LLVMType::getArrayTy(elementType, type->getArrayNumElements());
   }
-  case llvm::Type::VectorTyID: {
-auto *typeVTy = llvm::cast(type);
-if (typeVTy->isScalable()) {
-  emitError(unknownLoc) << "scalable vector types not supported";
-  return nullptr;
-}
+  case llvm::Type::ScalableVectorTyID: {
+emitError(unknownLoc) << "scalable vector types not supported";
+return nullptr;
+  }
+  case llvm::Type::FixedVectorTyID: {
+auto *typeVTy = llvm::cast(type);
 LLVMType elementType = processType(typeVTy->getElementType());
 if (!elementType)
   return nullptr;
Index: llvm/tools/llvm-c-test/echo.cpp
===
--- llvm/tools/llvm-c-test/echo.cpp
+++ llvm/tools/llvm-c-test/echo.cpp
@@ -137,7 +137,10 @@
   Clone(LLVMGetElementType(Src)),
   LLVMGetPointerAddressSpace(Src)
 );
-  case LLVMVectorTypeKind:
+  case LLVMScalableVectorTypeKind:
+// FIXME: scalable vectors unsupported
+break;
+  case LLVMFixedVectorTypeKind:
 return LLVMVectorType(
   Clone(LLVMGetElementType(Src)),
   LLVMGetVectorSize(Src)
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -488,7 +488,8 @@
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID: {
 auto *STyL = cast(TyL);
 auto *STyR = cast(TyR);
 if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -130,7 +130,8 @@
   default: break;
   case Type::PointerTyID:
 return true;
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID:
 if (cast(Ty)->getElementType()->isPointerTy())
   return true;
 break;
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1184,7 +1184,7 @@
 case Type::IntegerTyID: // Integers larger than 64 bits
 case Type::StructTyID:
 case Type::ArrayTyID:
-case Type::VectorTyID:
+case Type::FixedVectorTyID:
   ElementSize = DL.getTypeStoreSize(ETy);
   // Ptx allows variable initilization only for constant and
   // global state spaces.
@@ -1358,7 +1358,7 @@
   switch (ETy->getTypeID()) {
   case Type::StructTyID:
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
 ElementSize = DL.getTypeStoreSize(ETy);
 O << " .b8 ";
 getSymbol(GVar)->print(O, MAI);
@@ -1892,7 +1892,7 @@
   }
 
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
   case Type::StructTyID: {
 if (isa(CPV) || isa(CPV)) {
   int ElementSize = DL.getTypeAllocSize(CPV->getType());
Index: llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
===
--- llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ l

[Lldb-commits] [PATCH] D77587: [SVE] Add new VectorType subclasses

2020-04-21 Thread Christopher Tetreault via Phabricator via lldb-commits
ctetreau updated this revision to Diff 259104.
ctetreau added a comment.

remove unused variable


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77587

Files:
  lldb/source/Expression/IRInterpreter.cpp
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
  llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Index: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
===
--- mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -168,12 +168,12 @@
   return nullptr;
 return LLVMType::getArrayTy(elementType, type->getArrayNumElements());
   }
-  case llvm::Type::VectorTyID: {
-auto *typeVTy = llvm::cast(type);
-if (typeVTy->isScalable()) {
-  emitError(unknownLoc) << "scalable vector types not supported";
-  return nullptr;
-}
+  case llvm::Type::ScalableVectorTyID: {
+emitError(unknownLoc) << "scalable vector types not supported";
+return nullptr;
+  }
+  case llvm::Type::FixedVectorTyID: {
+auto *typeVTy = llvm::cast(type);
 LLVMType elementType = processType(typeVTy->getElementType());
 if (!elementType)
   return nullptr;
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -488,7 +488,8 @@
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID: {
 auto *STyL = cast(TyL);
 auto *STyR = cast(TyR);
 if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -130,7 +130,8 @@
   default: break;
   case Type::PointerTyID:
 return true;
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
+  case Type::ScalableVectorTyID:
 if (cast(Ty)->getElementType()->isPointerTy())
   return true;
 break;
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1184,7 +1184,7 @@
 case Type::IntegerTyID: // Integers larger than 64 bits
 case Type::StructTyID:
 case Type::ArrayTyID:
-case Type::VectorTyID:
+case Type::FixedVectorTyID:
   ElementSize = DL.getTypeStoreSize(ETy);
   // Ptx allows variable initilization only for constant and
   // global state spaces.
@@ -1358,7 +1358,7 @@
   switch (ETy->getTypeID()) {
   case Type::StructTyID:
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
 ElementSize = DL.getTypeStoreSize(ETy);
 O << " .b8 ";
 getSymbol(GVar)->print(O, MAI);
@@ -1892,7 +1892,7 @@
   }
 
   case Type::ArrayTyID:
-  case Type::VectorTyID:
+  case Type::FixedVectorTyID:
   case Type::StructTyID: {
 if (isa(CPV) || isa(CPV)) {
   int ElementSize = DL.getTypeAllocSize(CPV->getType());
Index: llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
===
--- llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
@@ -307,7 +307,7 @@
 const ArrayType *ATy = cast(Ty);
 return getSmallestAddressableSize(ATy->getElementType(), GV, TM);
   }
-  case Type::VectorTyID: {
+  case Type::FixedVectorTyID: {
 const VectorType *PTy = cast(Ty);
 return getSmallestAddressableSize(PTy->getElementType(), GV, TM);
   }
Index: llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
@@ -408,8 +408,7 @@
 Value *Arg = CI->