[Lldb-commits] [PATCH] D69366: [LLDB] [PECOFF] Fix symbols to refer to the right section

2019-10-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, amccarth.
Herald added a subscriber: JDevlieghere.
Herald added a project: LLDB.

The virtual container/header section causes the section list to be offset by 
one. Previously, symbols in the first section were given addresses in the COFF 
header section.

This depends on D69100 ; before that, one has 
to access the subsections differently.

The testcase uses `lldb-test symbols`, but doesn't really use any SymbolFile 
functionality, but just tries to inspect what the ObjectFile plugin provides in 
the symbol table, hence the testcase is in Shell/ObjectFile/PECOFF.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D69366

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
@@ -0,0 +1,91 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test symbols %t | FileCheck %s
+
+# CHECK: Code 0x40001000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} main
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 1
+SectionData: C3
+symbols:
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:main
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -685,7 +685,10 @@
 symbol.naux = symtab_data.GetU8(&offset);
 symbols[i].GetMangled().SetValue(ConstString(symbol_name.c_str()));
 if ((int16_t)symbol.sect >= 1) {
-  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect - 1),
+  // symbol.sect is indexed starting from 1, but our section
+  // list contains one extra synthetic section at the start,
+  // so we should use section index "symbol.sect - 1 + 1".
+  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect),
   symbol.value);
   symbols[i].GetAddressRef() = symbol_addr;
   symbols[i].SetType(MapSymbolType(symbol.type));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69366: [LLDB] [PECOFF] Fix symbols to refer to the right section

2019-10-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 226216.
mstorsjo added a comment.

Updated the testcase to check for symbols in more than one section.


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

https://reviews.llvm.org/D69366

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
@@ -0,0 +1,115 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test symbols %t | FileCheck %s
+
+# CHECK: Code 0x40001000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
+# CHECK:  0x40002000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 1
+SectionData: C3
+  - Name:.data
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+VirtualAddress:  8192
+VirtualSize: 4
+SectionData: ''
+symbols:
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:.data
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:.bss
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:entry
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+  - Name:variable
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -685,7 +685,10 @@
 symbol.naux = symtab_data.GetU8(&offset);
 symbols[i].GetMangled().SetValue(ConstString(symbol_name.c_str()));
 if ((int16_t)symbol.sect >= 1) {
-  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect - 1),
+  // symbol.sect is indexed starting from 1, but our section
+  // list contains one extra synthetic section at the start,
+  // so we should use section index "symbol.sect - 1 + 1".
+  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect),

[Lldb-commits] [PATCH] D69371: [ARM64] Cleanup and speedup NativeRegisterContextLinux_arm64

2019-10-24 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added reviewers: labath, clayborg.
Herald added a subscriber: kristof.beyls.

This patch simplifies register accesses in NativeRegisterContextLinux_arm64 and 
also adds some bare minimum caching to avoid multiple calls to ptrace during a 
stop.

Linux ptrace returns data in the form of structures containing GPR/FPR data. 
This means that one single call is enough to read all GPRs or FPRs. We do that 
once per stop and keep reading from or writing to the buffer that we have in 
NativeRegisterContextLinux_arm64 class. Before a resume or detach we write all 
buffers back.

This is tested on aarch64 thunder x1 with Ubuntu 18.04. Also tested regressions 
on x86_64.


https://reviews.llvm.org/D69371

Files:
  include/lldb/Host/common/NativeRegisterContext.h
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -40,6 +40,8 @@
 
   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
+  Status InvalidateAllRegisters() override;
+
   // Hardware breakpoints/watchpoint management functions
 
   uint32_t NumSupportedHardwareBreakpoints() override;
@@ -77,11 +79,6 @@
   enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK };
 
 protected:
-  Status DoReadRegisterValue(uint32_t offset, const char *reg_name,
- uint32_t size, RegisterValue &value) override;
-
-  Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,
-  const RegisterValue &value) override;
 
   Status ReadGPR() override;
 
@@ -125,8 +122,14 @@
 uint32_t fpcr;
   };
 
-  uint64_t m_gpr_arm64[k_num_gpr_registers_arm64]; // 64-bit general purpose
-   // registers.
+  struct GPR {
+uint64_t x[31];
+uint64_t sp;
+uint64_t pc;
+uint64_t pstate;
+  };
+
+  GPR m_gpr_arm64; // 64-bit general purpose registers.
   RegInfo m_reg_info;
   FPU m_fpr; // floating-point registers including extended register sets.
 
@@ -147,6 +150,9 @@
   uint32_t m_max_hbp_supported;
   bool m_refresh_hwdebug_info;
 
+  bool m_gpr_is_valid;
+  bool m_fpu_is_valid;
+
   bool IsGPR(unsigned reg) const;
 
   bool IsFPR(unsigned reg) const;
Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -152,6 +152,9 @@
   m_max_hwp_supported = 16;
   m_max_hbp_supported = 16;
   m_refresh_hwdebug_info = true;
+
+  m_gpr_is_valid = false;
+  m_fpu_is_valid = false;
 }
 
 uint32_t NativeRegisterContextLinux_arm64::GetRegisterSetCount() const {
@@ -185,41 +188,36 @@
 
   const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
 
-  if (IsFPR(reg)) {
-error = ReadFPR();
+  if (reg == LLDB_INVALID_REGNUM)
+return Status("no lldb regnum for %s", reg_info && reg_info->name
+   ? reg_info->name
+   : "");
+
+  uint8_t *src;
+  uint32_t offset;
+
+  if (IsGPR(reg)) {
+error = ReadGPR();
 if (error.Fail())
   return error;
-  } else {
-uint32_t full_reg = reg;
-bool is_subreg = reg_info->invalidate_regs &&
- (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);
-
-if (is_subreg) {
-  // Read the full aligned 64-bit register.
-  full_reg = reg_info->invalidate_regs[0];
-}
 
-error = ReadRegisterRaw(full_reg, reg_value);
+offset = reg_info->byte_offset;
+assert(offset < GetGPRSize());
+src = (uint8_t *)GetGPRBuffer() + offset;
 
-if (error.Success()) {
-  // If our read was not aligned (for ah,bh,ch,dh), shift our returned
-  // value one byte to the right.
-  if (is_subreg && (reg_info->byte_offset & 0x1))
-reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8);
-
-  // If our return byte size was greater than the return value reg size,
-  // then use the type specified by reg_info rather than the uint64_t
-  // default
-  if (reg_value.GetByteSize() > reg_info->byte_size)
-reg_value.SetType(reg_info);
-}
-return error;
-  }
+  } else if (IsFPR(reg)) {
+
+error = ReadFPR();
+if (error.Fail())
+  return error;
+
+offset = CalculateFprOffset(reg_info);
+assert(offset < GetFPRSize());
+src = (uint8_t *)GetFPRBuffer() + offset;
+  } else
+return Status("failed - register wasn't recognized to be a GPR or an FPR, "
+  "writ

[Lldb-commits] [PATCH] D69341: [zorg] Port LLDB cmake build factory to git

2019-10-24 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:71
+is_legacy_mode=False,
+depends_on_projects=["llvm", "clang", "lldb", "lld"])
 

sivachandra wrote:
> labath wrote:
> > sivachandra wrote:
> > > sivachandra wrote:
> > > > I wonder why it is getting git.lab.llvm.org! Can you try with an 
> > > > additional arg to the LLVMBuildFactory constructor:
> > > > 
> > > > ```
> > > >   repourl_prefix="http://github.com/llvm/";
> > > > ```
> > > May be https instead of http.
> > Are you sure that's needed? I don't see anyone else setting that. 
> > @jankratochvil, could this be something specific to your setup?
> If I am reading the code right, it should not be needed. I suggested that to 
> see if @jankratochvil can make progress, which validates the rest of this 
> patch.
It is still at: 
https://github.com/llvm/llvm-zorg/blob/master/buildbot/osuosl/master/master.cfg#L59
When I delete local 
`/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir` it will get 
rebuilt and it errors again:
```
2019-10-24 12:34:33+0200 [-] adding 3 new changesources, removing 0
2019-10-24 12:34:33+0200 [-] LLVMGitPoller: using workdir 
'/quad/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir'
2019-10-24 12:34:33+0200 [-] LLVMGitPoller: initializing working dir from 
http://git.lab.llvm.org/llvm/llvm-project.git
2019-10-24 12:34:33+0200 [-] configuration update complete
2019-10-24 12:34:33+0200 [-] while initializing LLVMGitPoller repository
Traceback (most recent call last):
  File 
"/usr/lib64/python2.7/site-packages/twisted/internet/_baseprocess.py", line 64, 
in maybeCallProcessEnded
proto.processEnded(Failure(reason))
  File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", 
line 163, in processEnded
self.deferred.callback((out, err, code))
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", 
line 460, in callback
self._startRunCallbacks(result)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", 
line 568, in _startRunCallbacks
self._runCallbacks()
---  ---
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", 
line 654, in _runCallbacks
current.result = callback(current.result, *args, **kw)
  File 
"/quad/home/buildbot/zorg-git/buildbot/osuosl/master/zorg/buildbot/changes/llvmgitpoller.py",
 line 419, in _convert_nonzero_to_failure
raise EnvironmentError('command failed with exit code %d: %s' % 
(code, stderr))
exceptions.EnvironmentError: command failed with exit code 128: fatal: 
unable to access 'http://git.lab.llvm.org/llvm/llvm-project.git/': Could not 
resolve host: git.lab.llvm.org
```



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

https://reviews.llvm.org/D69341



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


[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-10-24 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Hey @labath,

Have you had a chance to take a look at the last revision of this?

Tks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [PATCH] D69341: [zorg] Port LLDB cmake build factory to git

2019-10-24 Thread Siva Chandra via Phabricator via lldb-commits
sivachandra added inline comments.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:71
+is_legacy_mode=False,
+depends_on_projects=["llvm", "clang", "lldb", "lld"])
 

