[Lldb-commits] [lldb] c2c9387 - [LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions

2023-03-13 Thread Weining Lu via lldb-commits

Author: Weining Lu
Date: 2023-03-13T16:23:09+08:00
New Revision: c2c93873d1912a62685818ec9f4e020ee7a1c616

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

LOG: [LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions

Currently ApplyReloctions() deals with different archs' relocation types
together (in a single `switch() {..}`). I think it is incorrect because
different relocation types of different archs may have same enum values.

For example:
`R_LARCH_32` and `R_X86_64_64` are both `1`;
`R_LARCH_64` and `R_X86_64_PC32` are both `2`.

This patch handles each arch in seperate `switch()` to solve the enum
values conflict issue.

And a new test is added for LoongArch64.

Reviewed By: DavidSpickett

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

Added: 
lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml

Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 9131367bf2230..d91b350af6fee 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2593,6 +2593,50 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab 
*symbol_table, user_id_t start_id,
  rel_data, symtab_data, strtab_data);
 }
 
+static void ApplyELF64ABS64Relocation(Symtab *symtab, ELFRelocation &rel,
+  DataExtractor &debug_data,
+  Section *rel_section) {
+  Symbol *symbol = symtab->FindSymbolByID(ELFRelocation::RelocSymbol64(rel));
+  if (symbol) {
+addr_t value = symbol->GetAddressRef().GetFileAddress();
+DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
+// ObjectFileELF creates a WritableDataBuffer in CreateInstance.
+WritableDataBuffer *data_buffer =
+llvm::cast(data_buffer_sp.get());
+uint64_t *dst = reinterpret_cast(
+data_buffer->GetBytes() + rel_section->GetFileOffset() +
+ELFRelocation::RelocOffset64(rel));
+uint64_t val_offset = value + ELFRelocation::RelocAddend64(rel);
+memcpy(dst, &val_offset, sizeof(uint64_t));
+  }
+}
+
+static void ApplyELF64ABS32Relocation(Symtab *symtab, ELFRelocation &rel,
+  DataExtractor &debug_data,
+  Section *rel_section, bool is_signed) {
+  Symbol *symbol = symtab->FindSymbolByID(ELFRelocation::RelocSymbol64(rel));
+  if (symbol) {
+addr_t value = symbol->GetAddressRef().GetFileAddress();
+value += ELFRelocation::RelocAddend32(rel);
+if ((!is_signed && (value > UINT32_MAX)) ||
+(is_signed &&
+ ((int64_t)value > INT32_MAX || (int64_t)value < INT32_MIN))) {
+  Log *log = GetLog(LLDBLog::Modules);
+  LLDB_LOGF(log, "Failed to apply debug info relocations");
+  return;
+}
+uint32_t truncated_addr = (value & 0x);
+DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
+// ObjectFileELF creates a WritableDataBuffer in CreateInstance.
+WritableDataBuffer *data_buffer =
+llvm::cast(data_buffer_sp.get());
+uint32_t *dst = reinterpret_cast(
+data_buffer->GetBytes() + rel_section->GetFileOffset() +
+ELFRelocation::RelocOffset32(rel));
+memcpy(dst, &truncated_addr, sizeof(uint32_t));
+  }
+}
+
 unsigned ObjectFileELF::ApplyRelocations(
 Symtab *symtab, const ELFHeader *hdr, const ELFSectionHeader *rel_hdr,
 const ELFSectionHeader *symtab_hdr, const ELFSectionHeader *debug_hdr,
@@ -2656,55 +2700,50 @@ unsigned ObjectFileELF::ApplyRelocations(
  reloc_type(rel));
   }
 } else {
-  switch (reloc_type(rel)) {
-  case R_AARCH64_ABS64:
-  case R_X86_64_64: {
-symbol = symtab->FindSymbolByID(reloc_symbol(rel));
-if (symbol) {
-  addr_t value = symbol->GetAddressRef().GetFileAddress();
-  DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
-  // ObjectFileELF creates a WritableDataBuffer in CreateInstance.
-  WritableDataBuffer *data_buffer =
-  llvm::cast(data_buffer_sp.get());
-  uint64_t *dst = reinterpret_cast(
-  data_buffer->GetBytes() + rel_section->GetFileOffset() +
-  ELFRelocation::RelocOffset64(rel));
-  uint64_t val_offset = value + ELFRelocation::RelocAddend64(rel);
-  memcpy(dst, &val_offset, sizeof(uint64_t));
+  switch (hdr->e_machine) {
+  case llvm::ELF::EM_AARCH64:
+switch (reloc_type(rel)) {
+case R_AARCH64_ABS64:
+  ApplyELF64ABS64Relocation(symtab, rel, debug_data, rel_section);
+ 

[Lldb-commits] [lldb] 174a38f - [LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64

2023-03-13 Thread Weining Lu via lldb-commits

Author: Weining Lu
Date: 2023-03-13T16:23:10+08:00
New Revision: 174a38f9c3167573e060493b94135cf453d27879

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

LOG: [LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and 
RelocAddend64

According to `/usr/include/elf.h` and 
`lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h`.
For ELF64 relocation, types of `offset` and `addend` should be `elf_addr` and 
`elf_sxword`.

Reviewed By: DavidSpickett

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index d91b350af6fee..6281cfaa121b7 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -116,11 +116,11 @@ class ELFRelocation {
 
   static unsigned RelocOffset32(const ELFRelocation &rel);
 
-  static unsigned RelocOffset64(const ELFRelocation &rel);
+  static elf_addr RelocOffset64(const ELFRelocation &rel);
 
   static unsigned RelocAddend32(const ELFRelocation &rel);
 
-  static unsigned RelocAddend64(const ELFRelocation &rel);
+  static elf_sxword RelocAddend64(const ELFRelocation &rel);
 
   bool IsRela() { return (reloc.is()); }
 
@@ -192,7 +192,7 @@ unsigned ELFRelocation::RelocOffset32(const ELFRelocation 
&rel) {
 return rel.reloc.get()->r_offset;
 }
 
-unsigned ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return rel.reloc.get()->r_offset;
   else
@@ -206,7 +206,7 @@ unsigned ELFRelocation::RelocAddend32(const ELFRelocation 
&rel) {
 return rel.reloc.get()->r_addend;
 }
 
-unsigned ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
+elf_sxword  ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return 0;
   else

diff  --git a/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml 
b/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
index 1be63870343bb..8fcc4d343de63 100644
--- a/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
@@ -6,9 +6,9 @@
 # CHECK:  Name: .debug_info
 # CHECK:  Data:  (
 ## Before relocation:
-##:   
+##:     
 ## After relocation:
-# CHECK-NEXT: : 3412 7856 
+# CHECK-NEXT: : 3412 88776655 44332211 8899AABB CCDDEEFF
 # CHECK-NEXT: )
 
 --- !ELF
@@ -22,7 +22,7 @@ Sections:
 Type:SHT_PROGBITS
   - Name:.debug_info
 Type:SHT_PROGBITS
-Content: 
+Content: 
   - Name:.rela.debug_info
 Type:SHT_RELA
 Info:.debug_info
@@ -34,7 +34,11 @@ Sections:
   - Offset:  0x0004
 Symbol:  .debug_str
 Type:R_LARCH_64
-Addend:  0x5678
+Addend:  0x1122334455667788
+  - Offset:  0x000C
+Symbol:  .debug_str
+Type:R_LARCH_64
+Addend:  0xFFEEDDCCBBAA9988
 Symbols:
   - Name:.debug_str
 Type:STT_SECTION



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


[Lldb-commits] [PATCH] D145462: [LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions

2023-03-13 Thread Lu Weining via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2c93873d191: [LLDB][ObjectFileELF] Support LoongArch64 in 
ApplyReloctions (authored by SixWeining).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145462

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml

Index: lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
@@ -0,0 +1,45 @@
+# RUN: yaml2obj %s -o %t
+# RUN: lldb-test object-file -contents %t | FileCheck %s
+
+## Test that relocations are correctly applied to the .debug_info section on loongarch64.
+
+# CHECK:  Name: .debug_info
+# CHECK:  Data:  (
+## Before relocation:
+##:   
+## After relocation:
+# CHECK-NEXT: : 3412 7856 
+# CHECK-NEXT: )
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_LOONGARCH
+Sections:
+  - Name:.debug_str
+Type:SHT_PROGBITS
+  - Name:.debug_info
+Type:SHT_PROGBITS
+Content: 
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Info:.debug_info
+Relocations:
+  - Offset:  0x
+Symbol:  .debug_str
+Type:R_LARCH_32
+Addend:  0x1234
+  - Offset:  0x0004
+Symbol:  .debug_str
+Type:R_LARCH_64
+Addend:  0x5678
+Symbols:
+  - Name:.debug_str
+Type:STT_SECTION
+Section: .debug_str
+  - Name:.debug_info
+Type:STT_SECTION
+Section: .debug_info
+...
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2593,6 +2593,50 @@
  rel_data, symtab_data, strtab_data);
 }
 
+static void ApplyELF64ABS64Relocation(Symtab *symtab, ELFRelocation &rel,
+  DataExtractor &debug_data,
+  Section *rel_section) {
+  Symbol *symbol = symtab->FindSymbolByID(ELFRelocation::RelocSymbol64(rel));
+  if (symbol) {
+addr_t value = symbol->GetAddressRef().GetFileAddress();
+DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
+// ObjectFileELF creates a WritableDataBuffer in CreateInstance.
+WritableDataBuffer *data_buffer =
+llvm::cast(data_buffer_sp.get());
+uint64_t *dst = reinterpret_cast(
+data_buffer->GetBytes() + rel_section->GetFileOffset() +
+ELFRelocation::RelocOffset64(rel));
+uint64_t val_offset = value + ELFRelocation::RelocAddend64(rel);
+memcpy(dst, &val_offset, sizeof(uint64_t));
+  }
+}
+
+static void ApplyELF64ABS32Relocation(Symtab *symtab, ELFRelocation &rel,
+  DataExtractor &debug_data,
+  Section *rel_section, bool is_signed) {
+  Symbol *symbol = symtab->FindSymbolByID(ELFRelocation::RelocSymbol64(rel));
+  if (symbol) {
+addr_t value = symbol->GetAddressRef().GetFileAddress();
+value += ELFRelocation::RelocAddend32(rel);
+if ((!is_signed && (value > UINT32_MAX)) ||
+(is_signed &&
+ ((int64_t)value > INT32_MAX || (int64_t)value < INT32_MIN))) {
+  Log *log = GetLog(LLDBLog::Modules);
+  LLDB_LOGF(log, "Failed to apply debug info relocations");
+  return;
+}
+uint32_t truncated_addr = (value & 0x);
+DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
+// ObjectFileELF creates a WritableDataBuffer in CreateInstance.
+WritableDataBuffer *data_buffer =
+llvm::cast(data_buffer_sp.get());
+uint32_t *dst = reinterpret_cast(
+data_buffer->GetBytes() + rel_section->GetFileOffset() +
+ELFRelocation::RelocOffset32(rel));
+memcpy(dst, &truncated_addr, sizeof(uint32_t));
+  }
+}
+
 unsigned ObjectFileELF::ApplyRelocations(
 Symtab *symtab, const ELFHeader *hdr, const ELFSectionHeader *rel_hdr,
 const ELFSectionHeader *symtab_hdr, const ELFSectionHeader *debug_hdr,
@@ -2656,55 +2700,50 @@
  reloc_type(rel));
   }
 } else {
-  switch (reloc_type(rel)) {
-  case R_AARCH64_ABS64:
-  case R_X86_64_64: {
-symbol = symtab->FindSymbolByID(reloc_symbol(rel));
-if (symbol) {
-  addr_t value = symbol->GetAddressRef().GetFileAddr

[Lldb-commits] [lldb] 27705f4 - [LLDB][ObjectFileELF] Correct the return type of Reloc{Offset, Addend}32

2023-03-13 Thread Weining Lu via lldb-commits

Author: Weining Lu
Date: 2023-03-13T16:23:10+08:00
New Revision: 27705f456a3a03e7c935f7f573c05f742df4f272

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

LOG: [LLDB][ObjectFileELF] Correct the return type of Reloc{Offset,Addend}32

This is a follow up of D145550.

I think Reloc{Type,Symbol}{32,64} can keep unchanged as they are not
directly returning a field of the ELFRel[a] struct.

Reviewed By: DavidSpickett

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 6281cfaa121b7..5b75738e070c3 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -114,11 +114,11 @@ class ELFRelocation {
 
   static unsigned RelocSymbol64(const ELFRelocation &rel);
 
-  static unsigned RelocOffset32(const ELFRelocation &rel);
+  static elf_addr RelocOffset32(const ELFRelocation &rel);
 
   static elf_addr RelocOffset64(const ELFRelocation &rel);
 
-  static unsigned RelocAddend32(const ELFRelocation &rel);
+  static elf_sxword RelocAddend32(const ELFRelocation &rel);
 
   static elf_sxword RelocAddend64(const ELFRelocation &rel);
 
@@ -185,7 +185,7 @@ unsigned ELFRelocation::RelocSymbol64(const ELFRelocation 
&rel) {
 return ELFRela::RelocSymbol64(*rel.reloc.get());
 }
 
-unsigned ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return rel.reloc.get()->r_offset;
   else
@@ -199,7 +199,7 @@ elf_addr ELFRelocation::RelocOffset64(const ELFRelocation 
&rel) {
 return rel.reloc.get()->r_offset;
 }
 
-unsigned ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
+elf_sxword ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return 0;
   else



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


[Lldb-commits] [PATCH] D145571: [LLDB][ObjectFileELF] Correct the return type of Reloc{Offset, Addend}32

2023-03-13 Thread Lu Weining via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG27705f456a3a: [LLDB][ObjectFileELF] Correct the return type 
of Reloc{Offset,Addend}32 (authored by SixWeining).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145571

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -114,11 +114,11 @@
 
   static unsigned RelocSymbol64(const ELFRelocation &rel);
 
-  static unsigned RelocOffset32(const ELFRelocation &rel);
+  static elf_addr RelocOffset32(const ELFRelocation &rel);
 
   static elf_addr RelocOffset64(const ELFRelocation &rel);
 
-  static unsigned RelocAddend32(const ELFRelocation &rel);
+  static elf_sxword RelocAddend32(const ELFRelocation &rel);
 
   static elf_sxword RelocAddend64(const ELFRelocation &rel);
 
@@ -185,7 +185,7 @@
 return ELFRela::RelocSymbol64(*rel.reloc.get());
 }
 
-unsigned ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return rel.reloc.get()->r_offset;
   else
@@ -199,7 +199,7 @@
 return rel.reloc.get()->r_offset;
 }
 
-unsigned ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
+elf_sxword ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return 0;
   else


Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -114,11 +114,11 @@
 
   static unsigned RelocSymbol64(const ELFRelocation &rel);
 
-  static unsigned RelocOffset32(const ELFRelocation &rel);
+  static elf_addr RelocOffset32(const ELFRelocation &rel);
 
   static elf_addr RelocOffset64(const ELFRelocation &rel);
 
-  static unsigned RelocAddend32(const ELFRelocation &rel);
+  static elf_sxword RelocAddend32(const ELFRelocation &rel);
 
   static elf_sxword RelocAddend64(const ELFRelocation &rel);
 
@@ -185,7 +185,7 @@
 return ELFRela::RelocSymbol64(*rel.reloc.get());
 }
 
-unsigned ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return rel.reloc.get()->r_offset;
   else
@@ -199,7 +199,7 @@
 return rel.reloc.get()->r_offset;
 }
 
-unsigned ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
+elf_sxword ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return 0;
   else
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D145550: [LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64

2023-03-13 Thread Lu Weining via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG174a38f9c316: [LLDB][ObjectFileELF] Correct the return type 
of RelocOffset64 and RelocAddend64 (authored by SixWeining).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145550

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml


Index: lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
===
--- lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
+++ lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
@@ -6,9 +6,9 @@
 # CHECK:  Name: .debug_info
 # CHECK:  Data:  (
 ## Before relocation:
-##:   
+##:     
 ## After relocation:
-# CHECK-NEXT: : 3412 7856 
+# CHECK-NEXT: : 3412 88776655 44332211 8899AABB CCDDEEFF
 # CHECK-NEXT: )
 
 --- !ELF
@@ -22,7 +22,7 @@
 Type:SHT_PROGBITS
   - Name:.debug_info
 Type:SHT_PROGBITS
-Content: 
+Content: 
   - Name:.rela.debug_info
 Type:SHT_RELA
 Info:.debug_info
@@ -34,7 +34,11 @@
   - Offset:  0x0004
 Symbol:  .debug_str
 Type:R_LARCH_64
-Addend:  0x5678
+Addend:  0x1122334455667788
+  - Offset:  0x000C
+Symbol:  .debug_str
+Type:R_LARCH_64
+Addend:  0xFFEEDDCCBBAA9988
 Symbols:
   - Name:.debug_str
 Type:STT_SECTION
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -116,11 +116,11 @@
 
   static unsigned RelocOffset32(const ELFRelocation &rel);
 
-  static unsigned RelocOffset64(const ELFRelocation &rel);
+  static elf_addr RelocOffset64(const ELFRelocation &rel);
 
   static unsigned RelocAddend32(const ELFRelocation &rel);
 
-  static unsigned RelocAddend64(const ELFRelocation &rel);
+  static elf_sxword RelocAddend64(const ELFRelocation &rel);
 
   bool IsRela() { return (reloc.is()); }
 
@@ -192,7 +192,7 @@
 return rel.reloc.get()->r_offset;
 }
 
-unsigned ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return rel.reloc.get()->r_offset;
   else
@@ -206,7 +206,7 @@
 return rel.reloc.get()->r_addend;
 }
 
-unsigned ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
+elf_sxword  ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
   if (rel.reloc.is())
 return 0;
   else


Index: lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
===
--- lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
+++ lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
@@ -6,9 +6,9 @@
 # CHECK:  Name: .debug_info
 # CHECK:  Data:  (
 ## Before relocation:
-##:   
+##:     
 ## After relocation:
-# CHECK-NEXT: : 3412 7856 
+# CHECK-NEXT: : 3412 88776655 44332211 8899AABB CCDDEEFF
 # CHECK-NEXT: )
 
 --- !ELF
@@ -22,7 +22,7 @@
 Type:SHT_PROGBITS
   - Name:.debug_info
 Type:SHT_PROGBITS
-Content: 
+Content: 
   - Name:.rela.debug_info
 Type:SHT_RELA
 Info:.debug_info
@@ -34,7 +34,11 @@
   - Offset:  0x0004
 Symbol:  .debug_str
 Type:R_LARCH_64
-Addend:  0x5678
+Addend:  0x1122334455667788
+  - Offset:  0x000C
+Symbol:  .debug_str
+Type:R_LARCH_64
+Addend:  0xFFEEDDCCBBAA9988
 Symbols:
   - Name:.debug_str
 Type:STT_SECTION
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -116,11 +116,11 @@
 
   static unsigned RelocOffset32(const ELFRelocation &rel);
 
-  static unsigned RelocOffset64(const ELFRelocation &rel);
+  static elf_addr RelocOffset64(const

[Lldb-commits] [PATCH] D145580: [lldb] Show register fields using bitfield struct types

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 504583.
DavidSpickett added a comment.

Add an s390x test for big endian byte ordering. Turns out you can fake AArch64
without the backend, but not s390x.

Luckily, s390x is a default backend. So the LE host -> BE target part will be
tested widely. BE to LE, the AArch64 little endian byte order test will cover,
assuming there is an s390x builder out there somewhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145580

Files:
  lldb/include/lldb/Core/DumpRegisterValue.h
  lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
  lldb/include/lldb/Target/RegisterFlags.h
  lldb/source/Commands/CommandObjectRegister.cpp
  lldb/source/Core/DumpRegisterValue.cpp
  lldb/source/DataFormatters/DumpValueObjectOptions.cpp
  lldb/source/DataFormatters/ValueObjectPrinter.cpp
  lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py
  lldb/unittests/Target/RegisterFlagsTest.cpp
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -192,6 +192,12 @@
   omit defaulted template parameters. The full template parameter list can still be
   viewed with ``expr --raw-output``/``frame var --raw-output``. (`D141828 `_)
 
+* LLDB can now display register fields if they are described in target XML sent
+  by a debug server such as ``gdbserver`` (``lldb-server`` does not currently produce
+  this information). Fields are only printed when reading named registers, for
+  example ``register read cpsr``. They are not shown when reading a register set,
+  ``register read -s 0``.
+
 Changes to Sanitizers
 -
 
Index: lldb/unittests/Target/RegisterFlagsTest.cpp
===
--- lldb/unittests/Target/RegisterFlagsTest.cpp
+++ lldb/unittests/Target/RegisterFlagsTest.cpp
@@ -121,3 +121,19 @@
 make_field(20, 21), make_field(12, 19), make_field(8, 11),
 make_field(0, 7)});
 }
+
+TEST(RegisterFieldsTest, ReverseFieldOrder) {
+  // Unchanged
+  RegisterFlags rf("", 4, {make_field(0, 31)});
+  ASSERT_EQ(0x12345678ULL, rf.ReverseFieldOrder(0x12345678));
+
+  // Swap the two halves around.
+  RegisterFlags rf2("", 4, {make_field(16, 31), make_field(0, 15)});
+  ASSERT_EQ(0x56781234ULL, rf2.ReverseFieldOrder(0x12345678));
+
+  // Many small fields.
+  RegisterFlags rf3("", 4,
+{make_field(31, 31), make_field(30, 30), make_field(29, 29),
+ make_field(28, 28)});
+  ASSERT_EQ(0x0005ULL, rf3.ReverseFieldOrder(0xA000));
+}
Index: lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py
===
--- /dev/null
+++ lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py
@@ -0,0 +1,497 @@
+""" Check that register fields found in target XML are properly processed.
+
+These tests make XML out of string substitution. This can lead to some strange
+failures. Check that the final XML is valid and each child is indented more than
+the parent tag.
+"""
+
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+class MultiDocResponder(MockGDBServerResponder):
+# docs is a dictionary of filename -> file content.
+def __init__(self, docs):
+super().__init__()
+self.docs = docs
+
+def qXferRead(self, obj, annex, offset, length):
+try:
+return self.docs[annex], False
+except KeyError:
+return None,
+
+def readRegister(self, regnum):
+return "E01"
+
+def readRegisters(self):
+return ''.join([
+  # Data for all registers requested by the tests below.
+  # 0x7 and 0xE are used because their lsb and msb are opposites, which
+  # is needed for a byte order test.
+  '', # 64 bit x0/r0
+  '', # 32 bit cpsr/fpc
+  '', # 64 bit pc/pswa
+])
+
+class TestXMLRegisterFlags(GDBRemoteTestBase):
+def setup_multidoc_test(self, docs):
+self.server.responder = MultiDocResponder(docs)
+target = self.dbg.CreateTarget('')
+
+if self.TraceOn():
+self.runCmd("log enable gdb-remote packets process")
+self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets process"))
+
+process = self.connect(target)
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), process,
+  [lldb.eStateStopped])
+
+def setup_register_test(self, registers):
+ 

[Lldb-commits] [PATCH] D145580: [lldb] Show register fields using bitfield struct types

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

> If this skip is really needed, then I don't know how many people would 
> exercise an s390x test even if it was added - I don't personally build with 
> that target normally.

This is now resolved. No skip needed for AArch64, but for whatever reason, it 
is needed for s390x.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145580

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


[Lldb-commits] [lldb] a372070 - [lldb] Remove MIPS64 specific signal handling for Linux

2023-03-13 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-03-13T11:50:07Z
New Revision: a372070389a672274ad288cf8fd748d25569a2b8

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

LOG: [lldb] Remove MIPS64 specific signal handling for Linux

MIPS Linux support was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8
so this is no longer needed.

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 9572f617e60d3..9b9dfe5214601 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -294,12 +294,7 @@ void NativeThreadLinux::SetStoppedBySignal(uint32_t signo,
 case SIGBUS:
 case SIGFPE:
 case SIGILL:
-  // In case of MIPS64 target, SI_KERNEL is generated for invalid 64bit
-  // address.
-  const auto reason =
-  (info->si_signo == SIGBUS && info->si_code == SI_KERNEL)
-  ? CrashReason::eInvalidAddress
-  : GetCrashReason(*info);
+  const auto reason = GetCrashReason(*info);
   m_stop_description = GetCrashReasonString(reason, *info);
 
   if (reason == CrashReason::eSyncTagCheckFault) {



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


[Lldb-commits] [lldb] 2dc1d48 - [lldb] Use static instead of anonymous namesapce in CrashReason

2023-03-13 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-03-13T11:57:04Z
New Revision: 2dc1d48a454fd511e42468e427fde49780f352fc

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

LOG: [lldb] Use static instead of anonymous namesapce in CrashReason

As preferred by the llvm guidelines.

Added: 


Modified: 
lldb/source/Plugins/Process/POSIX/CrashReason.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/POSIX/CrashReason.cpp 
b/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
index 30fabc071af6f..31ec03c64bdeb 100644
--- a/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
+++ b/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
@@ -12,17 +12,15 @@
 
 #include 
 
-namespace {
-
-void AppendFaultAddr(std::string &str, lldb::addr_t addr) {
+static void AppendFaultAddr(std::string &str, lldb::addr_t addr) {
   std::stringstream ss;
   ss << " (fault address: 0x" << std::hex << addr << ")";
   str += ss.str();
 }
 
 #if defined(si_lower) && defined(si_upper)
-void AppendBounds(std::string &str, lldb::addr_t lower_bound,
-  lldb::addr_t upper_bound, lldb::addr_t addr) {
+static void AppendBounds(std::string &str, lldb::addr_t lower_bound,
+ lldb::addr_t upper_bound, lldb::addr_t addr) {
   llvm::raw_string_ostream stream(str);
   if ((unsigned long)addr < lower_bound)
 stream << ": lower bound violation ";
@@ -39,7 +37,7 @@ void AppendBounds(std::string &str, lldb::addr_t lower_bound,
 }
 #endif
 
-CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) {
+static CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) {
   assert(info.si_signo == SIGSEGV);
 
   switch (info.si_code) {
@@ -75,7 +73,7 @@ CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) {
   return CrashReason::eInvalidCrashReason;
 }
 
-CrashReason GetCrashReasonForSIGILL(const siginfo_t &info) {
+static CrashReason GetCrashReasonForSIGILL(const siginfo_t &info) {
   assert(info.si_signo == SIGILL);
 
   switch (info.si_code) {
@@ -100,7 +98,7 @@ CrashReason GetCrashReasonForSIGILL(const siginfo_t &info) {
   return CrashReason::eInvalidCrashReason;
 }
 
-CrashReason GetCrashReasonForSIGFPE(const siginfo_t &info) {
+static CrashReason GetCrashReasonForSIGFPE(const siginfo_t &info) {
   assert(info.si_signo == SIGFPE);
 
   switch (info.si_code) {
@@ -125,7 +123,7 @@ CrashReason GetCrashReasonForSIGFPE(const siginfo_t &info) {
   return CrashReason::eInvalidCrashReason;
 }
 
-CrashReason GetCrashReasonForSIGBUS(const siginfo_t &info) {
+static CrashReason GetCrashReasonForSIGBUS(const siginfo_t &info) {
   assert(info.si_signo == SIGBUS);
 
   switch (info.si_code) {
@@ -139,7 +137,6 @@ CrashReason GetCrashReasonForSIGBUS(const siginfo_t &info) {
 
   return CrashReason::eInvalidCrashReason;
 }
-}
 
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;



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


[Lldb-commits] [lldb] b4854e4 - [lldb][docs] Remove mentions of MIPS64 Linux debug

2023-03-13 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-03-13T12:01:31Z
New Revision: b4854e4e86cc934e8d7ba86007edd6e255b11609

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

LOG: [lldb][docs] Remove mentions of MIPS64 Linux debug

This was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8.

Added: 


Modified: 
lldb/docs/index.rst
lldb/docs/status/status.rst

Removed: 




diff  --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 02d446573900a..ad09129ee32b3 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -72,8 +72,7 @@ are welcome:
 * macOS debugging for i386, x86_64 and AArch64
 * iOS, tvOS, and watchOS simulator debugging on i386, x86_64 and AArch64
 * iOS, tvOS, and watchOS device debugging on ARM and AArch64
-* Linux user-space debugging for i386, x86_64, ARM, AArch64, MIPS64, PPC64le,
-  s390x
+* Linux user-space debugging for i386, x86_64, ARM, AArch64, PPC64le, s390x
 * FreeBSD user-space debugging for i386, x86_64, ARM, AArch64, MIPS64, PPC
 * NetBSD user-space debugging for i386 and x86_64
 * Windows user-space debugging for i386, x86_64, ARM and AArch64 (*)

diff  --git a/lldb/docs/status/status.rst b/lldb/docs/status/status.rst
index 5ad19b898b97b..a046c0cf8cae6 100644
--- a/lldb/docs/status/status.rst
+++ b/lldb/docs/status/status.rst
@@ -11,8 +11,8 @@ Linux
 -
 
 LLDB is improving on Linux. Linux is nearing feature completeness with Darwin
-to debug x86_64, i386, ARM, AArch64, IBM POWER (ppc64), IBM Z (s390x), and
-MIPS64 programs. For more details, see the Features by OS section below.
+to debug x86_64, i386, ARM, AArch64, IBM POWER (ppc64), and IBM Z (s390x)
+programs. For more details, see the Features by OS section below.
 
 macOS
 -



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


[Lldb-commits] [PATCH] D144390: [lldb] Send QPassSignals packet on attach, and at start for remote platforms

2023-03-13 Thread Pavel Kosov via Phabricator via lldb-commits
kpdev42 added a comment.

In D144390#4138869 , @DavidSpickett 
wrote:

> What is the practical impact of the bug you are fixing?
>
> I guess it is something like if you set signal handling info, then attach to 
> something, that info is not used. Until you set it again, then it'll be sent 
> and used.

The signal filtering settings can only be changed for an already created 
process, so the bug is that lldb does not send the default settings for remote 
platforms (for example, ignoring of real-time signals inside lldb-server is not 
applied)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144390

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


[Lldb-commits] [PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

2023-03-13 Thread Junchang Liu via Phabricator via lldb-commits
paperchalice added a comment.

Ping.




Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp:56
+  const std::string clang_resource_path =
+  clang::driver::Driver::GetResourcesPath("bin/lldb", CLANG_RESOURCE_DIR);
 

Should be "${CMAKE_INSTALL_BINDIR}/lldb" here, but need another variable in 
`config.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141907

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


[Lldb-commits] [PATCH] D144392: [lldb] Skip signal handlers for ignored signals on lldb-server's side when stepping

2023-03-13 Thread Pavel Kosov via Phabricator via lldb-commits
kpdev42 added a comment.

In D144392#4139001 , @labath wrote:

> I'm afraid you're fixing this at the wrong end. This kind of complex thread 
> control does not belong inside the debug stub.
>
> IIUC, the problematic sequence of events is:
>
> 1. lldb sends a `vCont:s` packet
> 2. lldb-server resumes (PTRACE_SINGLESTEP)
> 3. process immediatelly stops again (without stepping) due to a pending signal
> 4. lldb-server decides to inject the signal and resumes (steps) again
> 5. process stops inside the signal handler
> 6. confusion ensues
>
> If that's the case, then I think the bug is at step 4, specifically in this 
> code:
>
>   // Check if debugger should stop at this signal or just ignore it and resume
>   // the inferior.
>   if (m_signals_to_ignore.contains(signo)) {
>  ResumeThread(thread, thread.GetState(), signo);
>  return;
>   }
>
> I believe we should not be attempting to inject the signal if the thread was 
> stepping. I think we should change this to report the signal to the client 
> and let it figure out what to do. I.e., change this code into something like:
>
>   if (m_signals_to_ignore.contains(signo) && thread.GetState() == 
> eStateRunning) {
>  ResumeThread(thread, eStateRunning, signo);
>  return;
>   }
>   // else report the signal as usual
>
> If that is not enough to fix the bug, then we can figure out what needs to be 
> done on the client. @jingham might have something to say about that.

The full problematic sequence is this:

- current pc is at a breakpoint, user hits continue (or step, etc.)
- `ThreadPlanStepOverBreakpoint` is pushed
- the plan wants `eStateStepping`, so lldb sens a `vCont;s` packet to the 
lldb-server
- lldb-server resumes with `PTRACE_SINGLESTEP`
- process stops due to a (pass=true, stop=false) signal

Then there are two possibilities, depending on signal filtering settings:

1. The signal is ignored (notify=false)
  - lldb-server injects the signal back to the process and resumes (steps again)
2. The signal is not ignored (notify=true)
  - lldb-server sends the stop reason with signal to the lldb client
  - lldb does not care, because it is configured to not stop, so wants to step 
again, sends the packet

After 1. and 2., the events are the same:

- process stops due to stepping into the signal handler, lldb client sees a 
successful step
- `StepOverBreakpoint` plan sees a pc != breakpoint address, thinks its job is 
done, pops off successfuly with an autocontinue
- process resumes, gets out of the handler right back to the breakpoint address
- the breakpoint hits, so the user sees a second breakpoint hit, but the 
instruction under that address was still not executed

Technically, this is correct, because the pc was at a breakpoint, the process 
did execute some instructions and went back to the breakpoint, and the program 
state could have changed. But this is very annoying when a lot of signals are 
received in the background (and the signal is not interesting to the user, as 
it, for example, comes from a low level library, the same reason real-time 
signals are `stop=false` `notify=false` by default right now: 
https://reviews.llvm.org/D12795)

So it does not depend on the signal filtering (it can be configured anyway), 
but the problem I would think is that client does not handle the situation with 
signals while stepping (at least stepping off a breakpoint) properly, and 
lldb-server does not help.

Gdb does this for example:

> GDB optimizes for stepping the mainline code. If a signal that has handle 
> nostop and handle pass set arrives while a stepping command (e.g., stepi, 
> step, next) is in progress, GDB lets the signal handler run and then resumes 
> stepping the mainline code once the signal handler returns. In other words, 
> GDB steps over the signal handler. This prevents signals that you’ve 
> specified as not interesting (with handle nostop) from changing the focus of 
> debugging unexpectedly.

(https://sourceware.org/gdb/onlinedocs/gdb/Signals.html), which seems 
reasonable.

If this logic does not belong in lldb-server, then it could be fixed right 
inside the `StepOverBreakpoint` plan, by enabling the breakpoint being stepped 
over when a signal is received, waiting for it to hit when the potential 
handler has returned, and then trying to step off again. But then doing a 
`step-into` from a line with a breakpoint will step over the signal handler, 
and from a line without a breakpoint will stop inside the handler, if a signal 
is received. Then probably creating a new `ThreadPlan` instead with the same 
logic, executing on top of the plan stack, is the way to go?

Anyway, in my attempts at fixing it on the client side, additionally, for some 
reason the following situation is often triggered:

- process steps onto a breakpoint, but right before executing the instruction 
and actually hitting (the `SIGTRAP` signal) another signal (`stop=false`) is 
delivered
- the process wan

[Lldb-commits] [PATCH] D145940: [lldb] Add test for unavailable registers

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Prior to this the only check was that we did not print
this message when reading registers that should exist.

I thought there was an indentation bug here so I wrote a test
for it. There is not, but we could do with the coverage anyway.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145940

Files:
  lldb/test/API/commands/register/register/TestRegistersUnavailable.py


Index: lldb/test/API/commands/register/register/TestRegistersUnavailable.py
===
--- /dev/null
+++ lldb/test/API/commands/register/register/TestRegistersUnavailable.py
@@ -0,0 +1,57 @@
+""" Check that unavailable registers are reported when reading register 
sets."""
+
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+class MyResponder(MockGDBServerResponder):
+def readRegisters(self):
+return "E01"
+
+def readRegister(self, regnum):
+# Only allow reads of rip.
+if regnum in [0, 1, 2]:
+return "E01"
+return ""
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+  i386:x86-64
+  
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+class TestRegistersUnavailable(GDBRemoteTestBase):
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test_unavailable_registers(self):
+self.server.responder = MyResponder()
+target = self.dbg.CreateTarget('')
+
+if self.TraceOn():
+self.runCmd("log enable gdb-remote packets process")
+self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets process"))
+
+process = self.connect(target)
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), process,
+  [lldb.eStateStopped])
+
+self.expect("register read --all", substrs=[
+"general:\n"
+"   rip = 0x\n"
+"2 registers were unavailable.\n"
+"\n"
+"other:\n"
+"1 registers were unavailable."])


Index: lldb/test/API/commands/register/register/TestRegistersUnavailable.py
===
--- /dev/null
+++ lldb/test/API/commands/register/register/TestRegistersUnavailable.py
@@ -0,0 +1,57 @@
+""" Check that unavailable registers are reported when reading register sets."""
+
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+class MyResponder(MockGDBServerResponder):
+def readRegisters(self):
+return "E01"
+
+def readRegister(self, regnum):
+# Only allow reads of rip.
+if regnum in [0, 1, 2]:
+return "E01"
+return ""
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+  i386:x86-64
+  
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+class TestRegistersUnavailable(GDBRemoteTestBase):
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test_unavailable_registers(self):
+self.server.responder = MyResponder()
+target = self.dbg.CreateTarget('')
+
+if self.TraceOn():
+self.runCmd("log enable gdb-remote packets process")
+self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets process"))
+
+process = self.connect(target)
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), process,
+  [lldb.eStateStopped])
+
+self.expect("register read --all", substrs=[
+"general:\n"
+"   rip = 0x\n"
+"2 registers were unavailable.\n"
+"\n"
+"other:\n"
+"1 registers were unavailable."])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D145940: [lldb] Add test for unavailable registers

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: 
lldb/test/API/commands/register/register/TestRegistersUnavailable.py:57
+"other:\n"
+"1 registers were unavailable."])

The only difference here if you have the x86 backend vs. not, is that there is 
another set after these two. I've checked the test in both configurations and 
it passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145940

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Erich Keane via Phabricator via lldb-commits
erichkeane added a comment.

Patch seems to be missing all the context.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Andrey Ali Khan Bolshakov via Phabricator via lldb-commits
bolshakov-a added a comment.

Sorry! It's my first time using Phabricator. Maybe, the problem occurs because 
I've solved the issue with Arcanist just by means of copy-pasting patches into 
"Update Diff" Web GUI form. Maybe, I should reopen the PR?


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Erich Keane via Phabricator via lldb-commits
erichkeane added a comment.

In D140996#4189452 , @bolshakov-a 
wrote:

> Sorry! It's my first time using Phabricator. Maybe, the problem occurs 
> because I've solved the issue with Arcanist just by means of copy-pasting 
> patches into "Update Diff" Web GUI form. Maybe, I should reopen the PR?

When you generate your patch, you need to use -U99 to make sure you get 
full context.  I typically pipe it to a file (the git diff /git show HEAD), 
then use the upload file version.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Vlad Serebrennikov via Phabricator via lldb-commits
Endill added a comment.

In D140996#4189452 , @bolshakov-a 
wrote:

> Sorry! It's my first time using Phabricator. Maybe, the problem occurs 
> because I've solved the issue with Arcanist just by means of copy-pasting 
> patches into "Update Diff" Web GUI form.

There's nothing wrong with copy-pasting into web GUI form. You just have to 
export the patch with the right options, e.g. `git diff HEAD~1 -U99 > 
mypatch.patch` (more on this here 
).

> Maybe, I should reopen the PR?

You can simply update the review with properly exported patch.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Andrey Ali Khan Bolshakov via Phabricator via lldb-commits
bolshakov-a updated this revision to Diff 504681.
bolshakov-a added a comment.

Update patch with more context.


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

https://reviews.llvm.org/D140996

Files:
  clang-tools-extra/clangd/DumpAST.cpp
  clang-tools-extra/clangd/FindTarget.cpp
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ODRHash.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/TemplateArgumentVisitor.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Index/USRGeneration.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
  clang/test/CodeGenCXX/mangle-ms-templates.cpp
  clang/test/CodeGenCXX/mangle-template.cpp
  clang/test/CodeGenCXX/template-arguments.cpp
  clang/test/Modules/odr_hash.cpp
  clang/test/SemaCXX/warn-bool-conversion.cpp
  clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
  clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CXCursor.cpp
  clang/www/cxx_status.html
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -7311,6 +7311,9 @@
 
   case clang::TemplateArgument::Pack:
 return eTemplateArgumentKindPack;
+
+  case clang::TemplateArgument::UncommonValue:
+return eTemplateArgumentKindUncommonValue;
   }
   llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
 }
Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -834,6 +834,7 @@
   eTemplateArgumentKindExpression,
   eTemplateArgumentKindPack,
   eTemplateArgumentKindNullPtr,
+  eTemplateArgumentKindUncommonValue,
 };
 
 /// Type of match to be performed when looking for a formatter for a data type.
Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1053,13 +1053,21 @@
 
 
 
-  Class types as non-type template parameters
+  Class types as non-type template parameters
   https://wg21.link/p0732r2";>P0732R2
-  Partial
+  Clang 12
+
+ 
+  Generalized non-type template parameters of scalar type
+  https://wg21.link/p1907r1";>P1907R1
+  
+
+  Clang 17 (Partial)
+  Reference type template arguments referring to instantiation-dependent objects and subobjects
+  (i.e. delcared inside a template but neither type- nor value-dependent) aren't fully supported.
+
+  
 
-   
-https://wg21.link/p1907r1";>P1907R1
-  
 
   Destroying operator delete
   https://wg21.link/p0722r3";>P0722R3
Index: clang/tools/libclang/CXCursor.cpp
===
--- clang/tools/libclang/CXCursor.cpp
+++ clang/tools/libclang/CXCursor.cpp
@@ -1463,6 +1463,9 @@
 return CXTemplateArgumentKind_NullPtr;
   case TemplateArgument::Integral:
 return CXTemplateArgumentKind_Integral;
+  case TemplateArgument::UncommonValue:
+// FIXME: Expose these values.
+return CXTemplateArgumentKind_Invalid;
   case TemplateArgument::Template:
 return CXTemplateArgumentKind_Template;
   case TemplateArgument::TemplateExpansion:
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1570,6 +1570,11 @@
   return Visit(MakeCXCursor(E, StmtParent, TU, RegionOfInterest));
 return false;
 
+  case TemplateArgument::UncommonValue:
+if (Expr *E = TAL.getSourceUncommonValueExpression())
+  return Visit(MakeCXCursor(E, StmtParent, TU, RegionOfInterest));
+return false;
+
   case TemplateArgument::NullPtr:
 if (Expr *E = TAL.getSourceNullPtrExpr

[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Andrey Ali Khan Bolshakov via Phabricator via lldb-commits
bolshakov-a added a comment.

It works, thanks!


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D145950: [lldb] Remove MipsLinuxSignals

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added subscribers: atanasyan, jrtc27, arichardson, sdardis.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

Support for Linux MIPS debugging was removed in
ce03a862372a6f36d2fcf80dc80052aa155fcae8 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145950

Files:
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
  lldb/source/Plugins/Process/Utility/MipsLinuxSignals.h
  lldb/source/Target/UnixSignals.cpp
  llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn
@@ -27,7 +27,6 @@
 "LinuxProcMaps.cpp",
 "LinuxSignals.cpp",
 "MemoryTagManagerAArch64MTE.cpp",
-"MipsLinuxSignals.cpp",
 "NativeProcessSoftwareSingleStep.cpp",
 "NativeRegisterContextDBReg_arm64.cpp",
 "NativeRegisterContextDBReg_x86.cpp",
Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -9,7 +9,6 @@
 #include "lldb/Target/UnixSignals.h"
 #include "Plugins/Process/Utility/FreeBSDSignals.h"
 #include "Plugins/Process/Utility/LinuxSignals.h"
-#include "Plugins/Process/Utility/MipsLinuxSignals.h"
 #include "Plugins/Process/Utility/NetBSDSignals.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/ArchSpec.h"
@@ -33,17 +32,8 @@
 lldb::UnixSignalsSP UnixSignals::Create(const ArchSpec &arch) {
   const auto &triple = arch.GetTriple();
   switch (triple.getOS()) {
-  case llvm::Triple::Linux: {
-switch (triple.getArch()) {
-case llvm::Triple::mips:
-case llvm::Triple::mipsel:
-case llvm::Triple::mips64:
-case llvm::Triple::mips64el:
-  return std::make_shared();
-default:
-  return std::make_shared();
-}
-  }
+  case llvm::Triple::Linux:
+return std::make_shared();
   case llvm::Triple::FreeBSD:
   case llvm::Triple::OpenBSD:
 return std::make_shared();
Index: lldb/source/Plugins/Process/Utility/MipsLinuxSignals.h
===
--- lldb/source/Plugins/Process/Utility/MipsLinuxSignals.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//===-- MipsLinuxSignals.h --*- C++
-//-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MIPSLINUXSIGNALS_H
-#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MIPSLINUXSIGNALS_H
-
-#include "lldb/Target/UnixSignals.h"
-
-namespace lldb_private {
-
-/// Linux specific set of Unix signals.
-class MipsLinuxSignals : public UnixSignals {
-public:
-  MipsLinuxSignals();
-
-private:
-  void Reset() override;
-};
-
-} // namespace lldb_private
-
-#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MIPSLINUXSIGNALS_H
Index: lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
===
--- lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//===-- MipsLinuxSignals.cpp --===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "MipsLinuxSignals.h"
-
-using namespace lldb_private;
-
-MipsLinuxSignals::MipsLinuxSignals() : UnixSignals() { Reset(); }
-
-void MipsLinuxSignals::Reset() {
-  m_signals.clear();
-  // clang-format off
-  //SIGNO   NAMESUPPRESS  STOPNOTIFY  DESCRIPTION
-  //==  ==    ==  ==  ===
-  AddSignal(1, "SIGHUP",false,true,   true,   "hangup");
-  AddSignal(2, "SIGINT",true, true,   true,   "interrupt");
-  AddSignal(3, "SIGQUIT",   false,true,   true,   "quit");
-  AddSignal(4, "SIGILL",false,true,   true,   "illegal instruction");
-  AddSignal(5, "SIGTRAP",   true, true,   true,   "trace trap (not reset when caught)");
-  AddSignal(6, "SIGABRT",   false,

[Lldb-commits] [PATCH] D145950: [lldb] Remove MipsLinuxSignals

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: labath.
DavidSpickett added a comment.
Herald added a subscriber: JDevlieghere.

One less set of signals I need to update to merge CrashReason into UnixSignals.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145950

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


[Lldb-commits] [PATCH] D145377: [LLDB] Show sub type of memory tagging SEGV when reading a core file

2023-03-13 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett planned changes to this revision.
DavidSpickett added a comment.

I'm working on merging CrashReason into UnixSignals, so this will either be 
part of, or on top of that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145377

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


[Lldb-commits] [PATCH] D145580: [lldb] Show register fields using bitfield struct types

2023-03-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

This gdb_remote_client test looks real nice with this update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145580

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


[Lldb-commits] [PATCH] D145955: Refactor ObjectFilePlaceholder for sharing

2023-03-13 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan created this revision.
yinghuitan added reviewers: clayborg, labath, jingham, jdoerfert, JDevlieghere, 
kusmour, GeorgeHuyubo.
Herald added a project: All.
yinghuitan requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch refactors PlaceholderObjectFile into ObjectFile plugin directory
so that we can reuse it for other cases like coredump debugging with NT_FILE
notes.

PlaceholderObjectFile is also renamed to ObjectFilePlaceholder to be consistent
with ObjectFile plugin naming convention.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145955

Files:
  lldb/source/Plugins/ObjectFile/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp
  lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h
  lldb/source/Plugins/Process/minidump/CMakeLists.txt
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -34,6 +34,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Threading.h"
 
+#include "Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h"
 #include "Plugins/Process/Utility/StopInfoMachException.h"
 
 #include 
@@ -47,84 +48,6 @@
 
 namespace {
 
-/// A minimal ObjectFile implementation providing a dummy object file for the
-/// cases when the real module binary is not available. This allows the module
-/// to show up in "image list" and symbols to be added to it.
-class PlaceholderObjectFile : public ObjectFile {
-public:
-  PlaceholderObjectFile(const lldb::ModuleSP &module_sp,
-const ModuleSpec &module_spec, lldb::addr_t base,
-lldb::addr_t size)
-  : ObjectFile(module_sp, &module_spec.GetFileSpec(), /*file_offset*/ 0,
-   /*length*/ 0, /*data_sp*/ nullptr, /*data_offset*/ 0),
-m_arch(module_spec.GetArchitecture()), m_uuid(module_spec.GetUUID()),
-m_base(base), m_size(size) {
-m_symtab_up = std::make_unique(this);
-  }
-
-  static ConstString GetStaticPluginName() {
-return ConstString("placeholder");
-  }
-  llvm::StringRef GetPluginName() override {
-return GetStaticPluginName().GetStringRef();
-  }
-  bool ParseHeader() override { return true; }
-  Type CalculateType() override { return eTypeUnknown; }
-  Strata CalculateStrata() override { return eStrataUnknown; }
-  uint32_t GetDependentModules(FileSpecList &file_list) override { return 0; }
-  bool IsExecutable() const override { return false; }
-  ArchSpec GetArchitecture() override { return m_arch; }
-  UUID GetUUID() override { return m_uuid; }
-  void ParseSymtab(lldb_private::Symtab &symtab) override {}
-  bool IsStripped() override { return true; }
-  ByteOrder GetByteOrder() const override { return m_arch.GetByteOrder(); }
-
-  uint32_t GetAddressByteSize() const override {
-return m_arch.GetAddressByteSize();
-  }
-
-  Address GetBaseAddress() override {
-return Address(m_sections_up->GetSectionAtIndex(0), 0);
-  }
-
-  void CreateSections(SectionList &unified_section_list) override {
-m_sections_up = std::make_unique();
-auto section_sp = std::make_shared(
-GetModule(), this, /*sect_id*/ 0, ConstString(".module_image"),
-eSectionTypeOther, m_base, m_size, /*file_offset*/ 0, /*file_size*/ 0,
-/*log2align*/ 0, /*flags*/ 0);
-section_sp->SetPermissions(ePermissionsReadable | ePermissionsExecutable);
-m_sections_up->AddSection(section_sp);
-unified_section_list.AddSection(std::move(section_sp));
-  }
-
-  bool SetLoadAddress(Target &target, addr_t value,
-  bool value_is_offset) override {
-assert(!value_is_offset);
-assert(value == m_base);
-
-// Create sections if they haven't been created already.
-GetModule()->GetSectionList();
-assert(m_sections_up->GetNumSections(0) == 1);
-
-target.GetSectionLoadList().SetSectionLoadAddress(
-m_sections_up->GetSectionAtIndex(0), m_base);
-return true;
-  }
-
-  void Dump(Stream *s) override {
-s->Format("Placeholder object file for {0} loaded at [{1:x}-{2:x})\n",
-  GetFileSpec(), m_base, m_base + m_size);
-  }
-
-  lldb::addr_t GetBaseImageAddress() const { return m_base; }
-private:
-  ArchSpec m_arch;
-  UUID m_uuid;
-  lldb::addr_t m_base;
-  lldb::addr_t m_size;
-};
-
 /// Duplicate the HashElfTextSection() from the breakpad sources.
 ///
 /// Breakpad, a Google crash log reporting tool suite, creates minidump files
@@ -578,12 +501,12 @@
   // Watch out for place holder modules that have different paths, but the
   // same UUID. If the base address is different, create a new module. If
   // we don't th

[Lldb-commits] [PATCH] D145964: [lld] Use installed llvm_gtest in standalone builds

2023-03-13 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added a reviewer: tstellar.
Herald added a project: All.
mgorny requested review of this revision.

Use the installed llvm_gtest library instead of rebuilding it locally
when standalone builds are used.  This change is now required
as otherwise the build fails due to duplicate llvm_gtest target.
This is based on 82169103958583d3320b3a9a1e6542e8d32ef8da 
 in clang.


https://reviews.llvm.org/D145964

Files:
  lld/CMakeLists.txt


Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -75,11 +75,9 @@
 set(LLVM_UTILS_PROVIDED ON)
 set(LLD_TEST_DEPS FileCheck not)
   endif()
-  set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
-  if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
-  AND NOT EXISTS 
${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-  AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
-add_subdirectory(${UNITTEST_DIR} third-party/unittest)
+
+  if (NOT TARGET llvm_gtest)
+message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest 
or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
   endif()
 else()
   # Seek installed Lit.


Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -75,11 +75,9 @@
 set(LLVM_UTILS_PROVIDED ON)
 set(LLD_TEST_DEPS FileCheck not)
   endif()
-  set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
-  if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
-  AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-  AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
-add_subdirectory(${UNITTEST_DIR} third-party/unittest)
+
+  if (NOT TARGET llvm_gtest)
+message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
   endif()
 else()
   # Seek installed Lit.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D145964: [lld] Use installed llvm_gtest in standalone builds

2023-03-13 Thread Tom Stellard via Phabricator via lldb-commits
tstellar accepted this revision.
tstellar added a comment.
This revision is now accepted and ready to land.

LGTM.


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

https://reviews.llvm.org/D145964

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


[Lldb-commits] [PATCH] D145624: [lldb] Make MemoryCache::Read more resilient

2023-03-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Target/Memory.cpp:133-135
+  if (pos != m_L2_cache.end()) {
+return pos->second;
+  }

remove braces for single line if statement per llvm coding guidelines



Comment at: lldb/source/Target/Memory.cpp:210-211
+  DataBufferSP first_cache_line = GetL2CacheLine(cache_line_base_addr, error);
+  uint8_t *dst_buf = (uint8_t *)dst;
+  size_t bytes_left = dst_len;
 

move these two lines below the 2 if statements below that return early?



Comment at: lldb/source/Target/Memory.cpp:245-246
+if (m_invalid_ranges.FindEntryThatContains(cache_line_base_addr)) {
+  error.SetErrorStringWithFormat("memory read failed for 0x%" PRIx64,
+ cache_line_base_addr);
+  return dst_len - bytes_left;

Is this an error here? We already got something from the first read and we are 
just returning partial data, do we need an error? If we fail the first read, 
then this is an error. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145624

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


[Lldb-commits] [PATCH] D142260: Actually report an error when `command script add` is passed a non-existent class

2023-03-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Committed as: 9093f3c39b8fa8ef836c627e1db329cd7349e9bb 
.  I 
forgot to include the "differential revision" line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142260

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


[Lldb-commits] [PATCH] D145964: [lld] Use installed llvm_gtest in standalone builds

2023-03-13 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG56464ba865b7: [lld] Use installed llvm_gtest in standalone 
builds (authored by mgorny).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145964

Files:
  lld/CMakeLists.txt


Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -75,11 +75,9 @@
 set(LLVM_UTILS_PROVIDED ON)
 set(LLD_TEST_DEPS FileCheck not)
   endif()
-  set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
-  if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
-  AND NOT EXISTS 
${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-  AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
-add_subdirectory(${UNITTEST_DIR} third-party/unittest)
+
+  if (NOT TARGET llvm_gtest)
+message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest 
or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
   endif()
 else()
   # Seek installed Lit.


Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -75,11 +75,9 @@
 set(LLVM_UTILS_PROVIDED ON)
 set(LLD_TEST_DEPS FileCheck not)
   endif()
-  set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
-  if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
-  AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
-  AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
-add_subdirectory(${UNITTEST_DIR} third-party/unittest)
+
+  if (NOT TARGET llvm_gtest)
+message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
   endif()
 else()
   # Seek installed Lit.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 46c2e4c - Refactor ObjectFilePlaceholder for sharing

2023-03-13 Thread Jeffrey Tan via lldb-commits

Author: Jeffrey Tan
Date: 2023-03-13T11:09:05-07:00
New Revision: 46c2e4c4f347038179e21e027128f5f2914fb980

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

LOG: Refactor ObjectFilePlaceholder for sharing

This patch refactors PlaceholderObjectFile into ObjectFile plugin directory
so that we can reuse it for other cases like coredump debugging with NT_FILE
notes.

PlaceholderObjectFile is also renamed to ObjectFilePlaceholder to be consistent
with ObjectFile plugin naming convention.

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

Added: 
lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp
lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h

Modified: 
lldb/source/Plugins/ObjectFile/CMakeLists.txt
lldb/source/Plugins/Process/minidump/CMakeLists.txt
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/CMakeLists.txt 
b/lldb/source/Plugins/ObjectFile/CMakeLists.txt
index 5cc1240e0768b..6b5ec86399117 100644
--- a/lldb/source/Plugins/ObjectFile/CMakeLists.txt
+++ b/lldb/source/Plugins/ObjectFile/CMakeLists.txt
@@ -6,4 +6,5 @@ add_subdirectory(Mach-O)
 add_subdirectory(Minidump)
 add_subdirectory(PDB)
 add_subdirectory(PECOFF)
+add_subdirectory(Placeholder)
 add_subdirectory(wasm)

diff  --git a/lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt 
b/lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
new file mode 100644
index 0..d7f8762581016
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_lldb_library(lldbPluginObjectFilePlaceholder PLUGIN
+  ObjectFilePlaceholder.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbSymbol
+lldbTarget
+  LINK_COMPONENTS
+Object
+Support
+  )

diff  --git 
a/lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp 
b/lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp
new file mode 100644
index 0..ec1f3f61892d3
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp
@@ -0,0 +1,70 @@
+//===-- ObjectFilePlaceholder.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ObjectFilePlaceholder.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Target/SectionLoadList.h"
+#include "lldb/Target/Target.h"
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE(ObjectFilePlaceholder)
+
+ObjectFilePlaceholder::ObjectFilePlaceholder(
+const lldb::ModuleSP &module_sp,
+const lldb_private::ModuleSpec &module_spec, lldb::addr_t base,
+lldb::addr_t size)
+: ObjectFile(module_sp, &module_spec.GetFileSpec(), /*file_offset*/ 0,
+ /*length*/ 0, /*data_sp*/ nullptr, /*data_offset*/ 0),
+  m_arch(module_spec.GetArchitecture()), m_uuid(module_spec.GetUUID()),
+  m_base(base), m_size(size) {
+  m_symtab_up = std::make_unique(this);
+}
+
+void ObjectFilePlaceholder::CreateSections(
+lldb_private::SectionList &unified_section_list) {
+  m_sections_up = std::make_unique();
+  auto section_sp = std::make_shared(
+  GetModule(), this, /*sect_id*/ 0,
+  lldb_private::ConstString(".module_image"), eSectionTypeOther, m_base,
+  m_size, /*file_offset*/ 0, /*file_size*/ 0,
+  /*log2align*/ 0, /*flags*/ 0);
+  section_sp->SetPermissions(ePermissionsReadable | ePermissionsExecutable);
+  m_sections_up->AddSection(section_sp);
+  unified_section_list.AddSection(std::move(section_sp));
+}
+
+lldb_private::Address ObjectFilePlaceholder::GetBaseAddress() {
+  return lldb_private::Address(m_sections_up->GetSectionAtIndex(0), 0);
+}
+
+bool ObjectFilePlaceholder::SetLoadAddress(Target &target, addr_t value,
+   bool value_is_offset) {
+  assert(!value_is_offset);
+  assert(value == m_base);
+
+  // Create sections if they haven't been created already.
+  GetModule()->GetSectionList();
+  assert(m_sections_up->GetNumSections(0) == 1);
+
+  target.GetSectionLoadList().SetSectionLoadAddress(
+  m_sections_up->GetSectionAtIndex(0), m_base);
+  return true;
+}
+
+void ObjectFilePlaceholder::Dump(lldb_private::Stream *s) {
+  s->Format("Placeholder object file for {0} loaded at [{1:x}-{2:x})\n",
+GetFileSpec(

[Lldb-commits] [PATCH] D145955: Refactor ObjectFilePlaceholder for sharing

2023-03-13 Thread jeffrey tan via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG46c2e4c4f347: Refactor ObjectFilePlaceholder for sharing 
(authored by yinghuitan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145955

Files:
  lldb/source/Plugins/ObjectFile/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp
  lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h
  lldb/source/Plugins/Process/minidump/CMakeLists.txt
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -34,6 +34,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Threading.h"
 
+#include "Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h"
 #include "Plugins/Process/Utility/StopInfoMachException.h"
 
 #include 
@@ -47,84 +48,6 @@
 
 namespace {
 
-/// A minimal ObjectFile implementation providing a dummy object file for the
-/// cases when the real module binary is not available. This allows the module
-/// to show up in "image list" and symbols to be added to it.
-class PlaceholderObjectFile : public ObjectFile {
-public:
-  PlaceholderObjectFile(const lldb::ModuleSP &module_sp,
-const ModuleSpec &module_spec, lldb::addr_t base,
-lldb::addr_t size)
-  : ObjectFile(module_sp, &module_spec.GetFileSpec(), /*file_offset*/ 0,
-   /*length*/ 0, /*data_sp*/ nullptr, /*data_offset*/ 0),
-m_arch(module_spec.GetArchitecture()), m_uuid(module_spec.GetUUID()),
-m_base(base), m_size(size) {
-m_symtab_up = std::make_unique(this);
-  }
-
-  static ConstString GetStaticPluginName() {
-return ConstString("placeholder");
-  }
-  llvm::StringRef GetPluginName() override {
-return GetStaticPluginName().GetStringRef();
-  }
-  bool ParseHeader() override { return true; }
-  Type CalculateType() override { return eTypeUnknown; }
-  Strata CalculateStrata() override { return eStrataUnknown; }
-  uint32_t GetDependentModules(FileSpecList &file_list) override { return 0; }
-  bool IsExecutable() const override { return false; }
-  ArchSpec GetArchitecture() override { return m_arch; }
-  UUID GetUUID() override { return m_uuid; }
-  void ParseSymtab(lldb_private::Symtab &symtab) override {}
-  bool IsStripped() override { return true; }
-  ByteOrder GetByteOrder() const override { return m_arch.GetByteOrder(); }
-
-  uint32_t GetAddressByteSize() const override {
-return m_arch.GetAddressByteSize();
-  }
-
-  Address GetBaseAddress() override {
-return Address(m_sections_up->GetSectionAtIndex(0), 0);
-  }
-
-  void CreateSections(SectionList &unified_section_list) override {
-m_sections_up = std::make_unique();
-auto section_sp = std::make_shared(
-GetModule(), this, /*sect_id*/ 0, ConstString(".module_image"),
-eSectionTypeOther, m_base, m_size, /*file_offset*/ 0, /*file_size*/ 0,
-/*log2align*/ 0, /*flags*/ 0);
-section_sp->SetPermissions(ePermissionsReadable | ePermissionsExecutable);
-m_sections_up->AddSection(section_sp);
-unified_section_list.AddSection(std::move(section_sp));
-  }
-
-  bool SetLoadAddress(Target &target, addr_t value,
-  bool value_is_offset) override {
-assert(!value_is_offset);
-assert(value == m_base);
-
-// Create sections if they haven't been created already.
-GetModule()->GetSectionList();
-assert(m_sections_up->GetNumSections(0) == 1);
-
-target.GetSectionLoadList().SetSectionLoadAddress(
-m_sections_up->GetSectionAtIndex(0), m_base);
-return true;
-  }
-
-  void Dump(Stream *s) override {
-s->Format("Placeholder object file for {0} loaded at [{1:x}-{2:x})\n",
-  GetFileSpec(), m_base, m_base + m_size);
-  }
-
-  lldb::addr_t GetBaseImageAddress() const { return m_base; }
-private:
-  ArchSpec m_arch;
-  UUID m_uuid;
-  lldb::addr_t m_base;
-  lldb::addr_t m_size;
-};
-
 /// Duplicate the HashElfTextSection() from the breakpad sources.
 ///
 /// Breakpad, a Google crash log reporting tool suite, creates minidump files
@@ -578,12 +501,12 @@
   // Watch out for place holder modules that have different paths, but the
   // same UUID. If the base address is different, create a new module. If
   // we don't then we will end up setting the load address of a different
-  // PlaceholderObjectFile and an assertion will fire.
+  // ObjectFilePlaceholder and an assertion will fire.
   auto *objfile = module_sp->GetObjectFile();
   if (objfile &&
   objfile->GetPluginName() ==
-  PlaceholderObjectFil

[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Erich Keane via Phabricator via lldb-commits
erichkeane added subscribers: eli.friedman, gribozavr2, akyrtzi, gribozavr.
erichkeane added inline comments.



Comment at: clang/include/clang/AST/TemplateBase.h:88
+/// so cannot be dependent.
+UncommonValue,
+

bolshakov-a wrote:
> shafik wrote:
> > erichkeane wrote:
> > > I definitely hate the name here... Just `Value` makes a bit more sense, 
> > > but isn't perfectly accurate.  Perhaps `NonTypeValue`?  But that is a 
> > > little redundant.  `Uncommon` here is just strange and not particularly 
> > > descriptive. 
> > This catch all `UncommonValue` feels artificial. Maybe we need a separate 
> > out the cases into more granular cases like `Float` etc
> @erichkeane, it looks strange, I agree. Even just `CommonValue` sounds better 
> for me (but my English is far from fluent). Maybe, `ArbitraryValue`?
> 
> @shafik, your suggestion would move this PR far enough from the original 
> Richard's commit. And I'd prefer to merge `Declaration`, `Integral`, and 
> `NullPtr` kinds into that is currently called `UncommonValue` rather than to 
> repeat here various `APValue` kinds.
I don't think splitting out the individual cases has all that much value, at 
least until we NEED it.  

As far as a name, what about `StructuralValue`?  P1907 calls the 'type' of that 
A 'structural type'? It isn't perfect, but it at least seems to be somewhat 
defensible with standards language.



Comment at: clang/lib/AST/ItaniumMangle.cpp:4397
+// argument.
+// As proposed in https://github.com/itanium-cxx-abi/cxx-abi/issues/111.
+auto *SNTTPE = cast(E);

aaron.ballman wrote:
> We should get this nailed down. It was proposed in Nov 2020 and the issue is 
> still open. CC @rjmccall 
This definitely needs to happen.  @rjmccall or @eli.friedman ^^ Any idea what 
the actual mangling should be?



Comment at: clang/lib/AST/MicrosoftMangle.cpp:1670
+  case TemplateArgument::UncommonValue:
+if (ValueDecl *D = getAsArrayToPointerDecayedDecl(
+TA.getUncommonValueType(), TA.getAsUncommonValue())) {

bolshakov-a wrote:
> erichkeane wrote:
> > Has microsoft implemented this yet?  Can we see what they chose to do and 
> > make sure we match them? 
> Experimentally, I've made me sure that MSVC produces the same mangled names 
> for the cases provided in the `mangle-ms-templates` test as in the test. But 
> there are problems with references to subobjects: some cases are explicitly 
> unsupported in `mangleTemplateArgValue`, and some cases produce a magled name 
> different from what MSVC does. Should it be fixed in this PR, or may be 
> delayed?
We need to end up doing our best to match the microsoft mangling if at all 
possible, since they own the ABI.  I DEFINITELY would want any followup patch 
to be promised for Clang17 (that is, we don't release Clang17 with this patch 
and NOT that patch), so I'd expect said patch to be available for review before 
this gets committed.

As far as whether it needs to happen in THIS patch, we can perhaps decide based 
on the severity of the break, if you can provide examples (or, if it is split 
into a separate patch, we can use the tests there).



Comment at: clang/lib/AST/TemplateBase.cpp:244
+  else if (const ValueDecl *VD = getAsSimpleValueDeclRef(Ctx, Type, V))
+// FIXME: The Declaration form should expose a const ValueDecl*.
+initFromDeclaration(const_cast(VD), Type, IsDefaulted);

Why can this not happen now?



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

bolshakov-a wrote:
> aaron.ballman wrote:
> > Any particular reason this isn't being handled now?
> I need some guidance here. Which characters are allowed in the USR? Could the 
> mangling algorithm from `CXXNameMangler::mangleValueInTemplateArg` be moved 
> into some common place and reused here?
I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or @gribozavr2 
?) seem to be the ones that touch these files the most?



Comment at: clang/lib/Sema/SemaTemplate.cpp:7944
+  case APValue::Indeterminate:
+// FIXME: Are these values possible?
+  case APValue::LValue:

Rather than this, I'd prefer these all down to the llvm_unreachable below.  If 
we find they are reachable, then we'd be expected to implement them at that 
point.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Erich Keane via Phabricator via lldb-commits
erichkeane added inline comments.



Comment at: clang/www/cxx_status.html:1067
+  Reference type template arguments referring to 
instantiation-dependent objects and subobjects
+  (i.e. delcared inside a template but neither type- nor 
value-dependent) aren't fully supported.
+




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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [lldb] 0ea18a0 - [lldb] Fix lldb code for renaming of OpenCL AVC types.

2023-03-13 Thread Joshua Cranmer via lldb-commits

Author: Joshua Cranmer
Date: 2023-03-13T14:55:01-04:00
New Revision: 0ea18a0d5cbe6d836cae49bfa6ad8d999e6edc61

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

LOG: [lldb] Fix lldb code for renaming of OpenCL AVC types.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 61d7dff2e00b8..1d4d66d6e6dc2 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4990,10 +4990,10 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::OCLIntelSubgroupAVCImeResult:
 case clang::BuiltinType::OCLIntelSubgroupAVCRefResult:
 case clang::BuiltinType::OCLIntelSubgroupAVCSicResult:
-case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
-case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
-case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
-case clang::BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
+case 
clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout:
+case 
clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin:
   break;
 
 // PowerPC -- Matrix Multiply Assist



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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Argyrios Kyrtzidis via Phabricator via lldb-commits
akyrtzi added a subscriber: bnbarham.
akyrtzi added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

erichkeane wrote:
> bolshakov-a wrote:
> > aaron.ballman wrote:
> > > Any particular reason this isn't being handled now?
> > I need some guidance here. Which characters are allowed in the USR? Could 
> > the mangling algorithm from `CXXNameMangler::mangleValueInTemplateArg` be 
> > moved into some common place and reused here?
> I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> @gribozavr2 ?) seem to be the ones that touch these files the most?
Adding @bnbarham to review the `Index` changes.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Ben Barham via Phabricator via lldb-commits
bnbarham added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

akyrtzi wrote:
> erichkeane wrote:
> > bolshakov-a wrote:
> > > aaron.ballman wrote:
> > > > Any particular reason this isn't being handled now?
> > > I need some guidance here. Which characters are allowed in the USR? Could 
> > > the mangling algorithm from `CXXNameMangler::mangleValueInTemplateArg` be 
> > > moved into some common place and reused here?
> > I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> > @gribozavr2 ?) seem to be the ones that touch these files the most?
> Adding @bnbarham to review the `Index` changes.
Just visiting the underlying type seems reasonable, ie. 
`VisitType(Arg.getUncommonValueType());`. If it needed to be differentiated 
between a `TemplateArgument::Type` you could add a prefix character (eg. `U`), 
but that doesn't seem needed to me.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Andrey Ali Khan Bolshakov via Phabricator via lldb-commits
bolshakov-a added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

bnbarham wrote:
> akyrtzi wrote:
> > erichkeane wrote:
> > > bolshakov-a wrote:
> > > > aaron.ballman wrote:
> > > > > Any particular reason this isn't being handled now?
> > > > I need some guidance here. Which characters are allowed in the USR? 
> > > > Could the mangling algorithm from 
> > > > `CXXNameMangler::mangleValueInTemplateArg` be moved into some common 
> > > > place and reused here?
> > > I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> > > @gribozavr2 ?) seem to be the ones that touch these files the most?
> > Adding @bnbarham to review the `Index` changes.
> Just visiting the underlying type seems reasonable, ie. 
> `VisitType(Arg.getUncommonValueType());`. If it needed to be differentiated 
> between a `TemplateArgument::Type` you could add a prefix character (eg. 
> `U`), but that doesn't seem needed to me.
Doesn't the holded value be added so as to distinguish e.g. `Tpl<1.5>` from 
`Tpl<2.5>`?


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [lldb] 9c972a3 - [lldb] Explicitly import json in TestSymbolFileJSON.py

2023-03-13 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2023-03-13T14:48:05-07:00
New Revision: 9c972a3d82f303714be6d4f1485a0dc6642cd5f3

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

LOG: [lldb] Explicitly import json in TestSymbolFileJSON.py

The test was relying on the json module getting imported transitively by
one of its imported modules. Make this less brittle by importing it
explicitly.

Added: 


Modified: 
lldb/test/API/macosx/symbols/TestSymbolFileJSON.py

Removed: 




diff  --git a/lldb/test/API/macosx/symbols/TestSymbolFileJSON.py 
b/lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
index 9c17f07420e91..3b25a3161149b 100644
--- a/lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
+++ b/lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
@@ -4,6 +4,8 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+import json
+
 
 class TargetSymbolsFileJSON(TestBase):
 



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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Ben Barham via Phabricator via lldb-commits
bnbarham added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

bolshakov-a wrote:
> bnbarham wrote:
> > akyrtzi wrote:
> > > erichkeane wrote:
> > > > bolshakov-a wrote:
> > > > > aaron.ballman wrote:
> > > > > > Any particular reason this isn't being handled now?
> > > > > I need some guidance here. Which characters are allowed in the USR? 
> > > > > Could the mangling algorithm from 
> > > > > `CXXNameMangler::mangleValueInTemplateArg` be moved into some common 
> > > > > place and reused here?
> > > > I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> > > > @gribozavr2 ?) seem to be the ones that touch these files the most?
> > > Adding @bnbarham to review the `Index` changes.
> > Just visiting the underlying type seems reasonable, ie. 
> > `VisitType(Arg.getUncommonValueType());`. If it needed to be differentiated 
> > between a `TemplateArgument::Type` you could add a prefix character (eg. 
> > `U`), but that doesn't seem needed to me.
> Doesn't the holded value be added so as to distinguish e.g. `Tpl<1.5>` from 
> `Tpl<2.5>`?
Ah I see, yeah, we would. And there's no USR generation for APValue currently, 
which I assume is why your original question came up.

In general a USR just wants to uniquely identify an entity across compilations 
and isn't as restricted as the mangled name. For basically everything but 
`LValue` it seems like you'd be fine to print the value (for eg. int, float, 
etc), visit the underlying type (array, vector), or the visit the underlying 
decl (struct, union, member pointer). That's almost true for `LValue` as well, 
just with the extra parts that are also added to the ODR hash.

Alternatively, you could also just print the hash from `Profile` with the same 
handling as ODR hash. Worst case we'd accidentally merge specializations, but 
if that's good enough for the ODR hash it's probably good enough here as well.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D145295: [lldb] Move ScriptedProcess private state update to implementation

2023-03-13 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

ping @JDevlieghere @bulbazord


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145295

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Andrey Ali Khan Bolshakov via Phabricator via lldb-commits
bolshakov-a added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

bnbarham wrote:
> bolshakov-a wrote:
> > bnbarham wrote:
> > > akyrtzi wrote:
> > > > erichkeane wrote:
> > > > > bolshakov-a wrote:
> > > > > > aaron.ballman wrote:
> > > > > > > Any particular reason this isn't being handled now?
> > > > > > I need some guidance here. Which characters are allowed in the USR? 
> > > > > > Could the mangling algorithm from 
> > > > > > `CXXNameMangler::mangleValueInTemplateArg` be moved into some 
> > > > > > common place and reused here?
> > > > > I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> > > > > @gribozavr2 ?) seem to be the ones that touch these files the most?
> > > > Adding @bnbarham to review the `Index` changes.
> > > Just visiting the underlying type seems reasonable, ie. 
> > > `VisitType(Arg.getUncommonValueType());`. If it needed to be 
> > > differentiated between a `TemplateArgument::Type` you could add a prefix 
> > > character (eg. `U`), but that doesn't seem needed to me.
> > Doesn't the holded value be added so as to distinguish e.g. `Tpl<1.5>` from 
> > `Tpl<2.5>`?
> Ah I see, yeah, we would. And there's no USR generation for APValue 
> currently, which I assume is why your original question came up.
> 
> In general a USR just wants to uniquely identify an entity across 
> compilations and isn't as restricted as the mangled name. For basically 
> everything but `LValue` it seems like you'd be fine to print the value (for 
> eg. int, float, etc), visit the underlying type (array, vector), or the visit 
> the underlying decl (struct, union, member pointer). That's almost true for 
> `LValue` as well, just with the extra parts that are also added to the ODR 
> hash.
> 
> Alternatively, you could also just print the hash from `Profile` with the 
> same handling as ODR hash. Worst case we'd accidentally merge 
> specializations, but if that's good enough for the ODR hash it's probably 
> good enough here as well.
> it seems like you'd be fine to print the value (for eg. int, float, etc)

I'm in doubt about the dot inside a floating point value representation. Minus 
sign is allowed, as I can see for `TemplateArgument::Integral` case.


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D145296: [lldb/Plugin] Add breakpoint setting support to ScriptedProcesses.

2023-03-13 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

ping @JDevlieghere @jingham


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145296

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


[Lldb-commits] [PATCH] D145297: [lldb] Add an example of interactive scripted process debugging (NFC)

2023-03-13 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

ping @JDevlieghere @jingham @labath


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145297

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


[Lldb-commits] [PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

2023-03-13 Thread Ben Barham via Phabricator via lldb-commits
bnbarham added inline comments.



Comment at: clang/lib/Index/USRGeneration.cpp:1032
+  case TemplateArgument::UncommonValue:
+// FIXME: Visit value.
+break;

bolshakov-a wrote:
> bnbarham wrote:
> > bolshakov-a wrote:
> > > bnbarham wrote:
> > > > akyrtzi wrote:
> > > > > erichkeane wrote:
> > > > > > bolshakov-a wrote:
> > > > > > > aaron.ballman wrote:
> > > > > > > > Any particular reason this isn't being handled now?
> > > > > > > I need some guidance here. Which characters are allowed in the 
> > > > > > > USR? Could the mangling algorithm from 
> > > > > > > `CXXNameMangler::mangleValueInTemplateArg` be moved into some 
> > > > > > > common place and reused here?
> > > > > > I have no idea what is valid here.  BUT @akyrtzi and @gribozavr (or 
> > > > > > @gribozavr2 ?) seem to be the ones that touch these files the most?
> > > > > Adding @bnbarham to review the `Index` changes.
> > > > Just visiting the underlying type seems reasonable, ie. 
> > > > `VisitType(Arg.getUncommonValueType());`. If it needed to be 
> > > > differentiated between a `TemplateArgument::Type` you could add a 
> > > > prefix character (eg. `U`), but that doesn't seem needed to me.
> > > Doesn't the holded value be added so as to distinguish e.g. `Tpl<1.5>` 
> > > from `Tpl<2.5>`?
> > Ah I see, yeah, we would. And there's no USR generation for APValue 
> > currently, which I assume is why your original question came up.
> > 
> > In general a USR just wants to uniquely identify an entity across 
> > compilations and isn't as restricted as the mangled name. For basically 
> > everything but `LValue` it seems like you'd be fine to print the value (for 
> > eg. int, float, etc), visit the underlying type (array, vector), or the 
> > visit the underlying decl (struct, union, member pointer). That's almost 
> > true for `LValue` as well, just with the extra parts that are also added to 
> > the ODR hash.
> > 
> > Alternatively, you could also just print the hash from `Profile` with the 
> > same handling as ODR hash. Worst case we'd accidentally merge 
> > specializations, but if that's good enough for the ODR hash it's probably 
> > good enough here as well.
> > it seems like you'd be fine to print the value (for eg. int, float, etc)
> 
> I'm in doubt about the dot inside a floating point value representation. 
> Minus sign is allowed, as I can see for `TemplateArgument::Integral` case.
As long as there's a prefix for APValue and its kind, the dot is fine (eg. 
maybe `@AP@` and then `f` for float, `i` for integer, etc).


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

https://reviews.llvm.org/D140996

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


[Lldb-commits] [PATCH] D145295: [lldb] Move ScriptedProcess private state update to implementation

2023-03-13 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added inline comments.



Comment at: lldb/examples/python/scripted_process/scripted_process.py:166-167
 
-Returns:
-lldb.SBError: An `lldb.SBError` with error code 0.
-"""
-return lldb.SBError()
-
-@abstractmethod
-def should_stop(self):
-""" Check if the scripted process plugin should produce the stop event.
-
-Returns:
-bool: True if scripted process should broadcast a stop event.
-  False otherwise.
-"""
-pass
-
-def stop(self):
-""" Trigger the scripted process stop.
+Args:
+should_stop (bool): If True, resume will also 
 

This seems incomplete?



Comment at: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h:151
+  void ReverseTransform(bool &original_arg,
+python::PythonObject transformed_arg, Status &error) {
+python::PythonBoolean boolean_arg = python::PythonBoolean(

Should we do something with the error here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145295

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


[Lldb-commits] [PATCH] D145294: [lldb/API] Introduce SBProcess::ForceScriptedState method

2023-03-13 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 504871.
mib added a comment.

Remove `private state` occurrences as @jingham suggested.


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

https://reviews.llvm.org/D145294

Files:
  lldb/include/lldb/API/SBProcess.h
  lldb/include/lldb/Target/Process.h
  lldb/source/API/SBProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.h


Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h
===
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -88,6 +88,10 @@
 
   void *GetImplementation() override;
 
+  void ForceScriptedState(lldb::StateType state) override {
+SetPrivateState(state);
+  }
+
 protected:
   ScriptedProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
   const ScriptedMetadata &scripted_metadata, Status &error);
Index: lldb/source/API/SBProcess.cpp
===
--- lldb/source/API/SBProcess.cpp
+++ lldb/source/API/SBProcess.cpp
@@ -466,6 +466,16 @@
   return sb_event;
 }
 
+void SBProcess::ForceScriptedState(StateType new_state) {
+  LLDB_INSTRUMENT_VA(this, new_state);
+
+  if (ProcessSP process_sp = GetSP()) {
+std::lock_guard guard(
+process_sp->GetTarget().GetAPIMutex());
+process_sp->ForceScriptedState(new_state);
+  }
+}
+
 StateType SBProcess::GetState() {
   LLDB_INSTRUMENT_VA(this);
 
Index: lldb/include/lldb/Target/Process.h
===
--- lldb/include/lldb/Target/Process.h
+++ lldb/include/lldb/Target/Process.h
@@ -2544,6 +2544,8 @@
 
   virtual void *GetImplementation() { return nullptr; }
 
+  virtual void ForceScriptedState(lldb::StateType state) {}
+
 protected:
   friend class Trace;
 
Index: lldb/include/lldb/API/SBProcess.h
===
--- lldb/include/lldb/API/SBProcess.h
+++ lldb/include/lldb/API/SBProcess.h
@@ -187,6 +187,14 @@
   ///   The stop event corresponding to stop ID.
   lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
 
+  /// If the process is a scripted process, changes its state to the new state.
+  /// No-op otherwise.
+  ///
+  /// \param [in] new_state
+  ///   The new state that the scripted process should be set to.
+  ///
+  void ForceScriptedState(StateType new_state);
+
   size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
 
   size_t WriteMemory(addr_t addr, const void *buf, size_t size,


Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h
===
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -88,6 +88,10 @@
 
   void *GetImplementation() override;
 
+  void ForceScriptedState(lldb::StateType state) override {
+SetPrivateState(state);
+  }
+
 protected:
   ScriptedProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
   const ScriptedMetadata &scripted_metadata, Status &error);
Index: lldb/source/API/SBProcess.cpp
===
--- lldb/source/API/SBProcess.cpp
+++ lldb/source/API/SBProcess.cpp
@@ -466,6 +466,16 @@
   return sb_event;
 }
 
+void SBProcess::ForceScriptedState(StateType new_state) {
+  LLDB_INSTRUMENT_VA(this, new_state);
+
+  if (ProcessSP process_sp = GetSP()) {
+std::lock_guard guard(
+process_sp->GetTarget().GetAPIMutex());
+process_sp->ForceScriptedState(new_state);
+  }
+}
+
 StateType SBProcess::GetState() {
   LLDB_INSTRUMENT_VA(this);
 
Index: lldb/include/lldb/Target/Process.h
===
--- lldb/include/lldb/Target/Process.h
+++ lldb/include/lldb/Target/Process.h
@@ -2544,6 +2544,8 @@
 
   virtual void *GetImplementation() { return nullptr; }
 
+  virtual void ForceScriptedState(lldb::StateType state) {}
+
 protected:
   friend class Trace;
 
Index: lldb/include/lldb/API/SBProcess.h
===
--- lldb/include/lldb/API/SBProcess.h
+++ lldb/include/lldb/API/SBProcess.h
@@ -187,6 +187,14 @@
   ///   The stop event corresponding to stop ID.
   lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
 
+  /// If the process is a scripted process, changes its state to the new state.
+  /// No-op otherwise.
+  ///
+  /// \param [in] new_state
+  ///   The new state that the scripted process should be set to.
+  ///
+  void ForceScriptedState(StateType new_state);
+
   size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
 
   size_t WriteMemory(addr_t addr, const void *buf, size_t size,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bi

[Lldb-commits] [PATCH] D145624: [lldb] Make MemoryCache::Read more resilient

2023-03-13 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added inline comments.



Comment at: lldb/source/Target/Memory.cpp:245-246
+if (m_invalid_ranges.FindEntryThatContains(cache_line_base_addr)) {
+  error.SetErrorStringWithFormat("memory read failed for 0x%" PRIx64,
+ cache_line_base_addr);
+  return dst_len - bytes_left;

clayborg wrote:
> Is this an error here? We already got something from the first read and we 
> are just returning partial data, do we need an error? If we fail the first 
> read, then this is an error. 
If the second cache line you read is in an invalid range, maybe the user would 
want some feedback about why it was a partial read. It's a detectable 
condition. Maybe we shouldn't set an error string though, idk.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145624

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


[Lldb-commits] [PATCH] D145624: [lldb] Make MemoryCache::Read more resilient

2023-03-13 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 504873.
bulbazord added a comment.

Address small nits from Greg


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145624

Files:
  lldb/include/lldb/Target/Memory.h
  lldb/source/Target/Memory.cpp
  lldb/unittests/Target/CMakeLists.txt
  lldb/unittests/Target/MemoryTest.cpp

Index: lldb/unittests/Target/MemoryTest.cpp
===
--- /dev/null
+++ lldb/unittests/Target/MemoryTest.cpp
@@ -0,0 +1,228 @@
+//===-- MemoryTest.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Target/Memory.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace lldb_private::repro;
+using namespace lldb;
+
+namespace {
+class MemoryTest : public ::testing::Test {
+public:
+  void SetUp() override {
+FileSystem::Initialize();
+HostInfo::Initialize();
+PlatformMacOSX::Initialize();
+  }
+  void TearDown() override {
+PlatformMacOSX::Terminate();
+HostInfo::Terminate();
+FileSystem::Terminate();
+  }
+};
+
+class DummyProcess : public Process {
+public:
+  DummyProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
+  : Process(target_sp, listener_sp), m_bytes_left(0) {}
+
+  // Required overrides
+  bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) override {
+return true;
+  }
+  Status DoDestroy() override { return {}; }
+  void RefreshStateAfterStop() override {}
+  size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+  Status &error) override {
+if (m_bytes_left == 0)
+  return 0;
+
+size_t num_bytes_to_write = size;
+if (m_bytes_left < size) {
+  num_bytes_to_write = m_bytes_left;
+  m_bytes_left = 0;
+} else {
+  m_bytes_left -= size;
+}
+
+memset(buf, 'B', num_bytes_to_write);
+return num_bytes_to_write;
+  }
+  bool DoUpdateThreadList(ThreadList &old_thread_list,
+  ThreadList &new_thread_list) override {
+return false;
+  }
+  llvm::StringRef GetPluginName() override { return "Dummy"; }
+
+  // Test-specific additions
+  size_t m_bytes_left;
+  MemoryCache &GetMemoryCache() { return m_memory_cache; }
+  void SetMaxReadSize(size_t size) { m_bytes_left = size; }
+};
+} // namespace
+
+TargetSP CreateTarget(DebuggerSP &debugger_sp, ArchSpec &arch) {
+  PlatformSP platform_sp;
+  TargetSP target_sp;
+  debugger_sp->GetTargetList().CreateTarget(
+  *debugger_sp, "", arch, eLoadDependentsNo, platform_sp, target_sp);
+  return target_sp;
+}
+
+TEST_F(MemoryTest, TesetMemoryCacheRead) {
+  ArchSpec arch("x86_64-apple-macosx-");
+
+  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+
+  TargetSP target_sp = CreateTarget(debugger_sp, arch);
+  ASSERT_TRUE(target_sp);
+
+  ListenerSP listener_sp(Listener::MakeListener("dummy"));
+  ProcessSP process_sp = std::make_shared(target_sp, listener_sp);
+  ASSERT_TRUE(process_sp);
+
+  DummyProcess *process = static_cast(process_sp.get());
+  MemoryCache &mem_cache = process->GetMemoryCache();
+  const uint64_t l2_cache_size = process->GetMemoryCacheLineSize();
+  Status error;
+  auto data_sp = std::make_shared(l2_cache_size * 2, '\0');
+  size_t bytes_read = 0;
+
+  // Cache empty, memory read fails, size > l2 cache size
+  process->SetMaxReadSize(0);
+  bytes_read = mem_cache.Read(0x1000, data_sp->GetBytes(),
+  data_sp->GetByteSize(), error);
+  ASSERT_TRUE(bytes_read == 0);
+
+  // Cache empty, memory read fails, size <= l2 cache size
+  data_sp->SetByteSize(l2_cache_size);
+  bytes_read = mem_cache.Read(0x1000, data_sp->GetBytes(),
+  data_sp->GetByteSize(), error);
+  ASSERT_TRUE(bytes_read == 0);
+
+  // Cache empty, memory read succeeds, size > l2 cache size
+  process->SetMaxReadSize(l2_cache_size * 4);
+  data_sp->SetByteSize(l2_cache_size * 2);
+  bytes_read = mem_cache.Read(0x1000, data_sp->GetBytes(),
+  data_sp->GetByteSize(), error);
+  ASSERT_TRUE(bytes_read == data_sp->GetByteSize());
+  ASSERT_TRUE(process->m_bytes_left == l2_cache_size * 2)

[Lldb-commits] [PATCH] D145295: [lldb] Move ScriptedProcess private state update to implementation

2023-03-13 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 504877.
mib added a comment.

Address @bulbazord comments.


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

https://reviews.llvm.org/D145295

Files:
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.h
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -113,6 +113,11 @@
 return {object};
   }
 
+  python::PythonObject Transform(bool arg) {
+// Boolean arguments need to be turned into python objects.
+return python::PythonBoolean(arg);
+  }
+
   python::PythonObject Transform(Status arg) {
 return python::ToSWIGWrapper(arg);
   }
@@ -141,6 +146,19 @@
 original_arg = ExtractValueFromPythonObject(transformed_arg, error);
   }
 
+  template <>
+  void ReverseTransform(bool &original_arg,
+python::PythonObject transformed_arg, Status &error) {
+python::PythonBoolean boolean_arg = python::PythonBoolean(
+python::PyRefType::Borrowed, transformed_arg.get());
+if (boolean_arg.IsValid())
+  original_arg = boolean_arg.GetValue();
+else
+  error.SetErrorString(
+  llvm::formatv("{}: Invalid boolean argument.", LLVM_PRETTY_FUNCTION)
+  .str());
+  }
+
   template 
   auto TransformTuple(const std::tuple &args,
   std::index_sequence) {
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
@@ -37,10 +37,6 @@
 
   Status Resume() override;
 
-  bool ShouldStop() override;
-
-  Status Stop() override;
-
   std::optional
   GetMemoryRegionContainingAddress(lldb::addr_t address,
Status &error) override;
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -81,21 +81,8 @@
 }
 
 Status ScriptedProcessPythonInterface::Resume() {
-  return GetStatusFromMethod("resume");
-}
-
-bool ScriptedProcessPythonInterface::ShouldStop() {
-  Status error;
-  StructuredData::ObjectSP obj = Dispatch("is_alive", error);
-
-  if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
-return {};
-
-  return obj->GetBooleanValue();
-}
-
-Status ScriptedProcessPythonInterface::Stop() {
-  return GetStatusFromMethod("stop");
+  // When calling ScriptedProcess.Resume from lldb we should always stop.
+  return GetStatusFromMethod("resume", /*should_stop=*/true);
 }
 
 std::optional
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -201,6 +201,7 @@
 template <>
 struct PythonFormat : PassthroughFormat {};
 template <> struct PythonFormat : PassthroughFormat {};
+template <> struct PythonFormat : PassthroughFormat {};
 template <>
 struct PythonFormat : PassthroughFormat {};
 template <> struct PythonFormat : PassthroughFormat {};
Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h
===
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -96,8 +96,6 @@
   ScriptedProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
   const ScriptedMetadata &scripted_metadata, Status &error);
 
-  Status DoStop();
-
   void Clear();
 
   bool DoUpdateThreadList(ThreadList &old_thread_list,
Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
===
--- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -187,8 +187,6 @@
   if (resume) {
 LLDB_LOGF(log, "ScriptedProcess::%s sendi

[Lldb-commits] [PATCH] D145295: [lldb] Move ScriptedProcess private state update to implementation

2023-03-13 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

No problem from me. Jonas?


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

https://reviews.llvm.org/D145295

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


[Lldb-commits] [PATCH] D145295: [lldb] Move ScriptedProcess private state update to implementation

2023-03-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D145295

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


[Lldb-commits] [PATCH] D145624: [lldb] Make MemoryCache::Read more resilient

2023-03-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM if @clayborg is happy


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145624

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


[Lldb-commits] [PATCH] D142260: Actually report an error when `command script add` is passed a non-existent class

2023-03-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM modulo the else-after-return.




Comment at: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:1949-1950
+new StructuredPythonObject(std::move(ret_val)));
+  else
+return {};
 }

No else after return. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142260

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


[Lldb-commits] [lldb] 93a4553 - [lldb] Remove MIPS Linux UnixSignals

2023-03-13 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-03-13T17:17:47-07:00
New Revision: 93a455375c0fa1dd014a3b4571b22e307d15bbf7

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

LOG: [lldb] Remove MIPS Linux UnixSignals

MIPS Linux support was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Target/UnixSignals.cpp

Removed: 
lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
lldb/source/Plugins/Process/Utility/MipsLinuxSignals.h



diff  --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 912d763ab663..edf4e851b653 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -8,7 +8,6 @@ add_lldb_library(lldbPluginProcessUtility
   LinuxProcMaps.cpp
   LinuxSignals.cpp
   MemoryTagManagerAArch64MTE.cpp
-  MipsLinuxSignals.cpp
   NativeProcessSoftwareSingleStep.cpp
   NativeRegisterContextDBReg_arm64.cpp
   NativeRegisterContextDBReg_x86.cpp

diff  --git a/lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp 
b/lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
deleted file mode 100644
index fb51c56953f8..
--- a/lldb/source/Plugins/Process/Utility/MipsLinuxSignals.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//===-- MipsLinuxSignals.cpp 
--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "MipsLinuxSignals.h"
-
-using namespace lldb_private;
-
-MipsLinuxSignals::MipsLinuxSignals() : UnixSignals() { Reset(); }
-
-void MipsLinuxSignals::Reset() {
-  m_signals.clear();
-  // clang-format off
-  //SIGNO   NAMESUPPRESS  STOPNOTIFY  DESCRIPTION
-  //==  ==    ==  ==  
===
-  AddSignal(1, "SIGHUP",false,true,   true,   "hangup");
-  AddSignal(2, "SIGINT",true, true,   true,   "interrupt");
-  AddSignal(3, "SIGQUIT",   false,true,   true,   "quit");
-  AddSignal(4, "SIGILL",false,true,   true,   "illegal 
instruction");
-  AddSignal(5, "SIGTRAP",   true, true,   true,   "trace trap (not 
reset when caught)");
-  AddSignal(6, "SIGABRT",   false,true,   true,   "abort()/IOT 
trap", "SIGIOT");
-  AddSignal(7, "SIGEMT",false,true,   true,   "terminate 
process with core dump");
-  AddSignal(8, "SIGFPE",false,true,   true,   "floating point 
exception");
-  AddSignal(9, "SIGKILL",   false,true,   true,   "kill");
-  AddSignal(10, "SIGBUS",   false,true,   true,   "bus error");
-  AddSignal(11, "SIGSEGV",  false,true,   true,   "segmentation 
violation");
-  AddSignal(12, "SIGSYS",   false,true,   true,   "invalid system 
call");
-  AddSignal(13, "SIGPIPE",  false,true,   true,   "write to pipe 
with reading end closed");
-  AddSignal(14, "SIGALRM",  false,false,  false,  "alarm");
-  AddSignal(15, "SIGTERM",  false,true,   true,   "termination 
requested");
-  AddSignal(16, "SIGUSR1",  false,true,   true,   "user defined 
signal 1");
-  AddSignal(17, "SIGUSR2",  false,true,   true,   "user defined 
signal 2");
-  AddSignal(18, "SIGCHLD",  false,false,  true,   "child status 
has changed", "SIGCLD");
-  AddSignal(19, "SIGPWR",   false,true,   true,   "power failure");
-  AddSignal(20, "SIGWINCH", false,true,   true,   "window size 
changes");
-  AddSignal(21, "SIGURG",   false,true,   true,   "urgent data on 
socket");
-  AddSignal(22, "SIGIO",false,true,   true,   "input/output 
ready/Pollable event", "SIGPOLL");
-  AddSignal(23, "SIGSTOP",  true, true,   true,   "process stop");
-  AddSignal(24, "SIGTSTP",  false,true,   true,   "tty stop");
-  AddSignal(25, "SIGCONT",  false,false,  true,   "process 
continue");
-  AddSignal(26, "SIGTTIN",  false,true,   true,   "background tty 
read");
-  AddSignal(27, "SIGTTOU",  false,true,   true,   "background tty 
write");
-  AddSignal(28, "SIGVTALRM",false,true,   true,   "virtual time 
alarm");
-  AddSignal(29, "SIGPROF",  false,false,  false,  "profiling time 
alarm");
-  AddSignal(30, "SIGXCPU",  false,true,   true,   "CPU resource 
exce

[Lldb-commits] [PATCH] D145294: [lldb/API] Introduce SBProcess::ForceScriptedState method

2023-03-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D145294

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