jankratochvil wrote:
> sivachandra wrote:
> > labath wrote:
> > > sivachandra wrote:
> > > > sivachandra wrote:
> > > > > I wonder why it is getting git.lab.llvm.org! Can you try with an 
> > > > > additional arg to the LLVMBuildFactory constructor:
> > > > > 
> > > > > ```
> > > > >   repourl_prefix="http://github.com/llvm/";
> > > > > ```
> > > > May be https instead of http.
> > > Are you sure that's needed? I don't see anyone else setting that. 
> > > @jankratochvil, could this be something specific to your setup?
> > If I am reading the code right, it should not be needed. I suggested that 
> > to see if @jankratochvil can make progress, which validates the rest of 
> > this patch.
> It is still at: 
> https://github.com/llvm/llvm-zorg/blob/master/buildbot/osuosl/master/master.cfg#L59
> When I delete local 
> `/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir` it will 
> get rebuilt and it errors again:
> ```
> 2019-10-24 12:34:33+0200 [-] adding 3 new changesources, removing 0
> 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: using workdir 
> '/quad/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir'
> 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: initializing working dir from 
> http://git.lab.llvm.org/llvm/llvm-project.git
> 2019-10-24 12:34:33+0200 [-] configuration update complete
> 2019-10-24 12:34:33+0200 [-] while initializing LLVMGitPoller repository
> Traceback (most recent call last):
>   File 
> "/usr/lib64/python2.7/site-packages/twisted/internet/_baseprocess.py", line 
> 64, in maybeCallProcessEnded
> proto.processEnded(Failure(reason))
>   File 
> "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 163, in 
> processEnded
> self.deferred.callback((out, err, code))
>   File 
> "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 460, in 
> callback
> self._startRunCallbacks(result)
>   File 
> "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 568, in 
> _startRunCallbacks
> self._runCallbacks()
> ---  ---
>   File 
> "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 654, in 
> _runCallbacks
> current.result = callback(current.result, *args, **kw)
>   File 
> "/quad/home/buildbot/zorg-git/buildbot/osuosl/master/zorg/buildbot/changes/llvmgitpoller.py",
>  line 419, in _convert_nonzero_to_failure
> raise EnvironmentError('command failed with exit code %d: %s' % 
> (code, stderr))
> exceptions.EnvironmentError: command failed with exit code 128: 
> fatal: unable to access 'http://git.lab.llvm.org/llvm/llvm-project.git/': 
> Could not resolve host: git.lab.llvm.org
> ```
> 
Ah, sorry! I missed that you were showing the master stack trace.

I wonder if its a repo which only the master can see. Look at this: 
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/32069

It seems to indicate that the master is tracking the git.lab.llvm repo, but 
"Checkout the source code" step is fetching from github.


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

https://reviews.llvm.org/D69341



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


[Lldb-commits] [PATCH] D69341: [zorg] Port LLDB cmake build factory to git

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 5 inline comments as done.
labath added inline comments.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:71
+is_legacy_mode=False,
+depends_on_projects=["llvm", "clang", "lldb", "lld"])
 

sivachandra wrote:
> jankratochvil wrote:
> > sivachandra wrote:
> > > labath wrote:
> > > > sivachandra wrote:
> > > > > sivachandra wrote:
> > > > > > I wonder why it is getting git.lab.llvm.org! Can you try with an 
> > > > > > additional arg to the LLVMBuildFactory constructor:
> > > > > > 
> > > > > > ```
> > > > > >   repourl_prefix="http://github.com/llvm/";
> > > > > > ```
> > > > > May be https instead of http.
> > > > Are you sure that's needed? I don't see anyone else setting that. 
> > > > @jankratochvil, could this be something specific to your setup?
> > > If I am reading the code right, it should not be needed. I suggested that 
> > > to see if @jankratochvil can make progress, which validates the rest of 
> > > this patch.
> > It is still at: 
> > https://github.com/llvm/llvm-zorg/blob/master/buildbot/osuosl/master/master.cfg#L59
> > When I delete local 
> > `/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir` it will 
> > get rebuilt and it errors again:
> > ```
> > 2019-10-24 12:34:33+0200 [-] adding 3 new changesources, removing 0
> > 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: using workdir 
> > '/quad/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir'
> > 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: initializing working dir from 
> > http://git.lab.llvm.org/llvm/llvm-project.git
> > 2019-10-24 12:34:33+0200 [-] configuration update complete
> > 2019-10-24 12:34:33+0200 [-] while initializing LLVMGitPoller repository
> > Traceback (most recent call last):
> >   File 
> > "/usr/lib64/python2.7/site-packages/twisted/internet/_baseprocess.py", line 
> > 64, in maybeCallProcessEnded
> > proto.processEnded(Failure(reason))
> >   File 
> > "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 163, 
> > in processEnded
> > self.deferred.callback((out, err, code))
> >   File 
> > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 460, 
> > in callback
> > self._startRunCallbacks(result)
> >   File 
> > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 568, 
> > in _startRunCallbacks
> > self._runCallbacks()
> > ---  ---
> >   File 
> > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 654, 
> > in _runCallbacks
> > current.result = callback(current.result, *args, **kw)
> >   File 
> > "/quad/home/buildbot/zorg-git/buildbot/osuosl/master/zorg/buildbot/changes/llvmgitpoller.py",
> >  line 419, in _convert_nonzero_to_failure
> > raise EnvironmentError('command failed with exit code %d: %s' % 
> > (code, stderr))
> > exceptions.EnvironmentError: command failed with exit code 128: 
> > fatal: unable to access 'http://git.lab.llvm.org/llvm/llvm-project.git/': 
> > Could not resolve host: git.lab.llvm.org
> > ```
> > 
> Ah, sorry! I missed that you were showing the master stack trace.
> 
> I wonder if its a repo which only the master can see. Look at this: 
> http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/32069
> 
> It seems to indicate that the master is tracking the git.lab.llvm repo, but 
> "Checkout the source code" step is fetching from github.
I'm afraid I am starting to get a bit lost here. Have we reached some kind of a 
conclusion? Should we maybe just commit it and see what happens? The bots are 
broken now anyway...



Comment at: zorg/buildbot/builders/LLDBBuilder.py:110
 cmake_cmd = [
-"cmake", "-G", "Ninja", "../llvm",
+"cmake", "-G", "Ninja", "../" + self.monorepo_dir,
 "-DCMAKE_BUILD_TYPE=" + config,

sivachandra wrote:
> labath wrote:
> > jankratochvil wrote:
> > > sivachandra wrote:
> > > > Should this be os.path.join(os.pardir, f.monorepo_dir, "llvm") ?
> > > I was curious there is no longer trailing `"llvm"` as I am using `cmake 
> > > ../llvm-monorepo/llvm/`.  Yes, it does compile with the new expression 
> > > there:
> > > ```
> > > "cmake", "-G", "Ninja", os.path.join(os.pardir, f.monorepo_dir, 
> > > "llvm"),
> > > ```
> > Technically, using `os.path.join`, is not correct here, because this is a 
> > path on the buildbot, not the path on the host which runs the master. In 
> > practice that doesn't matter because the master runs on a posix system. The 
> > existing code is pretty inconsistent about the usage, but the `../` seems 
> > to be a bit more common.
> Right. The main point I was trying to convey was to add the path to the llvm 
> directory.
> 
> I am only interested in seeing what you eventually land as I want to use the 
> same for the LLVM libc builders.
Got it. Thanks.


CHANGES SINCE 

[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'm sorry, this dropped off my radar. The code looks fine, but it could use 
some more tests. For instance, one test when you set the setting value to the 
non-default , and then check that lldb does _not_ use the `g` packet .




Comment at: 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td:23
+DefaultFalse,
+Desc<"Specify if the server should use 'g' packets to write registers.">;
 }

Having a capital G in the setting name would be somewhat unprecedented (though 
I wouldn't be really opposed to it), but I think that at least the description 
should say 'G'.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [PATCH] D69371: [ARM64] Cleanup and speedup NativeRegisterContextLinux_arm64

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The idea seems nice, however I am wondering, if it is not going a bit too far. 
In not sure of the exact situation on arm64, but in general, there are 
registers which only accept some bit patterns. What exactly does ptrace do in 
this situation? Postponing the write until we resume/detach means we lose the 
opportunity to report any errors that would result from the ptrace call.

What's the exact case you're optimising for? Would it be enough to just cache 
the reads, but then as soon as we write something, we immediately call ptrace 
to ensure that the value was written successfully? It sounds like this could be 
enough as the majority of the operations should be reads...




Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h:153-154
 
+  bool m_gpr_is_valid;
+  bool m_fpu_is_valid;
+

Please move these next to the members they are guarding.


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

https://reviews.llvm.org/D69371



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


[Lldb-commits] [PATCH] D69341: [zorg] Port LLDB cmake build factory to git

2019-10-24 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil accepted this revision.
jankratochvil added inline comments.
This revision is now accepted and ready to land.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:71
+is_legacy_mode=False,
+depends_on_projects=["llvm", "clang", "lldb", "lld"])
 

labath wrote:
> sivachandra wrote:
> > jankratochvil wrote:
> > > sivachandra wrote:
> > > > labath wrote:
> > > > > sivachandra wrote:
> > > > > > sivachandra wrote:
> > > > > > > I wonder why it is getting git.lab.llvm.org! Can you try with an 
> > > > > > > additional arg to the LLVMBuildFactory constructor:
> > > > > > > 
> > > > > > > ```
> > > > > > >   repourl_prefix="http://github.com/llvm/";
> > > > > > > ```
> > > > > > May be https instead of http.
> > > > > Are you sure that's needed? I don't see anyone else setting that. 
> > > > > @jankratochvil, could this be something specific to your setup?
> > > > If I am reading the code right, it should not be needed. I suggested 
> > > > that to see if @jankratochvil can make progress, which validates the 
> > > > rest of this patch.
> > > It is still at: 
> > > https://github.com/llvm/llvm-zorg/blob/master/buildbot/osuosl/master/master.cfg#L59
> > > When I delete local 
> > > `/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir` it 
> > > will get rebuilt and it errors again:
> > > ```
> > > 2019-10-24 12:34:33+0200 [-] adding 3 new changesources, removing 0
> > > 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: using workdir 
> > > '/quad/home/buildbot/zorg-git/buildbot/osuosl/master/gitpoller-workdir'
> > > 2019-10-24 12:34:33+0200 [-] LLVMGitPoller: initializing working dir from 
> > > http://git.lab.llvm.org/llvm/llvm-project.git
> > > 2019-10-24 12:34:33+0200 [-] configuration update complete
> > > 2019-10-24 12:34:33+0200 [-] while initializing LLVMGitPoller repository
> > > Traceback (most recent call last):
> > >   File 
> > > "/usr/lib64/python2.7/site-packages/twisted/internet/_baseprocess.py", 
> > > line 64, in maybeCallProcessEnded
> > > proto.processEnded(Failure(reason))
> > >   File 
> > > "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 163, 
> > > in processEnded
> > > self.deferred.callback((out, err, code))
> > >   File 
> > > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 460, 
> > > in callback
> > > self._startRunCallbacks(result)
> > >   File 
> > > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 568, 
> > > in _startRunCallbacks
> > > self._runCallbacks()
> > > ---  ---
> > >   File 
> > > "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 654, 
> > > in _runCallbacks
> > > current.result = callback(current.result, *args, **kw)
> > >   File 
> > > "/quad/home/buildbot/zorg-git/buildbot/osuosl/master/zorg/buildbot/changes/llvmgitpoller.py",
> > >  line 419, in _convert_nonzero_to_failure
> > > raise EnvironmentError('command failed with exit code %d: %s' 
> > > % (code, stderr))
> > > exceptions.EnvironmentError: command failed with exit code 128: 
> > > fatal: unable to access 'http://git.lab.llvm.org/llvm/llvm-project.git/': 
> > > Could not resolve host: git.lab.llvm.org
> > > ```
> > > 
> > Ah, sorry! I missed that you were showing the master stack trace.
> > 
> > I wonder if its a repo which only the master can see. Look at this: 
> > http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/32069
> > 
> > It seems to indicate that the master is tracking the git.lab.llvm repo, but 
> > "Checkout the source code" step is fetching from github.
> I'm afraid I am starting to get a bit lost here. Have we reached some kind of 
> a conclusion? Should we maybe just commit it and see what happens? The bots 
> are broken now anyway...
I agree your current patch should be an improvement of the current situation. I 
have no idea what is that `LLVMGitPoller` but it seems to be already broken and 
it is probably not required for the buildbots IIUC.


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

https://reviews.llvm.org/D69341



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


[Lldb-commits] [PATCH] D69366: [LLDB] [PECOFF] Fix symbols to refer to the right section

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:691
+  // so we should use section index "symbol.sect - 1 + 1".
+  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect),
   symbol.value);

You should use FindSectionByID here. That's the API used by both ELF and MachO 
object files and SymbolFilePDB classes for this sort of thing. This would 
obviate the need for the long comment and make this patch independent of the 
header stuff (which I'm going to commit as soon as I figure out how that's 
done).



Comment at: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml:2
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test symbols %t | FileCheck %s
+

At some point we'll probably want to add some kind of a  symtab dumping 
mechanism to the object-file subcommand, but this is fine until then.



Comment at: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml:4
+
+# CHECK: Code 0x40001000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
+# CHECK:  0x40002000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable

Could you also add a CHECK line with the table header, just so one gets the 
idea of what is the meaning of individual fields..


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

https://reviews.llvm.org/D69366



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


[Lldb-commits] [PATCH] D62732: [RISCV] Add SystemV ABI

2019-10-24 Thread Simon Cook via Phabricator via lldb-commits
simoncook updated this revision to Diff 225998.
simoncook retitled this revision from "[WIP][RISCV] Initial port of LLDB for 
RISC-V" to "[RISCV] Add SystemV ABI".
simoncook edited the summary of this revision.
simoncook added a comment.
Herald added subscribers: pzheng, s.egerton, lenary, arichardson, emaste.
Herald added a reviewer: espindola.

Rebase, implement all hooks that aren't PrepareTrivialCall/function calling 
related. If its possible to commit these two separately, I think it would be 
best to have that as a separate patch whereby preparing arguments for the 
various RISC-V hard-float ABIs can be done independently of 
breakpoints/unwinding/etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62732

Files:
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-riscv/ABISysV_riscv.cpp
  lldb/source/Plugins/ABI/SysV-riscv/ABISysV_riscv.h
  lldb/source/Plugins/ABI/SysV-riscv/CMakeLists.txt
  lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Utility/ArchSpec.cpp

Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -212,6 +212,11 @@
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
  ArchSpec::eCore_hexagon_hexagonv5, "hexagonv5"},
 
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::riscv32,
+ ArchSpec::eCore_riscv32, "riscv32"},
+{eByteOrderLittle, 8, 2, 4, llvm::Triple::riscv64,
+ ArchSpec::eCore_riscv64, "riscv64"},
+
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::UnknownArch,
  ArchSpec::eCore_uknownMach32, "unknown-mach-32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::UnknownArch,
@@ -445,6 +450,10 @@
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // HEXAGON
 {ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
  0xu, 0xu }, // ARC
+{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu}, // riscv32
+{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu}, // riscv64
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -2059,6 +2059,8 @@
 case llvm::Triple::ppc:
 case llvm::Triple::ppc64:
 case llvm::Triple::ppc64le:
+case llvm::Triple::riscv32:
+case llvm::Triple::riscv64:
 case llvm::Triple::systemz:
 case llvm::Triple::hexagon:
 case llvm::Triple::arc:
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1901,6 +1901,20 @@
 trap_opcode_size = sizeof(g_i386_opcode);
   } break;
 
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64: {
+static const uint8_t g_riscv_c_opcode[] = {0x02, 0x90}; // c_ebreak
+static const uint8_t g_riscv_opcode[] = {0x73, 0x00, 0x10, 0x00}; // ebreak
+if (arch.GetFlags() & ArchSpec::eRISCV_supports_rvc) {
+  trap_opcode = g_riscv_c_opcode;
+  trap_opcode_size = sizeof(g_riscv_c_opcode);
+} else {
+  trap_opcode = g_riscv_opcode;
+  trap_opcode_size = sizeof(g_riscv_opcode);
+}
+break;
+  }
+
   default:
 llvm_unreachable(
 "Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1360,6 +1360,18 @@
   arch_spec.SetFlags(ArchSpec::eARM_abi_hard_float);
   }
 
+  if (arch_spec.GetMachine() == llvm::Triple::riscv32 ||
+  arch_spec.GetMachine() == llvm::Triple::riscv64) {
+if (header.e_flags & llvm::ELF::EF_RISCV_RVC)
+  arch_spec.SetFlags(ArchSpec::eRISCV_supports_rvc);
+if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI) ==
+llvm::ELF::EF_RISCV_FLOAT_ABI_SINGLE)
+  arch_spec.SetFlags(ArchSpec::eRISCV_abi_single_float);
+if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI) ==
+llvm::ELF::EF_RISCV_FLOAT_ABI_DOUBLE)
+  arch_spec.SetFlags(ArchSpec::eRISCV_abi_double_float);
+  }
+
   // If there are no section headers we are done.
   if (header.e_shnum == 0)
 return 0;
Index: lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/llv

[Lldb-commits] [PATCH] D66795: [Mips] Use appropriate private label prefix based on Mips ABI

2019-10-24 Thread Mirko Brkusanin via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4b63ca1379a8: [Mips] Use appropriate private label prefix 
based on Mips ABI (authored by mbrkusanin).

Changed prior to commit:
  https://reviews.llvm.org/D66795?vs=224603&id=226112#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66795

Files:
  clang/lib/Parse/ParseStmtAsm.cpp
  clang/tools/driver/cc1as_main.cpp
  lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  llvm/include/llvm/Support/TargetRegistry.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/MC/MCDisassembler/Disassembler.cpp
  llvm/lib/Object/ModuleSymbolTable.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h
  llvm/lib/Target/ARC/MCTargetDesc/ARCMCTargetDesc.cpp
  llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
  llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp
  llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.h
  llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.h
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.cpp
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.h
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
  llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
  llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
  llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
  llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
  llvm/test/CodeGen/Mips/compactbranches/no-beqzc-bnezc.ll
  llvm/test/MC/Mips/macro-li.d.s
  llvm/test/MC/Mips/macro-li.s.s
  llvm/test/MC/Mips/private-prefix.s
  llvm/tools/dsymutil/DwarfStreamer.cpp
  llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
  llvm/tools/llvm-dwp/llvm-dwp.cpp
  llvm/tools/llvm-exegesis/lib/Analysis.cpp
  llvm/tools/llvm-jitlink/llvm-jitlink.cpp
  llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
  llvm/tools/llvm-mc/Disassembler.cpp
  llvm/tools/llvm-mc/Disassembler.h
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-mca/llvm-mca.cpp
  llvm/tools/llvm-objdump/MachODump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
  llvm/tools/sancov/sancov.cpp
  llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
  llvm/unittests/ExecutionEngine/JITLink/JITLinkTestCommon.cpp
  llvm/unittests/MC/DwarfLineTables.cpp
  llvm/unittests/MC/MCInstPrinter.cpp

Index: llvm/unittests/MC/MCInstPrinter.cpp
===
--- llvm/unittests/MC/MCInstPrinter.cpp
+++ llvm/unittests/MC/MCInstPrinter.cpp
@@ -9,6 +9,7 @@
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
@@ -40,7 +41,8 @@
   return;
 
 MRI.reset(TheTarget->createMCRegInfo(TripleName));
-MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName));
+MCTargetOptions MCOptions;
+MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions));
 MII.reset(TheTarget->createMCInstrInfo());
 Printer.reset(TheTarget->createMCInstPrinter(
 Triple(TripleName), MAI->getAssemblerDialect(), *MAI, *MII, *MRI));
Index: llvm/unittests/MC/DwarfLineTables.cpp
===
--- llvm/unittests/MC/DwarfLineTables.cpp
+++ llvm/unittests/MC/DwarfLineTables.cpp
@@ -12,6 +12,7 @@
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "gtest/gtest.h"
@@ -37,7 +38,8 @@
   return;
 
 MRI.reset(TheTarget->createMCRegInfo(Triple));
-MAI.reset(TheTarget->createMCAsmInfo(*MRI, Triple));
+MCTargetOptions MCOptions;
+MAI.reset(TheTarget->createMCAsmInfo(*MRI, Triple, MCOptions));
 Ctx = std::make_unique(MAI.get

[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/trunk/source/Host/common/File.cpp:74
+  .Case("r", File::eOpenOptionRead)
+  .Case("w", File::eOpenOptionWrite)
+  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |

mgorny wrote:
> Shouldn't this also include `File::eOpenOptionCanCreate | 
> File::eOpenOptionTruncate`?
Yeah, I guess it should, though it probably does not matter in practice right 
now as we're only using this on already opened FILE* objects.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67793



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


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D69230#1718191 , @lawrence_danna 
wrote:

> Seems like there's a consensus that if we have something like this it should 
> be called `DenseOptional`, and changes to `Optional` should only make it more 
> like `std::optional`


I am not sure I would call that a "consensus"  -- my interpretation of 
@dblaikie's comment is that he does not want an extra dense optional type 
either. Which I disagree with, because I think it would be useful to have some 
form of a compressed optional storage, as that's something that is currently 
often implemented via bitfields, magic invalid values, etc. That said, I think 
you have convinced me that having different optional representations for a 
single type is not a good idea. It's probably better to use some form of a 
"strong" typedef to achieve that instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69230



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


[Lldb-commits] [PATCH] D69394: [CMake] Move specific logic into API, shell and unittest sub-directories.

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, labath, davide, teemperor.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

The top-level CMake file in the test directory can be simplified by moving 
relevant configuration options into the subdirectories. This makes it easier to 
understand what CMake options are needed by the different test suites.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D69394

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  lldb/test/Unit/CMakeLists.txt

Index: lldb/test/Unit/CMakeLists.txt
===
--- /dev/null
+++ lldb/test/Unit/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Configure the Unit test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+
Index: lldb/test/Shell/CMakeLists.txt
===
--- /dev/null
+++ lldb/test/Shell/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Configure the Shell test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -1,8 +1,6 @@
 # Test runner infrastructure for LLDB. This configures the LLDB test trees
 # for use by Lit, and delegates to LLVM's lit test handlers.
 
-add_subdirectory(API)
-
 # Configure and create module cache directories.
 set(LLDB_TEST_MODULE_CACHE_LLDB "${LLDB_TEST_BUILD_DIRECTORY}/module-cache-lldb" CACHE PATH "The Clang module cache used by the Clang embedded in LLDB while running tests.")
 set(LLDB_TEST_MODULE_CACHE_CLANG "${LLDB_TEST_BUILD_DIRECTORY}/module-cache-clang" CACHE PATH "The Clang module cache used by the Clang while building tests.")
@@ -16,39 +14,6 @@
   set(LLVM_BUILD_MODE "%(build_mode)s")
 endif ()
 
-if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-  set(LLDB_IS_64_BITS 1)
-endif()
-
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
-set(dotest_args_replacement ${LLVM_BUILD_MODE})
-
-
-if(LLDB_BUILT_STANDALONE)
-  # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our configuration name placeholder.
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-
-  # Remaining ones must be paths to the provided LLVM build-tree.
-  if(LLVM_CONFIGURATION_TYPES)
-# LLDB uses single-config; LLVM multi-config; pick one and prefer Release types.
-# Otherwise, if both use multi-config the default is fine.
-if(NOT CMAKE_CONFIGURATION_TYPES)
-  if(RelWithDebInfo IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement RelWithDebInfo)
-  elseif(Release IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement Release)
-  else()
-list(GET LLVM_CONFIGURATION_TYPES 0 dotest_args_replacement)
-  endif()
-endif()
-  else()
-# Common case: LLVM used a single-configuration generator like Ninja.
-set(dotest_args_replacement ".")
-  endif()
-endif()
-
-string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 
@@ -64,10 +29,15 @@
   llvm-readobj
   )
 
-# Since llvm-strip is a symlink created by add_custom_target, it
-# doesn't expose an export target when building standalone.
 if(NOT LLDB_BUILT_STANDALONE)
-  add_lldb_test_dependency(llvm-strip)
+  # Since llvm-strip is a symlink created by add_custom_target, it doesn't
+  # expose an export target when building standalone.
+  add_lldb_test_dependency(
+llvm-strip
+FileCheck
+count
+not
+  )
 endif()
 
 if(TARGET lld)
@@ -79,12 +49,8 @@
   endif()
 endif()
 
-if(NOT LLDB_BUILT_STANDALONE)
-  add_lldb_test_dependency(
-FileCheck
-count
-not
-  )
+if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+  set(LLDB_IS_64_BITS 1)
 endif()
 
 # These values are not canonicalized within LLVM.
@@ -94,6 +60,11 @@
   LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
+# Configure the individual test suites.
+add_subdirectory(API)
+add_subdirectory(Shell)
+add_subdirectory(Unit)
+
 # Configure the top level test suite.
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -101,41 +72,13 @@
   MAIN_CONFIG
   ${CMAKE_CURRENT_SOURCE_DIR}/li

[Lldb-commits] [PATCH] D69366: [LLDB] [PECOFF] Fix symbols to refer to the right section

2019-10-24 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added inline comments.



Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:691
+  // so we should use section index "symbol.sect - 1 + 1".
+  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect),
   symbol.value);

labath wrote:
> You should use FindSectionByID here. That's the API used by both ELF and 
> MachO object files and SymbolFilePDB classes for this sort of thing. This 
> would obviate the need for the long comment and make this patch independent 
> of the header stuff (which I'm going to commit as soon as I figure out how 
> that's done).
+1 to labath's suggestion.  It seems unfortunate that this already had a 
coupling to implementation details of the section list.


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

https://reviews.llvm.org/D69366



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


[Lldb-commits] [PATCH] D69394: [CMake] Move specific logic into API, shell and unittest sub-directories.

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

LGTM. Thanks!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69394



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


[Lldb-commits] [PATCH] D69400: [lldb] [Host/netbsd] Include argv[0] in process_info.GetArguments()

2019-10-24 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, labath, wallace.

Include argv[0] in GetArguments(), not only in GetExecutableFile().
This fixes 'process list -v' to report the executable name,
and therefore to pass TestProcessList.


https://reviews.llvm.org/D69400

Files:
  lldb/source/Host/netbsd/Host.cpp


Index: lldb/source/Host/netbsd/Host.cpp
===
--- lldb/source/Host/netbsd/Host.cpp
+++ lldb/source/Host/netbsd/Host.cpp
@@ -79,6 +79,7 @@
 return false;
 
   Args &proc_args = process_info.GetArguments();
+  proc_args.AppendArgument(llvm::StringRef(cstr));
   while (1) {
 const uint8_t *p = data.PeekData(offset, 1);
 while ((p != NULL) && (*p == '\0') && offset < arg_data_size) {


Index: lldb/source/Host/netbsd/Host.cpp
===
--- lldb/source/Host/netbsd/Host.cpp
+++ lldb/source/Host/netbsd/Host.cpp
@@ -79,6 +79,7 @@
 return false;
 
   Args &proc_args = process_info.GetArguments();
+  proc_args.AppendArgument(llvm::StringRef(cstr));
   while (1) {
 const uint8_t *p = data.PeekData(offset, 1);
 while ((p != NULL) && (*p == '\0') && offset < arg_data_size) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0c798aa - [CMake] Split logic across test suite subdirectories (NFC)

2019-10-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-10-24T10:58:22-07:00
New Revision: 0c798aa4483e103e67231c279aed00cd16154e33

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

LOG: [CMake] Split logic across test suite subdirectories (NFC)

The top-level CMake file in the test directory can be simplified by
moving relevant configuration options into the corresponding
subdirectories. Doing so makes it easier to understand what CMake
options are needed by the different test suites.

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

Added: 
lldb/test/Shell/CMakeLists.txt
lldb/test/Unit/CMakeLists.txt

Modified: 
lldb/test/API/CMakeLists.txt
lldb/test/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 4f787d21fd3e..0708e804f49c 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -125,9 +125,38 @@ if(CMAKE_HOST_APPLE)
   endif()
 endif()
 
-set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
-set_property(GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY ${LLDB_DOTEST_ARGS})
+set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS} CACHE 
INTERNAL STRING)
+set(dotest_args_replacement ${LLVM_BUILD_MODE})
+
+if(LLDB_BUILT_STANDALONE)
+  # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our 
configuration name placeholder.
+  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+
+  # Remaining ones must be paths to the provided LLVM build-tree.
+  if(LLVM_CONFIGURATION_TYPES)
+# LLDB uses single-config; LLVM multi-config; pick one and prefer Release 
types.
+# Otherwise, if both use multi-config the default is fine.
+if(NOT CMAKE_CONFIGURATION_TYPES)
+  if(RelWithDebInfo IN_LIST LLVM_CONFIGURATION_TYPES)
+set(dotest_args_replacement RelWithDebInfo)
+  elseif(Release IN_LIST LLVM_CONFIGURATION_TYPES)
+set(dotest_args_replacement Release)
+  else()
+list(GET LLVM_CONFIGURATION_TYPES 0 dotest_args_replacement)
+  endif()
+endif()
+  else()
+# Common case: LLVM used a single-configuration generator like Ninja.
+set(dotest_args_replacement ".")
+  endif()
+endif()
+
+string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
 
-# This will add LLDB's test dependencies to the dependencies for check-all and
-# include them in the test-depends target.
-set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})
+# Configure the API test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)

diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 4bee6ca2d676..d44880e56c42 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -1,8 +1,6 @@
 # Test runner infrastructure for LLDB. This configures the LLDB test trees
 # for use by Lit, and delegates to LLVM's lit test handlers.
 
-add_subdirectory(API)
-
 # Configure and create module cache directories.
 set(LLDB_TEST_MODULE_CACHE_LLDB 
"${LLDB_TEST_BUILD_DIRECTORY}/module-cache-lldb" CACHE PATH "The Clang module 
cache used by the Clang embedded in LLDB while running tests.")
 set(LLDB_TEST_MODULE_CACHE_CLANG 
"${LLDB_TEST_BUILD_DIRECTORY}/module-cache-clang" CACHE PATH "The Clang module 
cache used by the Clang while building tests.")
@@ -16,39 +14,6 @@ else ()
   set(LLVM_BUILD_MODE "%(build_mode)s")
 endif ()
 
-if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-  set(LLDB_IS_64_BITS 1)
-endif()
-
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
-set(dotest_args_replacement ${LLVM_BUILD_MODE})
-
-
-if(LLDB_BUILT_STANDALONE)
-  # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our 
configuration name placeholder.
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-
-  # Remaining ones must be paths to the provided LLVM build-tree.
-  if(LLVM_CONFIGURATION_TYPES)
-# LLDB uses single-config; LLVM multi-config; pick one and prefer Release 
types.
-# Otherwise, if both use multi-config the default is fine.
-if(NOT CMAKE_CONFIGURATION_TYPES)
-  if(RelWithDebInfo IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement RelWithDebInfo)
-  elseif(Release IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement Release)
-  else()
- 

[Lldb-commits] [PATCH] D69394: [CMake] Move specific logic into API, shell and unittest sub-directories.

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0c798aa4483e: [CMake] Split logic across test suite 
subdirectories (NFC) (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69394

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  lldb/test/Unit/CMakeLists.txt

Index: lldb/test/Unit/CMakeLists.txt
===
--- /dev/null
+++ lldb/test/Unit/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Configure the Unit test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+
Index: lldb/test/Shell/CMakeLists.txt
===
--- /dev/null
+++ lldb/test/Shell/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Configure the Shell test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -1,8 +1,6 @@
 # Test runner infrastructure for LLDB. This configures the LLDB test trees
 # for use by Lit, and delegates to LLVM's lit test handlers.
 
-add_subdirectory(API)
-
 # Configure and create module cache directories.
 set(LLDB_TEST_MODULE_CACHE_LLDB "${LLDB_TEST_BUILD_DIRECTORY}/module-cache-lldb" CACHE PATH "The Clang module cache used by the Clang embedded in LLDB while running tests.")
 set(LLDB_TEST_MODULE_CACHE_CLANG "${LLDB_TEST_BUILD_DIRECTORY}/module-cache-clang" CACHE PATH "The Clang module cache used by the Clang while building tests.")
@@ -16,39 +14,6 @@
   set(LLVM_BUILD_MODE "%(build_mode)s")
 endif ()
 
-if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-  set(LLDB_IS_64_BITS 1)
-endif()
-
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
-set(dotest_args_replacement ${LLVM_BUILD_MODE})
-
-
-if(LLDB_BUILT_STANDALONE)
-  # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our configuration name placeholder.
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-
-  # Remaining ones must be paths to the provided LLVM build-tree.
-  if(LLVM_CONFIGURATION_TYPES)
-# LLDB uses single-config; LLVM multi-config; pick one and prefer Release types.
-# Otherwise, if both use multi-config the default is fine.
-if(NOT CMAKE_CONFIGURATION_TYPES)
-  if(RelWithDebInfo IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement RelWithDebInfo)
-  elseif(Release IN_LIST LLVM_CONFIGURATION_TYPES)
-set(dotest_args_replacement Release)
-  else()
-list(GET LLVM_CONFIGURATION_TYPES 0 dotest_args_replacement)
-  endif()
-endif()
-  else()
-# Common case: LLVM used a single-configuration generator like Ninja.
-set(dotest_args_replacement ".")
-  endif()
-endif()
-
-string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 
@@ -64,10 +29,15 @@
   llvm-readobj
   )
 
-# Since llvm-strip is a symlink created by add_custom_target, it
-# doesn't expose an export target when building standalone.
 if(NOT LLDB_BUILT_STANDALONE)
-  add_lldb_test_dependency(llvm-strip)
+  # Since llvm-strip is a symlink created by add_custom_target, it doesn't
+  # expose an export target when building standalone.
+  add_lldb_test_dependency(
+llvm-strip
+FileCheck
+count
+not
+  )
 endif()
 
 if(TARGET lld)
@@ -79,12 +49,8 @@
   endif()
 endif()
 
-if(NOT LLDB_BUILT_STANDALONE)
-  add_lldb_test_dependency(
-FileCheck
-count
-not
-  )
+if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+  set(LLDB_IS_64_BITS 1)
 endif()
 
 # These values are not canonicalized within LLVM.
@@ -94,6 +60,11 @@
   LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
+# Configure the individual test suites.
+add_subdirectory(API)
+add_subdirectory(Shell)
+add_subdirectory(Unit)
+
 # Configure the top level test suite.
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -101,41 +72,13 @@
   MAIN_CONFIG
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
 
-# Configure the Shell test suite.
-configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit.site.cf

[Lldb-commits] [lldb] 267cc32 - [lldb] [Python] Do not attempt to flush() a read-only fd

2019-10-24 Thread Pavel Labath via lldb-commits

Author: Michal Gorny
Date: 2019-10-24T11:29:00-07:00
New Revision: 267cc3292ec4f6a7ea062b3551d20ea4692b6b78

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

LOG: [lldb] [Python] Do not attempt to flush() a read-only fd

Summary:
When creating a FileSP object, do not flush() the underlying file unless
it is open for writing.  Attempting to flush() a read-only fd results
in EBADF on NetBSD.

Reviewers: lawrence_danna, labath, krytarowski

Reviewed By: lawrence_danna, labath

Subscribers: lldb-commits

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

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 70d93424fdec..2b85ebf18c6a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1385,11 +1385,13 @@ llvm::Expected PythonFile::ConvertToFile(bool 
borrowed) {
   if (!options)
 return options.takeError();
 
-  // LLDB and python will not share I/O buffers.  We should probably
-  // flush the python buffers now.
-  auto r = CallMethod("flush");
-  if (!r)
-return r.takeError();
+  if (options.get() & File::eOpenOptionWrite) {
+// LLDB and python will not share I/O buffers.  We should probably
+// flush the python buffers now.
+auto r = CallMethod("flush");
+if (!r)
+  return r.takeError();
+  }
 
   FileSP file_sp;
   if (borrowed) {



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


[Lldb-commits] [PATCH] D69400: [lldb] [Host/netbsd] Include argv[0] in process_info.GetArguments()

2019-10-24 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

Supposedly Arguments shouldn't contain Arg0 
(https://reviews.llvm.org/source/llvm-github/browse/master/lldb/include/lldb/Utility/ProcessInfo.h$96)
I think you just need to change the dump method that prints to platform process 
list.

I don't know if NetBSD is doing something different, but the general dump 
method for ProcessInfo prints first arg0 and then the other args 
https://reviews.llvm.org/source/llvm-github/browse/master/lldb/source/Utility/ProcessInfo.cpp$229-235


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

https://reviews.llvm.org/D69400



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


[Lldb-commits] [PATCH] D69320: [lldb] [Python] Do not attempt to flush() a read-only fd

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG267cc3292ec4: [lldb] [Python] Do not attempt to flush() a 
read-only fd (authored by mgorny, committed by labath).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69320

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1385,11 +1385,13 @@
   if (!options)
 return options.takeError();
 
-  // LLDB and python will not share I/O buffers.  We should probably
-  // flush the python buffers now.
-  auto r = CallMethod("flush");
-  if (!r)
-return r.takeError();
+  if (options.get() & File::eOpenOptionWrite) {
+// LLDB and python will not share I/O buffers.  We should probably
+// flush the python buffers now.
+auto r = CallMethod("flush");
+if (!r)
+  return r.takeError();
+  }
 
   FileSP file_sp;
   if (borrowed) {


Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1385,11 +1385,13 @@
   if (!options)
 return options.takeError();
 
-  // LLDB and python will not share I/O buffers.  We should probably
-  // flush the python buffers now.
-  auto r = CallMethod("flush");
-  if (!r)
-return r.takeError();
+  if (options.get() & File::eOpenOptionWrite) {
+// LLDB and python will not share I/O buffers.  We should probably
+// flush the python buffers now.
+auto r = CallMethod("flush");
+if (!r)
+  return r.takeError();
+  }
 
   FileSP file_sp;
   if (borrowed) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-24 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In D69230#1720048 , @labath wrote:

> In D69230#1718191 , @lawrence_danna 
> wrote:
>
> > Seems like there's a consensus that if we have something like this it 
> > should be called `DenseOptional`, and changes to `Optional` should only 
> > make it more like `std::optional`
>
>
> I am not sure I would call that a "consensus"  -- my interpretation of 
> @dblaikie's comment is that he does not want an extra dense optional type 
> either. Which I disagree with, because I think it would be useful to have 
> some form of a compressed optional storage, as that's something that is 
> currently often implemented via bitfields, magic invalid values, etc.


Open to disagreement - I don't feel super strongly. Though if we're going to 
diverge from std::optional & have functionality like this - maybe, yeah, we 
just rename what we have to "DenseOptional" and use it everywhere. Maybe not 
even rename it? Maybe we just accept our Optional will be different/better (for 
us) than the standard one indefinitely?

> That said, I think you have convinced me that having different optional 
> representations for a single type is not a good idea. It's probably better to 
> use some form of a "strong" typedef to achieve that instead.

I've not followed this part of the thread properly - could you/someone rephrase 
the concerns here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69230



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


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D69230#1720246 , @dblaikie wrote:

> In D69230#1720048 , @labath wrote:
>
> > That said, I think you have convinced me that having different optional 
> > representations for a single type is not a good idea. It's probably better 
> > to use some form of a "strong" typedef to achieve that instead.
>
>
> I've not followed this part of the thread properly - could you/someone 
> rephrase the concerns here?


Sure. lldb currently has types like lldb::pid_t, and uses identifiers like 
LLDB_INVALID_PID for the "None" value. I wanted to define pid_t as something 
like `Optional`, where PIDInfo would specify what 
is the representation of an "invalid" pid. The reason I abandoned this idea was 
that this arrangement makes it impossible to represent (in the type system) a 
pid which is always valid. I now think that it would be better (at least for 
this use case) to have `pid_t be a "strong" typedef of the integer type. At 
that point you can specify an "invalid" value for this type even without a 
separate Optional template argument...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69230



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


[Lldb-commits] [PATCH] D69400: [lldb] [Host/netbsd] Include argv[0] in process_info.GetArguments()

2019-10-24 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Hmm, I think I see how it's supposed to work. I'm going to update the patch 
after I test it.


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

https://reviews.llvm.org/D69400



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


[Lldb-commits] [PATCH] D69400: [lldb] [Host/netbsd] Set Arg0 for 'platform process list -v'

2019-10-24 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 226309.
mgorny retitled this revision from "[lldb] [Host/netbsd] Include argv[0] in 
process_info.GetArguments()" to "[lldb] [Host/netbsd] Set Arg0 for 'platform 
process list -v'".
mgorny edited the summary of this revision.
mgorny added a comment.

Ok, how does that look instead? ;-)


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

https://reviews.llvm.org/D69400

Files:
  lldb/source/Host/netbsd/Host.cpp


Index: lldb/source/Host/netbsd/Host.cpp
===
--- lldb/source/Host/netbsd/Host.cpp
+++ lldb/source/Host/netbsd/Host.cpp
@@ -78,6 +78,7 @@
 match_info_ptr->GetProcessInfo().GetName(
 return false;
 
+  process_info.SetArg0(cstr);
   Args &proc_args = process_info.GetArguments();
   while (1) {
 const uint8_t *p = data.PeekData(offset, 1);


Index: lldb/source/Host/netbsd/Host.cpp
===
--- lldb/source/Host/netbsd/Host.cpp
+++ lldb/source/Host/netbsd/Host.cpp
@@ -78,6 +78,7 @@
 match_info_ptr->GetProcessInfo().GetName(
 return false;
 
+  process_info.SetArg0(cstr);
   Args &proc_args = process_info.GetArguments();
   while (1) {
 const uint8_t *p = data.PeekData(offset, 1);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-24 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In D69230#1720255 , @labath wrote:

> In D69230#1720246 , @dblaikie wrote:
>
> > In D69230#1720048 , @labath wrote:
> >
> > > That said, I think you have convinced me that having different optional 
> > > representations for a single type is not a good idea. It's probably 
> > > better to use some form of a "strong" typedef to achieve that instead.
> >
> >
> > I've not followed this part of the thread properly - could you/someone 
> > rephrase the concerns here?
>
>
> Sure. lldb currently has types like lldb::pid_t, and uses identifiers like 
> LLDB_INVALID_PID for the "None" value. I wanted to define pid_t as something 
> like `Optional`, where PIDInfo would specify what 
> is the representation of an "invalid" pid. The reason I abandoned this idea 
> was that this arrangement makes it impossible to represent (in the type 
> system) a pid which is always valid. I now think that it would be better (at 
> least for this use case) to have `pid_t be a "strong" typedef of the integer 
> type. At that point you can specify an "invalid" value for this type even 
> without a separate Optional template argument...


Ah, thanks - yeah, agreed. The invalid state should always be hidden/non-public 
- though I'm not sure that's quite true for DenseMap/Set/etc - yeah, the 
DenseMapInfo traits use ~0 and ~0-1 as the empty and tombstone values for 
integer types.

So I think we should generalize DenseMapInfo traits (or perhaps build 
DenseMapInfo traits, that need two states, on top of the OptionalInfo trait 
that only needs one) into some generalized "I'd like this many bits of state" & 
yeah, probably a default trait argument to Optional - and, yes, I agree that 
it's generally better to provide a wrapper type that excludes the invalid 
states from being publicly accessible, but I guess folks have found it useful 
to be able to have a DenseSet without worrying too much about the fact 
they can't store the max int in that set (because it's the empty value).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69230



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


[Lldb-commits] [PATCH] D69400: [lldb] [Host/netbsd] Set Arg0 for 'platform process list -v'

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

cool! thanks!!


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

https://reviews.llvm.org/D69400



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


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, teemperor, labath, mgorny.
Herald added a project: LLDB.

CMake allows you to set a custom CXX compiler for the API test suite.
However, this variable is never used, because dotest uses the same
compiler to build C and CXX sources.

I'm not sure if this variable was added with the intention of supporting
a different compiler or if this is just a remnant of old functionality.
Given that this hasn't been working for a while, I assume it's safe to
remove.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D69401

Files:
  lldb/CMakeLists.txt
  lldb/docs/resources/build.rst
  lldb/docs/resources/test.rst
  lldb/test/API/CMakeLists.txt


Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -48,7 +48,7 @@
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -42,8 +42,7 @@
 
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
-compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables.
+compiler, you can set the ``LLDB_TEST_COMPILER`` CMake variable.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -186,8 +186,7 @@
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_C_COMPILER= \
-  -DLLDB_TEST_CXX_COMPILER= \
+  -DLLDB_TEST_COMPILER= \
   
 
 It is strongly recommend to use a release build for the compiler to speed up
@@ -227,7 +226,7 @@
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
+  -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
 
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -91,22 +91,18 @@
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
   if (TARGET clang)
-set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+set(LLDB_DEFAULT_TEST_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
   else()
-set(LLDB_DEFAULT_TEST_C_COMPILER "")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
+set(LLDB_DEFAULT_TEST_COMPILER "")
   endif()
 
   set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
-  set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
-  set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH 
"C++ Compiler to use for building LLDB test inferiors")
+  set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
   set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
   set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH 
"FileCheck used for testing purposes")
 
-  if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
-  ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
-message(FATAL_ERROR "LLDB test compilers not specified. Tests will not 
run.")
+  if ("${LLDB_TEST_COMPILER}" STREQUAL "")
+message(FATAL_ERROR "LLDB test compiler not specified. Tests will not 
run.")
   endif()
 
   add_custom_target(lldb-test-deps)


Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -48,7 +48,7 @@
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -42,8 +42,7 @@
 
 B

[Lldb-commits] [lldb] d0bd3fc - Revert "Disable exit-on-SIGPIPE in lldb"

2019-10-24 Thread Vedant Kumar via lldb-commits

Author: Vedant Kumar
Date: 2019-10-24T13:19:49-07:00
New Revision: d0bd3fc88be54c4e11f49cfa31e427700bb1e9af

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

LOG: Revert "Disable exit-on-SIGPIPE in lldb"

This reverts commit 32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30.

In post-commit review, Pavel pointed out that there's a simpler way to
ignore SIGPIPE in lldb that doesn't rely on llvm's handlers.

Added: 


Modified: 
lldb/tools/driver/Driver.cpp
llvm/include/llvm/Support/Signals.h
llvm/lib/Support/Unix/Signals.inc
llvm/lib/Support/Windows/Signals.inc
llvm/unittests/Support/CMakeLists.txt

Removed: 
llvm/unittests/Support/SignalsTest.cpp



diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 6ab2bd93659f..4a403a7ffb46 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -853,16 +853,6 @@ int main(int argc, char const *argv[])
   signal(SIGCONT, sigcont_handler);
 #endif
 
-  // Occasionally, during test teardown, LLDB writes to a closed pipe.
-  // Sometimes the communication is inherently unreliable, so LLDB tries to
-  // avoid being killed due to SIGPIPE. However, LLVM's default SIGPIPE 
behavior
-  // is to exit with IO_ERR. Opt LLDB out of that.
-  //
-  // We don't disable LLVM's signal handling entirely because we still want
-  // pretty stack traces, and file cleanup (for when, say, the clang embedded
-  // in LLDB leaves behind temporary objects).
-  llvm::sys::SetPipeSignalFunction(nullptr);
-
   int exit_code = 0;
   // Create a scope for driver so that the driver object will destroy itself
   // before SBDebugger::Terminate() is called.

diff  --git a/llvm/include/llvm/Support/Signals.h 
b/llvm/include/llvm/Support/Signals.h
index a4f1fad22dd5..a6b215a24311 100644
--- a/llvm/include/llvm/Support/Signals.h
+++ b/llvm/include/llvm/Support/Signals.h
@@ -84,17 +84,6 @@ namespace sys {
   /// function.  Note also that the handler may be executed on a 
diff erent
   /// thread on some platforms.
   void SetInfoSignalFunction(void (*Handler)());
-
-  /// Registers a function to be called when a "pipe" signal is delivered to
-  /// the process.
-  ///
-  /// The "pipe" signal typically indicates a failed write to a pipe (SIGPIPE).
-  /// The default installed handler calls `exit(EX_IOERR)`, causing the process
-  /// to immediately exit with an IO error exit code.
-  ///
-  /// This function is only applicable on POSIX systems.
-  void SetPipeSignalFunction(void (*Handler)());
-
 } // End sys namespace
 } // End llvm namespace
 

diff  --git a/llvm/lib/Support/Unix/Signals.inc 
b/llvm/lib/Support/Unix/Signals.inc
index 5e0cde4a81ed..be05eabfb2e2 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -82,18 +82,12 @@ using namespace llvm;
 static RETSIGTYPE SignalHandler(int Sig);  // defined below.
 static RETSIGTYPE InfoSignalHandler(int Sig);  // defined below.
 
-static void DefaultPipeSignalFunction() {
-  exit(EX_IOERR);
-}
-
 using SignalHandlerFunctionType = void (*)();
 /// The function to call if ctrl-c is pressed.
 static std::atomic InterruptFunction =
 ATOMIC_VAR_INIT(nullptr);
 static std::atomic InfoSignalFunction =
 ATOMIC_VAR_INIT(nullptr);
-static std::atomic PipeSignalFunction =
-ATOMIC_VAR_INIT(DefaultPipeSignalFunction);
 
 namespace {
 /// Signal-safe removal of files.
@@ -369,8 +363,7 @@ static RETSIGTYPE SignalHandler(int Sig) {
 
   // Send a special return code that drivers can check for, from 
sysexits.h.
   if (Sig == SIGPIPE)
-if (SignalHandlerFunctionType CurrentPipeFunction = PipeSignalFunction)
-  CurrentPipeFunction();
+exit(EX_IOERR);
 
   raise(Sig);   // Execute the default handler.
   return;
@@ -410,11 +403,6 @@ void llvm::sys::SetInfoSignalFunction(void (*Handler)()) {
   RegisterHandlers();
 }
 
-void llvm::sys::SetPipeSignalFunction(void (*Handler)()) {
-  PipeSignalFunction.exchange(Handler);
-  RegisterHandlers();
-}
-
 // The public API
 bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
std::string* ErrMsg) {

diff  --git a/llvm/lib/Support/Windows/Signals.inc 
b/llvm/lib/Support/Windows/Signals.inc
index d962daf79348..6a820ef22b1e 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -560,9 +560,6 @@ void llvm::sys::SetInfoSignalFunction(void (*Handler)()) {
   // Unimplemented.
 }
 
-void llvm::sys::SetPipeSignalFunction(void (*Handler)()) {
-  // Unimplemented.
-}
 
 /// Add a function to be called when a signal is delivered to the process. The
 /// handler can have a cookie passed to it to identify what instance of the

diff  --git a/llvm/unittests/Support/CMakeLists.txt 
b/llvm/unittests/Su

[Lldb-commits] [PATCH] D69148: Disable exit-on-SIGPIPE in lldb

2019-10-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Reverted in d0bd3fc88be 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69148



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


[Lldb-commits] [PATCH] D69403: [Driver] Force llvm to install its handlers before lldb's

2019-10-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk created this revision.
vsk added reviewers: labath, JDevlieghere.
Herald added a reviewer: jfb.

Install llvm's signal handlers up front to prevent lldb's handlers from being
ignored. This is (hopefully) a stopgap workaround.

When lldb invokes an llvm API that installs signal handlers (e.g.
llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within lldb),
lldb's signal handlers are overriden if llvm is installing its handlers for the
first time.

To work around llvm's behavior, force it to install its handlers up front, and
*then* install lldb's handlers. In practice this is used to prevent lldb test
processes from exiting due to IO_ERR when SIGPIPE is received.

Note that when llvm installs its handlers, it 1) records the old handlers it
replaces and 2) re-installs the old handlers when its new handler is invoked.
That means that a signal not explicitly handled by lldb can fall back to being
handled by llvm's handler the first time it is received, and then by the
default handler the second time it is received.


https://reviews.llvm.org/D69403

Files:
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -845,6 +845,25 @@
   }
   SBHostOS::ThreadCreated("");
 
+  // Install llvm's signal handlers up front to prevent lldb's handlers from
+  // being ignored. This is (hopefully) a stopgap workaround.
+  //
+  // When lldb invokes an llvm API that installs signal handlers (e.g.
+  // llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within
+  // lldb), lldb's signal handlers are overriden if llvm is installing its
+  // handlers for the first time.
+  //
+  // To work around llvm's behavior, force it to install its handlers up front,
+  // and *then* install lldb's handlers. In practice this is used to prevent
+  // lldb test processes from exiting due to IO_ERR when SIGPIPE is received.
+  //
+  // Note that when llvm installs its handlers, it 1) records the old handlers
+  // it replaces and 2) re-installs the old handlers when its new handler is
+  // invoked. That means that a signal not explicitly handled by lldb can fall
+  // back to being handled by llvm's handler the first time it is received,
+  // and then by the default handler the second time it is received.
+  llvm::sys::AddSignalHandler([](void *) -> void {}, nullptr);
+
   signal(SIGINT, sigint_handler);
 #if !defined(_MSC_VER)
   signal(SIGPIPE, SIG_IGN);


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -845,6 +845,25 @@
   }
   SBHostOS::ThreadCreated("");
 
+  // Install llvm's signal handlers up front to prevent lldb's handlers from
+  // being ignored. This is (hopefully) a stopgap workaround.
+  //
+  // When lldb invokes an llvm API that installs signal handlers (e.g.
+  // llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within
+  // lldb), lldb's signal handlers are overriden if llvm is installing its
+  // handlers for the first time.
+  //
+  // To work around llvm's behavior, force it to install its handlers up front,
+  // and *then* install lldb's handlers. In practice this is used to prevent
+  // lldb test processes from exiting due to IO_ERR when SIGPIPE is received.
+  //
+  // Note that when llvm installs its handlers, it 1) records the old handlers
+  // it replaces and 2) re-installs the old handlers when its new handler is
+  // invoked. That means that a signal not explicitly handled by lldb can fall
+  // back to being handled by llvm's handler the first time it is received,
+  // and then by the default handler the second time it is received.
+  llvm::sys::AddSignalHandler([](void *) -> void {}, nullptr);
+
   signal(SIGINT, sigint_handler);
 #if !defined(_MSC_VER)
   signal(SIGPIPE, SIG_IGN);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I did a bit of digging and there's more context in 
https://reviews.llvm.org/D39215. It sounds to me like the motivation for the 
two variables isn't relevant anymore, so I still think removing the CXX variant 
is desirable.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69401



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


[Lldb-commits] [PATCH] D69210: [Disassembler] Simplify MCInst predicates

2019-10-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

I don't think it should be necessary to read the class in its entirety to 
understand when `m_opcode` is safe to use. However, as I'm not sure how the 
disassembler is called in to, I don't think it's a good idea to refactor the 
whole thing right away.

Let's start with this simple change to drop some redundant code, and maybe 
revisit things later?


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

https://reviews.llvm.org/D69210



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


[Lldb-commits] [PATCH] D69366: [LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections

2019-10-24 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 226321.
mstorsjo retitled this revision from "[LLDB] [PECOFF] Fix symbols to refer to 
the right section" to "[LLDB] [PECOFF] Use FindSectionByID to associate symbols 
to sections".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Using `FindSectionByID`, added a table header for readability to the test.


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

https://reviews.llvm.org/D69366

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
@@ -0,0 +1,116 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test symbols %t | FileCheck %s
+
+# CHECK: Type File Address/Value {{.*}} SizeFlags   Name
+# CHECK: Code 0x400010000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
+# CHECK:  0x400020000x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 1
+SectionData: C3
+  - Name:.data
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+VirtualAddress:  8192
+VirtualSize: 4
+SectionData: ''
+symbols:
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:.data
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:.bss
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:entry
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+  - Name:variable
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -685,7 +685,7 @@
 symbol.naux = symtab_data.GetU8(&offset);
 symbols[i].GetMangled().SetValue(ConstString(symbol_name.c_str()));
 if ((int16_t)symbol.sect >= 1) {
-  Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect - 1),
+   

[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 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.

Overall, I think it would be better to just pass the c++ compiler instead of 
having dotest try to guess it from the c compiler name. But, it's easy to 
reintroduce this option once we get to that point.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69401



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


[Lldb-commits] [PATCH] D69403: [Driver] Force llvm to install its handlers before lldb's

2019-10-24 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.
Herald added a subscriber: dexonsmith.

Not ideal, but better than adding a new llvm api, which doesn't even really do 
what we want.


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

https://reviews.llvm.org/D69403



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


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

I thought this option was so that you could specify which compilers to use to 
build from a cache or command line? I don't think you just want to set 
`LLDB_TEST_COMPILER` to `clang` since `clang++` is what is used to compile C++ 
code. Maybe I'm mis-remembering or mistaken here.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69401



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


[Lldb-commits] [PATCH] D69341: [zorg] Port LLDB cmake build factory to git

2019-10-24 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 7 inline comments as done.
labath added a comment.

Thanks for your help Jan. Unfortunately, it looks like I don't know how to 
commit this to zorg. Does anyone know what's the process for that? @gkistanova, 
could you advise?


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

https://reviews.llvm.org/D69341



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


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D69401#1720432 , @xiaobai wrote:

> I thought this option was so that you could specify which compilers to use to 
> build from a cache or command line? I don't think you just want to set 
> `LLDB_TEST_COMPILER` to `clang` since `clang++` is what is used to compile 
> C++ code. Maybe I'm mis-remembering or mistaken here.


Yes, that's indeed the point. However, dotest expects you to set the C compiler 
and then infers the C++ compiler from it, which for clang is just appending 
`++` at the end. I'm sure it must do something sensible for `gcc` as well, as I 
believe people are running the test suite with that compiler.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69401



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


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.

In D69401#1720494 , @JDevlieghere 
wrote:

> In D69401#1720432 , @xiaobai wrote:
>
> > I thought this option was so that you could specify which compilers to use 
> > to build from a cache or command line? I don't think you just want to set 
> > `LLDB_TEST_COMPILER` to `clang` since `clang++` is what is used to compile 
> > C++ code. Maybe I'm mis-remembering or mistaken here.
>
>
> Yes, that's indeed the point. However, dotest expects you to set the C 
> compiler and then infers the C++ compiler from it, which for clang is just 
> appending `++` at the end. I'm sure it must do something sensible for `gcc` 
> as well, as I believe people are running the test suite with that compiler.


Right, I see. I'm not sure I like the inference in dotest, and I assume cl is 
left untouched here (if it's even possible to use cl as the compiler on windows 
for tests). I do like the simplification to the build though so ship it!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69401



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


[Lldb-commits] [lldb] d52b36e - [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-10-24T14:47:07-07:00
New Revision: d52b36e354e94f518985833231375365a7cc334b

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

LOG: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

CMake allows you to set a custom CXX compiler for the API test suite.
However, this variable is never used, because dotest uses the same
compiler to build C and CXX sources.

I'm not sure if this variable was added with the intention of supporting
a different compiler or if this is just a remnant of old functionality.
Given that this hasn't been working for a while, I assume it's safe to
remove.

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

Added: 


Modified: 
lldb/CMakeLists.txt
lldb/docs/resources/build.rst
lldb/docs/resources/test.rst
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 527d087ab87f..588f6f72b795 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -91,22 +91,18 @@ if(LLDB_INCLUDE_TESTS)
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
   if (TARGET clang)
-set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+set(LLDB_DEFAULT_TEST_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
   else()
-set(LLDB_DEFAULT_TEST_C_COMPILER "")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
+set(LLDB_DEFAULT_TEST_COMPILER "")
   endif()
 
   set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
-  set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
-  set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH 
"C++ Compiler to use for building LLDB test inferiors")
+  set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
   set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
   set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH 
"FileCheck used for testing purposes")
 
-  if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
-  ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
-message(FATAL_ERROR "LLDB test compilers not specified. Tests will not 
run.")
+  if ("${LLDB_TEST_COMPILER}" STREQUAL "")
+message(FATAL_ERROR "LLDB test compiler not specified. Tests will not 
run.")
   endif()
 
   add_custom_target(lldb-test-deps)

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index f0a5273cb87f..ec938f41e21c 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -186,8 +186,7 @@ suite.
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_C_COMPILER= \
-  -DLLDB_TEST_CXX_COMPILER= \
+  -DLLDB_TEST_COMPILER= \
   
 
 It is strongly recommend to use a release build for the compiler to speed up
@@ -227,7 +226,7 @@ Sample command line:
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
+  -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
 

diff  --git a/lldb/docs/resources/test.rst b/lldb/docs/resources/test.rst
index df1f7129e0ac..9966ad12eac2 100644
--- a/lldb/docs/resources/test.rst
+++ b/lldb/docs/resources/test.rst
@@ -42,8 +42,7 @@ target.
 
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a 
diff erent
-compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables.
+compiler, you can set the ``LLDB_TEST_COMPILER`` CMake variable.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable

diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 0708e804f49c..4552e1062d5e 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -48,7 +48,7 @@ list(APPEND LLDB_TEST_COMMON_ARGS
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
h

[Lldb-commits] [lldb] 220cce1 - [CMake] Don't set LLDB_TEST_* in the top-level CMakeLists

2019-10-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-10-24T14:47:07-07:00
New Revision: 220cce1e7274e1d4b015965fad82ccd79d03b305

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

LOG: [CMake] Don't set LLDB_TEST_* in the top-level CMakeLists

All these variables only affect the API tests. Therefore they belong in
test/API/CMakeLists.txt rather than the top-level CMakeLists.txt.

Added: 


Modified: 
lldb/CMakeLists.txt
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 588f6f72b795..31b1d899a94d 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -83,28 +83,6 @@ option(LLDB_INCLUDE_TESTS "Generate build targets for the 
LLDB unit tests." ${LL
 if(LLDB_INCLUDE_TESTS)
   set(LLDB_TEST_BUILD_DIRECTORY 
"${CMAKE_CURRENT_BINARY_DIR}/lldb-test-build.noindex" CACHE PATH "The build 
root for building tests.")
 
-  # Set the path to the default lldb test executable.
-  set(LLDB_DEFAULT_TEST_EXECUTABLE 
"${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}")
-
-  # Set the paths to default llvm tools.
-  set(LLDB_DEFAULT_TEST_DSYMUTIL 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
-  set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
-
-  if (TARGET clang)
-set(LLDB_DEFAULT_TEST_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-  else()
-set(LLDB_DEFAULT_TEST_COMPILER "")
-  endif()
-
-  set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
-  set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
-  set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
-  set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH 
"FileCheck used for testing purposes")
-
-  if ("${LLDB_TEST_COMPILER}" STREQUAL "")
-message(FATAL_ERROR "LLDB test compiler not specified. Tests will not 
run.")
-  endif()
-
   add_custom_target(lldb-test-deps)
   set_target_properties(lldb-test-deps PROPERTIES FOLDER "lldb misc")
   add_lldb_test_dependency(lldb)

diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 4552e1062d5e..1866e31be322 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -44,11 +44,33 @@ set(LLDB_TEST_COMMON_ARGS
   -u CFLAGS
   )
 
+# Set the path to the default lldb test executable.
+set(LLDB_DEFAULT_TEST_EXECUTABLE 
"${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}")
+
+# Set the paths to default llvm tools.
+set(LLDB_DEFAULT_TEST_DSYMUTIL 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
+set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
+
+if (TARGET clang)
+  set(LLDB_DEFAULT_TEST_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
+else()
+  set(LLDB_DEFAULT_TEST_COMPILER "")
+endif()
+
+set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
+set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler 
to use for building LLDB test inferiors")
+set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
+set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH "FileCheck 
used for testing purposes")
+
+if ("${LLDB_TEST_COMPILER}" STREQUAL "")
+  message(FATAL_ERROR "LLDB test compiler not specified. Tests will not run.")
+endif()
+
 list(APPEND LLDB_TEST_COMMON_ARGS
   --executable ${LLDB_TEST_EXECUTABLE}
+  --compiler ${LLDB_TEST_COMPILER}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )



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


[Lldb-commits] [PATCH] D69401: [CMake] Remove unused variable LLDB_TEST_CXX_COMPILER

2019-10-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd52b36e354e9: [CMake] Remove unused variable 
LLDB_TEST_CXX_COMPILER (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69401

Files:
  lldb/CMakeLists.txt
  lldb/docs/resources/build.rst
  lldb/docs/resources/test.rst
  lldb/test/API/CMakeLists.txt


Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -48,7 +48,7 @@
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -42,8 +42,7 @@
 
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
-compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables.
+compiler, you can set the ``LLDB_TEST_COMPILER`` CMake variable.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -186,8 +186,7 @@
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_C_COMPILER= \
-  -DLLDB_TEST_CXX_COMPILER= \
+  -DLLDB_TEST_COMPILER= \
   
 
 It is strongly recommend to use a release build for the compiler to speed up
@@ -227,7 +226,7 @@
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
+  -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
 
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -91,22 +91,18 @@
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
   if (TARGET clang)
-set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+set(LLDB_DEFAULT_TEST_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
   else()
-set(LLDB_DEFAULT_TEST_C_COMPILER "")
-set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
+set(LLDB_DEFAULT_TEST_COMPILER "")
   endif()
 
   set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
-  set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
-  set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH 
"C++ Compiler to use for building LLDB test inferiors")
+  set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
   set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
   set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH 
"FileCheck used for testing purposes")
 
-  if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
-  ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
-message(FATAL_ERROR "LLDB test compilers not specified. Tests will not 
run.")
+  if ("${LLDB_TEST_COMPILER}" STREQUAL "")
+message(FATAL_ERROR "LLDB test compiler not specified. Tests will not 
run.")
   endif()
 
   add_custom_target(lldb-test-deps)


Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -48,7 +48,7 @@
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  --compiler ${LLDB_TEST_COMPILER}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -42,8 +42,7 @@
 
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
-compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables.
+compi

[Lldb-commits] [PATCH] D68961: Add support for DW_AT_export_symbols for anonymous structs

2019-10-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 226349.
shafik added a comment.

-Add test to clarify what we depending wrt to debug info


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

https://reviews.llvm.org/D68961

Files:
  include/lldb/Symbol/ClangASTContext.h
  packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
  packages/Python/lldbsuite/test/python_api/type/main.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Symbol/ClangASTContext.cpp
  test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
  test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp

Index: test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
===
--- /dev/null
+++ test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
@@ -0,0 +1,19 @@
+// Test to verify we are corectly generating anonymous flags when parsing
+// anonymous class and unnamed structs from DWARF to the a clang AST node.
+
+// RUN: %clang++ -g -c -o %t.o %s
+// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
+
+struct A {
+  struct {
+int x;
+  };
+  struct {
+int y;
+  } C;
+} a;
+
+// CHECK: A::(anonymous struct)
+// CHECK: |-DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+// CHECK: A::(anonymous struct)
+// CHECK: |-DefinitionData pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
Index: test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
===
--- /dev/null
+++ test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
@@ -0,0 +1,67 @@
+; This test verifies that we do the right thing with DIFlagExportSymbols which is the new
+; behavioir and without the DIFlagExportSymbols which is the old behavior for the given
+; definitions below.
+;
+;```
+; struct A{
+;   struct {
+;int x;
+;   };
+;   struct {
+;int y;
+;   };
+;   struct {
+;int z;
+;   } unnamed;
+; } a;
+;```
+;
+; RUN: %clang++ -g -c -o %t.o %s
+; RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
+
+%struct.A = type { %struct.anon, %struct.anon.0, %struct.anon.1 }
+%struct.anon = type { i32 }
+%struct.anon.0 = type { i32 }
+%struct.anon.1 = type { i32 }
+
+@a = global %struct.A zeroinitializer, align 4, !dbg !0
+
+!llvm.module.flags = !{!21, !22}
+!llvm.dbg.cu = !{!2}
+!llvm.ident = !{!23}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 11, type: !6, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
+!3 = !DIFile(filename: "anon_old_new.cpp", directory: "/dir")
+!4 = !{}
+!5 = !{!0}
+!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 96, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS1A")
+; CHECK: struct A definition
+!7 = !{!8, !13, !17}
+!8 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !3, line: 2, baseType: !9, size: 32)
+!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 2, size: 32, flags: DIFlagExportSymbols | DIFlagTypePassByValue, elements: !10, identifier: "_ZTSN1AUt_E")
+; Correctly identify an anonymous class with DIFlagExportSymbols
+; CHECK: struct definition
+; CHECK: DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+!10 = !{!11}
+!11 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !9, file: !3, line: 3, baseType: !12, size: 32)
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !3, line: 5, baseType: !14, size: 32, offset: 32)
+!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 5, size: 32, flags: DIFlagTypePassByValue, elements: !15, identifier: "_ZTSN1AUt0_E")
+; Correctly identify an anonymous class without DIFlagExportSymbols
+; This works b/c we have additional checks when we fields to A.
+; CHECK: struct definition
+; CHECK: DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+!15 = !{!16}
+!16 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !14, file: !3, line: 6, baseType: !12, size: 32)
+!17 = !DIDerivedType(tag: DW_TAG_member, name: "unnamed", scope: !6, file: !3, line: 10, baseType: !18, size: 32, offset: 64)
+!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 8, size: 32, flags: DIFlagTypePassByValue, elements: !19, identifier: "_ZTSN1AUt1_E")
+; Correctly identi

[Lldb-commits] [PATCH] D68961: Add support for DW_AT_export_symbols for anonymous structs

2019-10-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I think in this case LLVM IR could be superior to x86 assembler since it is 
much shorter and easier to understand — even if we have to upgrade it from time 
to time. However, since this is explicitly testing for a DWARF feature, should 
we check the dwarfdump output that the attribute we are looking for is actually 
there?




Comment at: test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll:1
+; This test verifies that we do the right thing with DIFlagExportSymbols which 
is the new
+; behavioir and without the DIFlagExportSymbols which is the old behavior for 
the given

aprantl wrote:
> de it from time to time. I think in this case LLVM IR could be superior to 
> x86 assembler since it is much shorter and easier to understand — even if we 
> have to upgrade it from time to time. However, since this is explicitly 
> testing for a DWARF feature, should we check the dwarfdump output that the 
> attribute we are looking for is actually there?
[I don't know what happened to my comment here].


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

https://reviews.llvm.org/D68961



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


[Lldb-commits] [PATCH] D68961: Add support for DW_AT_export_symbols for anonymous structs

2019-10-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.
aprantl added inline comments.



Comment at: test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll:1
+; This test verifies that we do the right thing with DIFlagExportSymbols which 
is the new
+; behavioir and without the DIFlagExportSymbols which is the old behavior for 
the given

de it from time to time. I think in this case LLVM IR could be superior to x86 
assembler since it is much shorter and easier to understand — even if we have 
to upgrade it from time to time. However, since this is explicitly testing for 
a DWARF feature, should we check the dwarfdump output that the attribute we are 
looking for is actually there?


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

https://reviews.llvm.org/D68961



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


[Lldb-commits] [PATCH] D68961: Add support for DW_AT_export_symbols for anonymous structs

2019-10-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 226366.
shafik added a comment.

- Updated test to add dwarfdump test


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

https://reviews.llvm.org/D68961

Files:
  include/lldb/Symbol/ClangASTContext.h
  packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
  packages/Python/lldbsuite/test/python_api/type/main.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Symbol/ClangASTContext.cpp
  test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
  test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp

Index: test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
===
--- /dev/null
+++ test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
@@ -0,0 +1,19 @@
+// Test to verify we are corectly generating anonymous flags when parsing
+// anonymous class and unnamed structs from DWARF to the a clang AST node.
+
+// RUN: %clang++ -g -c -o %t.o %s
+// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
+
+struct A {
+  struct {
+int x;
+  };
+  struct {
+int y;
+  } C;
+} a;
+
+// CHECK: A::(anonymous struct)
+// CHECK: |-DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+// CHECK: A::(anonymous struct)
+// CHECK: |-DefinitionData pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
Index: test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
===
--- /dev/null
+++ test/Shell/SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll
@@ -0,0 +1,77 @@
+; This test verifies that we do the right thing with DIFlagExportSymbols which is the new
+; behavioir and without the DIFlagExportSymbols which is the old behavior for the given
+; definitions below.
+;
+;```
+; struct A{
+;   struct {
+;int x;
+;   };
+;   struct {
+;int y;
+;   };
+;   struct {
+;int z;
+;   } unnamed;
+; } a;
+;```
+;
+; RUN: %clang++ -g -c -o %t.o %s
+; RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
+; RUN: dwarfdump %t.o | FileCheck %s --check-prefix DWARFDUMP
+
+%struct.A = type { %struct.anon, %struct.anon.0, %struct.anon.1 }
+%struct.anon = type { i32 }
+%struct.anon.0 = type { i32 }
+%struct.anon.1 = type { i32 }
+
+@a = global %struct.A zeroinitializer, align 4, !dbg !0
+
+!llvm.module.flags = !{!21, !22}
+!llvm.dbg.cu = !{!2}
+!llvm.ident = !{!23}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 11, type: !6, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
+!3 = !DIFile(filename: "anon_old_new.cpp", directory: "/dir")
+!4 = !{}
+!5 = !{!0}
+!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 96, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS1A")
+; CHECK: struct A definition
+!7 = !{!8, !13, !17}
+!8 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !3, line: 2, baseType: !9, size: 32)
+!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 2, size: 32, flags: DIFlagExportSymbols | DIFlagTypePassByValue, elements: !10, identifier: "_ZTSN1AUt_E")
+; Correctly identify an anonymous class with DIFlagExportSymbols
+; CHECK: struct definition
+; CHECK: DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+!10 = !{!11}
+!11 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !9, file: !3, line: 3, baseType: !12, size: 32)
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !3, line: 5, baseType: !14, size: 32, offset: 32)
+!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 5, size: 32, flags: DIFlagTypePassByValue, elements: !15, identifier: "_ZTSN1AUt0_E")
+; Correctly identify an anonymous class without DIFlagExportSymbols
+; This works b/c we have additional checks when we fields to A.
+; CHECK: struct definition
+; CHECK: DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
+!15 = !{!16}
+!16 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !14, file: !3, line: 6, baseType: !12, size: 32)
+!17 = !DIDerivedType(tag: DW_TAG_member, name: "unnamed", scope: !6, file: !3, line: 10, baseType: !18, size: 32, offset: 64)
+!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 8, size: 32, flags: DIFlagTypePassByValue, elements: !19, iden

[Lldb-commits] [PATCH] D69422: [lldb][Docs] Add extra lldb aliases to gdb->lldb map

2019-10-24 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added reviewers: aprantl, JDevlieghere.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Adds a few more aliases to the lldb translations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69422

Files:
  lldb/docs/use/map.rst

Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -214,7 +214,9 @@

   (lldb) process attach --pid 123
   
-  (lldb) attach -p 123
+  (lldb) pro at -p 123
+  
+  (lldb) attach 123

  
 
@@ -229,6 +231,8 @@
   (lldb) process attach --name a.out
   
   (lldb) pro at -n a.out
+  
+  (lldb) attach a.out

  
 
@@ -472,6 +476,7 @@
   
   (lldb) br s -M main
   
+  (lldb) b -M main

  
 
@@ -505,6 +510,7 @@
   
   (lldb) br s -S count
   
+  (lldb) b -S count

  
  
@@ -521,6 +527,7 @@
   
   (lldb) br s -r regular-expression
   
+  (lldb) rbreak regular-expression

  
 
@@ -590,6 +597,7 @@
   
   (lldb) br l
   
+  (lldb) b

  
 
@@ -745,6 +753,7 @@
   
   (lldb) fr v
   
+  (lldb) v

  
 
@@ -761,6 +770,7 @@
   
   (lldb) fr v -a
   
+  (lldb) v -a

  
 
@@ -777,7 +787,7 @@
   
   (lldb) fr v bar
   
-  (lldb) p bar
+  (lldb) v bar
   

  
@@ -795,6 +805,7 @@
   
   (lldb) fr v -f x bar
   
+  (lldb) v -f x bar

  
 
@@ -1140,10 +1151,12 @@
   (gdb) up


-  (lldb) up
-  
   (lldb) frame select --relative=1
   
+  (lldb) fr s -r1
+  
+  (lldb) up
+  

  
 
@@ -1155,12 +1168,12 @@
   (gdb) down


-  (lldb) down
-  
   (lldb) frame select --relative=-1
   
   (lldb) fr s -r-1
   
+  (lldb) down
+  

  
 
@@ -1179,11 +1192,14 @@
   
   (lldb) fr s -r2
   
+  (lldb) up 2
+  
   
   (lldb) frame select --relative -3
   
   (lldb) fr s -r-3
   
+  (lldb) down 3

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