[Lldb-commits] [PATCH] D86355: Instantiate Error in Target::GetEntryPointAddress() only when necessary

2020-08-22 Thread Dimitry Andric 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 rG1ce07cd614be: Instantiate Error in 
Target::GetEntryPointAddress() only when necessary (authored by dim).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86355

Files:
  lldb/source/Target/Target.cpp


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2407,21 +2407,13 @@
 
 llvm::Expected Target::GetEntryPointAddress() {
   Module *exe_module = GetExecutableModulePointer();
-  llvm::Error error = llvm::Error::success();
-  assert(!error); // Check the success value when assertions are enabled.
 
-  if (!exe_module || !exe_module->GetObjectFile()) {
-error = llvm::make_error("No primary executable found",
-
llvm::inconvertibleErrorCode());
-  } else {
+  // Try to find the entry point address in the primary executable.
+  const bool has_primary_executable = exe_module && 
exe_module->GetObjectFile();
+  if (has_primary_executable) {
 Address entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
 if (entry_addr.IsValid())
   return entry_addr;
-
-error = llvm::make_error(
-"Could not find entry point address for executable module \"" +
-exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
-llvm::inconvertibleErrorCode());
   }
 
   const ModuleList &modules = GetImages();
@@ -2432,14 +2424,21 @@
   continue;
 
 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
-if (entry_addr.IsValid()) {
-  // Discard the error.
-  llvm::consumeError(std::move(error));
+if (entry_addr.IsValid())
   return entry_addr;
-}
   }
 
-  return std::move(error);
+  // We haven't found the entry point address. Return an appropriate error.
+  if (!has_primary_executable)
+return llvm::make_error(
+"No primary executable found and could not find entry point address in 
"
+"any executable module",
+llvm::inconvertibleErrorCode());
+
+  return llvm::make_error(
+  "Could not find entry point address for primary executable module \"" +
+  exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
+  llvm::inconvertibleErrorCode());
 }
 
 lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2407,21 +2407,13 @@
 
 llvm::Expected Target::GetEntryPointAddress() {
   Module *exe_module = GetExecutableModulePointer();
-  llvm::Error error = llvm::Error::success();
-  assert(!error); // Check the success value when assertions are enabled.
 
-  if (!exe_module || !exe_module->GetObjectFile()) {
-error = llvm::make_error("No primary executable found",
-llvm::inconvertibleErrorCode());
-  } else {
+  // Try to find the entry point address in the primary executable.
+  const bool has_primary_executable = exe_module && exe_module->GetObjectFile();
+  if (has_primary_executable) {
 Address entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
 if (entry_addr.IsValid())
   return entry_addr;
-
-error = llvm::make_error(
-"Could not find entry point address for executable module \"" +
-exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
-llvm::inconvertibleErrorCode());
   }
 
   const ModuleList &modules = GetImages();
@@ -2432,14 +2424,21 @@
   continue;
 
 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
-if (entry_addr.IsValid()) {
-  // Discard the error.
-  llvm::consumeError(std::move(error));
+if (entry_addr.IsValid())
   return entry_addr;
-}
   }
 
-  return std::move(error);
+  // We haven't found the entry point address. Return an appropriate error.
+  if (!has_primary_executable)
+return llvm::make_error(
+"No primary executable found and could not find entry point address in "
+"any executable module",
+llvm::inconvertibleErrorCode());
+
+  return llvm::make_error(
+  "Could not find entry point address for primary executable module \"" +
+  exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
+  llvm::inconvertibleErrorCode());
 }
 
 lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1ce07cd - Instantiate Error in Target::GetEntryPointAddress() only when necessary

2020-08-22 Thread Dimitry Andric via lldb-commits

Author: Dimitry Andric
Date: 2020-08-22T12:47:13+02:00
New Revision: 1ce07cd614beab5150a5440c7faf195009f99e2c

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

LOG: Instantiate Error in Target::GetEntryPointAddress() only when necessary

When `Target::GetEntryPointAddress()` calls 
`exe_module->GetObjectFile()->GetEntryPointAddress()`, and the returned
`entry_addr` is valid, it can immediately be returned.

However, just before that, an `llvm::Error` value has been setup, but in this 
case it is not consumed before returning, like is done further below in the 
function.

In https://bugs.freebsd.org/248745 we got a bug report for this, where a very 
simple test case aborts and dumps core:

```
* thread #1, name = 'testcase', stop reason = breakpoint 1.1
frame #0: 0x002018d4 testcase`main(argc=1, argv=0x7fffea18) 
at testcase.c:3:5
   1int main(int argc, char *argv[])
   2{
-> 3return 0;
   4}
(lldb) p argc
Program aborted due to an unhandled Error:
Error value was Success. (Note: Success values must still be checked prior to 
being destroyed).

Thread 1 received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:3
3   thr_kill.S: No such file or directory.
(gdb) bt
#0  thr_kill () at thr_kill.S:3
#1  0x0008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x0451b5f5 in fatalUncheckedError () at 
/usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
#4  0x019cf008 in GetEntryPointAddress () at 
/usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
#5  0x01bccbd8 in ConstructorSetup () at 
/usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
#6  0x01bcd2c0 in ThreadPlanCallFunction () at 
/usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
#7  0x020076d4 in InferiorCallMmap () at 
/usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
#8  0x01f4be33 in DoAllocateMemory () at 
/usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
#9  0x01fe51b9 in AllocatePage () at 
/usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
#10 0x01fe5385 in AllocateMemory () at 
/usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
#11 0x01974da2 in AllocateMemory () at 
/usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
#12 CanJIT () at 
/usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
#13 0x01a1bf3d in Evaluate () at 
/usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
#14 0x019ce7a2 in EvaluateExpression () at 
/usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
#15 0x01ad784c in EvaluateExpression () at 
/usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
#16 0x01ad86ae in DoExecute () at 
/usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
#17 0x01a5e3ed in Execute () at 
/usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
#18 0x01a6c4a3 in HandleCommand () at 
/usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
#19 0x01a6f98c in IOHandlerInputComplete () at 
/usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
#20 0x01a90b08 in Run () at 
/usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
#21 0x019a6c6a in ExecuteIOHandlers () at 
/usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
#22 0x01a70337 in RunCommandInterpreter () at 
/usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
#23 0x01d9d812 in RunCommandInterpreter () at 
/usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
#24 0x01918be8 in MainLoop () at 
/usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
#25 0x0191a114 in main () at 
/usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890```

Fix the incorrect error catch by only instantiating an `Error` object if it is 
necessary.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index aab9097458c9..a529df998ba7 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2407,21 +2407,13 @@ lldb::addr_t Target::GetPersistentSymbol(ConstString 
name) {
 
 llvm::Expected Target::GetEntryPointAddress() {
   Module *exe_module = 

[Lldb-commits] [lldb] bb894b9 - [lldb] Extract reproducer providers & co into their own header.

2020-08-22 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-08-22T10:04:27-07:00
New Revision: bb894b97821a1c970ce0c3243aaebbfa94add15c

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

LOG: [lldb] Extract reproducer providers & co into their own header.

Extract all the provider related logic from Reproducer.h and move it
into its own header ReproducerProvider.h. These classes are seeing most
of the development these days and this reorganization reduces
incremental compilation from ~520 to ~110 files when making changes to
the new header.

Added: 
lldb/include/lldb/Utility/ReproducerProvider.h
lldb/source/Utility/ReproducerProvider.cpp

Modified: 
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Utility/GDBRemote.h
lldb/include/lldb/Utility/ProcessInfo.h
lldb/include/lldb/Utility/Reproducer.h
lldb/source/API/SBReproducerPrivate.h
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Host.cpp
lldb/source/Initialization/SystemInitializerCommon.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/source/Utility/CMakeLists.txt
lldb/source/Utility/ProcessInfo.cpp
lldb/source/Utility/Reproducer.cpp
lldb/unittests/Utility/ReproducerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/IOHandler.h 
b/lldb/include/lldb/Core/IOHandler.h
index f29482c0c97a..c96dc1cd1888 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -15,7 +15,6 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Flags.h"
 #include "lldb/Utility/Predicate.h"
-#include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-defines.h"
@@ -32,6 +31,9 @@
 
 namespace lldb_private {
 class Debugger;
+namespace repro {
+class DataRecorder;
+}
 }
 
 namespace curses {

diff  --git a/lldb/include/lldb/Utility/GDBRemote.h 
b/lldb/include/lldb/Utility/GDBRemote.h
index f5749b7e6eaf..2ee706efbea2 100644
--- a/lldb/include/lldb/Utility/GDBRemote.h
+++ b/lldb/include/lldb/Utility/GDBRemote.h
@@ -10,7 +10,7 @@
 #define LLDB_UTILITY_GDBREMOTE_H
 
 #include "lldb/Utility/FileSpec.h"
-#include "lldb/Utility/Reproducer.h"
+#include "lldb/Utility/ReproducerProvider.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-public.h"

diff  --git a/lldb/include/lldb/Utility/ProcessInfo.h 
b/lldb/include/lldb/Utility/ProcessInfo.h
index ec91060cda54..8f5a5f6d21fb 100644
--- a/lldb/include/lldb/Utility/ProcessInfo.h
+++ b/lldb/include/lldb/Utility/ProcessInfo.h
@@ -14,7 +14,6 @@
 #include "lldb/Utility/Environment.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/NameMatches.h"
-#include "lldb/Utility/Reproducer.h"
 #include "llvm/Support/YAMLTraits.h"
 #include 
 
@@ -217,40 +216,7 @@ class ProcessInstanceInfoMatch {
 };
 
 namespace repro {
-class ProcessInfoRecorder : public AbstractRecorder {
-public:
-  ProcessInfoRecorder(const FileSpec &filename, std::error_code &ec)
-  : AbstractRecorder(filename, ec) {}
-
-  static llvm::Expected>
-  Create(const FileSpec &filename);
-
-  void Record(const ProcessInstanceInfoList &process_infos);
-};
-
-class ProcessInfoProvider : public repro::Provider {
-public:
-  struct Info {
-static const char *name;
-static const char *file;
-  };
-
-  ProcessInfoProvider(const FileSpec &directory) : Provider(directory) {}
-
-  ProcessInfoRecorder *GetNewProcessInfoRecorder();
-
-  void Keep() override;
-  void Discard() override;
-
-  static char ID;
-
-private:
-  std::unique_ptr m_stream_up;
-  std::vector> m_process_info_recorders;
-};
-
 llvm::Optional GetReplayProcessInstanceInfoList();
-
 } // namespace repro
 } // namespace lldb_private
 

diff  --git a/lldb/include/lldb/Utility/Reproducer.h 
b/lldb/include/lldb/Utility/Reproducer.h
index 8a406658fdfb..4dc6ddd51394 100644
--- a/lldb/include/lldb/Utility/Reproducer.h
+++ b/lldb/include/lldb/Utility/Reproducer.h
@@ -13,7 +13,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/FileCollector.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include 
@@ -84,250 +84,6 @@ template  class Provider : public 
ProviderBase {
   using ProviderBase::ProviderBase; // Inherit constructor.
 };
 
-class FileProvider : public Provider {
-public:
-  struct Info {
-static const char *name;
-static const char *file;
-  };
-
-  FileProvider(const FileSpec &directory)
-  : Provider(directory),
-m_colle

[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-22 Thread Mateusz Mikuła via Phabricator via lldb-commits
mati865 added a comment.

@phosek in MSYS2 (targeting x86_64-w64-windows-gnu) Zlib works properly for 
LLVM 10 but with master I'm now seeing:

  -- Constructing LLVMBuild project information
  -- DEBUG zlib_library=D:/msys64/mingw64/lib/libz.dll.a
  CMake Error at lib/Support/CMakeLists.txt:9 (string):
string sub-command REGEX, mode REPLACE: regex "^(lib|)" matched an empty
string.
  Call Stack (most recent call first):
lib/Support/CMakeLists.txt:226 (get_system_libname)

`-- DEBUG zlib_library=D:/msys64/mingw64/lib/libz.dll.a` was printed by my 
change to help debugging it.
FYI `zlib_library` is set here: 
https://github.com/llvm/llvm-project/blob/8e06bf6b3a2e8d25e56cd52dca0cf3ff1b37b5d1/llvm/lib/Support/CMakeLists.txt#L218


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219

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


[Lldb-commits] [PATCH] D86292: [LLDB][RISCV] Distinguish between riscv32 and riscv64 based on ELF class

2020-08-22 Thread Luís Marques via Phabricator via lldb-commits
luismarques updated this revision to Diff 286994.
luismarques added a comment.

Add riscv32 test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86292

Files:
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml
  lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml


Index: lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml
@@ -0,0 +1,11 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Architecture: riscv64--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
Index: lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml
@@ -0,0 +1,11 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Architecture: riscv32--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -457,10 +457,10 @@
  0xu, 0xu}, // ARC
 {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // AVR
-{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // riscv32
-{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // riscv64
+{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
+ ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
+{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
+ ArchSpec::eRISCVSubType_riscv64, 0xu, 0xu}, // riscv64
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -296,9 +296,23 @@
   return arch_variant;
 }
 
+static uint32_t riscvVariantFromElfFlags(const elf::ELFHeader &header) {
+  uint32_t fileclass = header.e_ident[EI_CLASS];
+  switch (fileclass) {
+  case llvm::ELF::ELFCLASS32:
+return ArchSpec::eRISCVSubType_riscv32;
+  case llvm::ELF::ELFCLASS64:
+return ArchSpec::eRISCVSubType_riscv64;
+  default:
+return ArchSpec::eRISCVSubType_unknown;
+  }
+}
+
 static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
   if (header.e_machine == llvm::ELF::EM_MIPS)
 return mipsVariantFromElfFlags(header);
+  else if (header.e_machine == llvm::ELF::EM_RISCV)
+return riscvVariantFromElfFlags(header);
 
   return LLDB_INVALID_CPUTYPE;
 }
Index: lldb/include/lldb/Utility/ArchSpec.h
===
--- lldb/include/lldb/Utility/ArchSpec.h
+++ lldb/include/lldb/Utility/ArchSpec.h
@@ -99,6 +99,12 @@
 eRISCV_abi_d = 0x0020
   };
 
+  enum RISCVSubType {
+eRISCVSubType_unknown,
+eRISCVSubType_riscv32,
+eRISCVSubType_riscv64,
+  };
+
   enum Core {
 eCore_arm_generic,
 eCore_arm_armv4,


Index: lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml
@@ -0,0 +1,11 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Architecture: riscv64--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
Index: lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml
@@ -0,0 +1,11 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Architecture: riscv32--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -457,10 +457,10 @@
  0xu, 0xu}, // ARC
 {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // AVR
-{ArchSpec::eCore_riscv32, llv

[Lldb-commits] [PATCH] D86292: [LLDB][RISCV] Distinguish between riscv32 and riscv64 based on ELF class

2020-08-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Patch looks good. Just need to test 32 bit RISC as well with a 
"lldb/test/Shell/ObjectFile/ELF/riscv32-arch.yaml" to verify 32 bit is working.




Comment at: lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml:1-11
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Architecture: riscv64--
+
+--- !ELF
+FileHeader:

We should test 32 bit as well right? Or do we already have one?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86292

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


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

2020-08-22 Thread António Afonso via Phabricator via lldb-commits
aadsm created this revision.
aadsm added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
aadsm requested review of this revision.

This addresses the issue raised here 
https://reviews.llvm.org/rG02bf5632a94da6c3570df002804f8d3f79c11bfc
The `finish_swig_python` function might be called more than once so we need to 
make sure that the
`lldb-python-scripts` target is only created once.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86402

Files:
  lldb/bindings/python/CMakeLists.txt


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -165,16 +165,19 @@
   endif()
   set(python_scripts_target "lldb-python-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
-  add_custom_target(${python_scripts_target})
+  # This function might be called multiple times but we only need to create 
the custom target once.
+  if (NOT TARGET ${python_scripts_target})
+add_custom_target(${python_scripts_target})
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(${python_scripts_install_target}
+  COMPONENT ${python_scripts_target}
+  DEPENDS ${python_scripts_target})
+endif()
+  endif()
   add_dependencies(${python_scripts_target} ${swig_target})
   install(DIRECTORY ${lldb_python_target_dir}/../
   DESTINATION ${LLDB_PYTHON_INSTALL_PATH}
   COMPONENT ${python_scripts_target})
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_install_targets(${python_scripts_install_target}
- COMPONENT ${python_scripts_target}
- DEPENDS ${python_scripts_target})
-  endif()
 
   # Add a Post-Build Event to copy the custom Python DLL to the lldb binaries 
dir so that Windows can find it when launching
   # lldb.exe or any other executables that were linked with liblldb.


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -165,16 +165,19 @@
   endif()
   set(python_scripts_target "lldb-python-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
-  add_custom_target(${python_scripts_target})
+  # This function might be called multiple times but we only need to create the custom target once.
+  if (NOT TARGET ${python_scripts_target})
+add_custom_target(${python_scripts_target})
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(${python_scripts_install_target}
+  COMPONENT ${python_scripts_target}
+  DEPENDS ${python_scripts_target})
+endif()
+  endif()
   add_dependencies(${python_scripts_target} ${swig_target})
   install(DIRECTORY ${lldb_python_target_dir}/../
   DESTINATION ${LLDB_PYTHON_INSTALL_PATH}
   COMPONENT ${python_scripts_target})
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_install_targets(${python_scripts_install_target}
- COMPONENT ${python_scripts_target}
- DEPENDS ${python_scripts_target})
-  endif()
 
   # Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
   # lldb.exe or any other executables that were linked with liblldb.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

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

The target should be created for everyone calling the `finish_swig_python` 
function. Let's say (not so) hypothetically I want to create bindings for 
Python 2 and Python 3. I'll call `finish_swig_python`, twice, once for each 
Python version:

  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
  finish_swig_python("lldb-python2" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")

I want two corresponding targets, `lldb-python-scripts` and 
`lldb-python2-scripts` and two install targets. So what I proposed in D86235 
 is using `${swig_target}`, which is the first 
argument to `finish_swig_python` to be part of the target name:

  set(swig_scripts_target "${swig_target}-scripts")
  set(swig_scripts_install_target "install-${swig_scripts_target}")

This will create `lldb-python-script` and `install lldb-python-script` for the 
first call, and `lldb-python2-script` and `install lldb-python2-script` for the 
second call to `finish_swig_python`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86402

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


[Lldb-commits] [PATCH] D86381: Move Py_buffer_RAII to .h file so SWIG 2 doesnt have to parse it

2020-08-22 Thread António Afonso 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 rG5d8eedee917d: Move Py_buffer_RAII to .h file so SWIG 2 
doesnt have to parse it (authored by aadsm).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86381

Files:
  lldb/bindings/python/python-typemaps.h
  lldb/bindings/python/python-typemaps.swig


Index: lldb/bindings/python/python-typemaps.swig
===
--- lldb/bindings/python/python-typemaps.swig
+++ lldb/bindings/python/python-typemaps.swig
@@ -1,5 +1,11 @@
 /* Typemap definitions, to allow SWIG to properly handle 'char**' data types. 
*/
 
+%inline %{
+
+#include "../bindings/python/python-typemaps.h"
+
+%}
+
 %typemap(in) char ** {
   /* Check if is a list  */
   if (PythonList::Check($input)) {
@@ -61,7 +67,7 @@
 
 %typemap(in) lldb::tid_t {
   PythonObject obj = Retain($input);
-  lldb::tid_t value = unwrapOrSetPythonException(As(obj)); 
+  lldb::tid_t value = unwrapOrSetPythonException(As(obj));
   if (PyErr_Occurred())
 return nullptr;
   $1 = value;
@@ -476,21 +482,6 @@
 }
 }
 
-%inline %{
-
-struct Py_buffer_RAII {
-  Py_buffer buffer = {};
-  Py_buffer_RAII() {};
-  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
-  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
-  ~Py_buffer_RAII() {
-if (buffer.obj)
-  PyBuffer_Release(&buffer);
-  }
-};
-
-%}
-
 // These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
 // and fixed so they will not crash if PyObject_GetBuffer fails.
 // https://github.com/swig/swig/issues/1640
Index: lldb/bindings/python/python-typemaps.h
===
--- /dev/null
+++ lldb/bindings/python/python-typemaps.h
@@ -0,0 +1,17 @@
+#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+
+// Defined here instead of a .swig file because SWIG 2 doesn't support
+// explicit deleted functions.
+struct Py_buffer_RAII {
+  Py_buffer buffer = {};
+  Py_buffer_RAII(){};
+  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
+  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
+  ~Py_buffer_RAII() {
+if (buffer.obj)
+  PyBuffer_Release(&buffer);
+  }
+};
+
+#endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H


Index: lldb/bindings/python/python-typemaps.swig
===
--- lldb/bindings/python/python-typemaps.swig
+++ lldb/bindings/python/python-typemaps.swig
@@ -1,5 +1,11 @@
 /* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */
 
+%inline %{
+
+#include "../bindings/python/python-typemaps.h"
+
+%}
+
 %typemap(in) char ** {
   /* Check if is a list  */
   if (PythonList::Check($input)) {
@@ -61,7 +67,7 @@
 
 %typemap(in) lldb::tid_t {
   PythonObject obj = Retain($input);
-  lldb::tid_t value = unwrapOrSetPythonException(As(obj)); 
+  lldb::tid_t value = unwrapOrSetPythonException(As(obj));
   if (PyErr_Occurred())
 return nullptr;
   $1 = value;
@@ -476,21 +482,6 @@
 }
 }
 
-%inline %{
-
-struct Py_buffer_RAII {
-  Py_buffer buffer = {};
-  Py_buffer_RAII() {};
-  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
-  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
-  ~Py_buffer_RAII() {
-if (buffer.obj)
-  PyBuffer_Release(&buffer);
-  }
-};
-
-%}
-
 // These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
 // and fixed so they will not crash if PyObject_GetBuffer fails.
 // https://github.com/swig/swig/issues/1640
Index: lldb/bindings/python/python-typemaps.h
===
--- /dev/null
+++ lldb/bindings/python/python-typemaps.h
@@ -0,0 +1,17 @@
+#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+
+// Defined here instead of a .swig file because SWIG 2 doesn't support
+// explicit deleted functions.
+struct Py_buffer_RAII {
+  Py_buffer buffer = {};
+  Py_buffer_RAII(){};
+  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
+  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
+  ~Py_buffer_RAII() {
+if (buffer.obj)
+  PyBuffer_Release(&buffer);
+  }
+};
+
+#endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 5d8eede - Move Py_buffer_RAII to .h file so SWIG 2 doesnt have to parse it

2020-08-22 Thread António Afonso via lldb-commits

Author: António Afonso
Date: 2020-08-22T10:43:50-07:00
New Revision: 5d8eedee917de2d39d1c485d07a30f8649bc6866

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

LOG: Move Py_buffer_RAII to .h file so SWIG 2 doesnt have to parse it

`struct Py_buffer_RAII` definition uses explicit deleted functions which are 
not supported by SWIG 2 (only 3).
To get around this I moved this struct to an .h file that is included to avoid 
being parsed by swig.

Reviewed By: lawrence_danna

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

Added: 
lldb/bindings/python/python-typemaps.h

Modified: 
lldb/bindings/python/python-typemaps.swig

Removed: 




diff  --git a/lldb/bindings/python/python-typemaps.h 
b/lldb/bindings/python/python-typemaps.h
new file mode 100644
index ..b45352ad6295
--- /dev/null
+++ b/lldb/bindings/python/python-typemaps.h
@@ -0,0 +1,17 @@
+#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
+
+// Defined here instead of a .swig file because SWIG 2 doesn't support
+// explicit deleted functions.
+struct Py_buffer_RAII {
+  Py_buffer buffer = {};
+  Py_buffer_RAII(){};
+  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
+  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
+  ~Py_buffer_RAII() {
+if (buffer.obj)
+  PyBuffer_Release(&buffer);
+  }
+};
+
+#endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H

diff  --git a/lldb/bindings/python/python-typemaps.swig 
b/lldb/bindings/python/python-typemaps.swig
index c08aeab71f78..b1ace4ff3b1e 100644
--- a/lldb/bindings/python/python-typemaps.swig
+++ b/lldb/bindings/python/python-typemaps.swig
@@ -1,5 +1,11 @@
 /* Typemap definitions, to allow SWIG to properly handle 'char**' data types. 
*/
 
+%inline %{
+
+#include "../bindings/python/python-typemaps.h"
+
+%}
+
 %typemap(in) char ** {
   /* Check if is a list  */
   if (PythonList::Check($input)) {
@@ -61,7 +67,7 @@
 
 %typemap(in) lldb::tid_t {
   PythonObject obj = Retain($input);
-  lldb::tid_t value = unwrapOrSetPythonException(As(obj)); 
+  lldb::tid_t value = unwrapOrSetPythonException(As(obj));
   if (PyErr_Occurred())
 return nullptr;
   $1 = value;
@@ -476,21 +482,6 @@ bool SetNumberFromPyObject(double &number, 
PyObject *obj) {
 }
 }
 
-%inline %{
-
-struct Py_buffer_RAII {
-  Py_buffer buffer = {};
-  Py_buffer_RAII() {};
-  Py_buffer &operator=(const Py_buffer_RAII &) = delete;
-  Py_buffer_RAII(const Py_buffer_RAII &) = delete;
-  ~Py_buffer_RAII() {
-if (buffer.obj)
-  PyBuffer_Release(&buffer);
-  }
-};
-
-%}
-
 // These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
 // and fixed so they will not crash if PyObject_GetBuffer fails.
 // https://github.com/swig/swig/issues/1640



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


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

2020-08-22 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

Sounds good, will update. In my mind it would be easier to just install all 
configured python scripts by specifying a single distribution component.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86402

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


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

2020-08-22 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 287211.
aadsm added a comment.

Update to create 2 separate install targets


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86402

Files:
  lldb/CMakeLists.txt
  lldb/bindings/python/CMakeLists.txt


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -163,7 +163,7 @@
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
lldb_python_target_dir ${lldb_python_target_dir})
   endif()
-  set(python_scripts_target "lldb-python-scripts")
+  set(python_scripts_target "${swig_target}-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
   add_custom_target(${python_scripts_target})
   add_dependencies(${python_scripts_target} ${swig_target})
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -86,7 +86,7 @@
 set(lldb_python_target_dir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
   endif()
   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-  finish_swig_python("finish_swig_python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
+  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
 endif()
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -163,7 +163,7 @@
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" lldb_python_target_dir ${lldb_python_target_dir})
   endif()
-  set(python_scripts_target "lldb-python-scripts")
+  set(python_scripts_target "${swig_target}-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
   add_custom_target(${python_scripts_target})
   add_dependencies(${python_scripts_target} ${swig_target})
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -86,7 +86,7 @@
 set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
   endif()
   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-  finish_swig_python("finish_swig_python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
+  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
 endif()
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

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

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86402

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


[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

2020-08-22 Thread António Afonso via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52381938bcc8: Create ${swig_target}-scripts target instead 
of lldb-python-scripts (authored by aadsm).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86402

Files:
  lldb/CMakeLists.txt
  lldb/bindings/python/CMakeLists.txt


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -163,7 +163,7 @@
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
lldb_python_target_dir ${lldb_python_target_dir})
   endif()
-  set(python_scripts_target "lldb-python-scripts")
+  set(python_scripts_target "${swig_target}-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
   add_custom_target(${python_scripts_target})
   add_dependencies(${python_scripts_target} ${swig_target})
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -86,7 +86,7 @@
 set(lldb_python_target_dir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
   endif()
   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-  finish_swig_python("finish_swig_python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
+  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
 endif()
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})


Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -163,7 +163,7 @@
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" lldb_python_target_dir ${lldb_python_target_dir})
   endif()
-  set(python_scripts_target "lldb-python-scripts")
+  set(python_scripts_target "${swig_target}-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
   add_custom_target(${python_scripts_target})
   add_dependencies(${python_scripts_target} ${swig_target})
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -86,7 +86,7 @@
 set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
   endif()
   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-  finish_swig_python("finish_swig_python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
+  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
 endif()
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 5238193 - Create ${swig_target}-scripts target instead of lldb-python-scripts

2020-08-22 Thread António Afonso via lldb-commits

Author: António Afonso
Date: 2020-08-22T19:36:37-07:00
New Revision: 52381938bcc8547316d79a4721281da7f934d9b8

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

LOG: Create ${swig_target}-scripts target instead of lldb-python-scripts

This addresses the issue raised here 
https://reviews.llvm.org/rG02bf5632a94da6c3570df002804f8d3f79c11bfc
The `finish_swig_python` function might be called more than once so we need to 
create the distribution
component target based on the swig target.

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

Added: 


Modified: 
lldb/CMakeLists.txt
lldb/bindings/python/CMakeLists.txt

Removed: 




diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 4e417e97c188..df4442529f79 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -86,7 +86,7 @@ if (LLDB_ENABLE_PYTHON)
 set(lldb_python_target_dir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
   endif()
   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-  finish_swig_python("finish_swig_python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
+  finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" 
"${lldb_python_target_dir}")
 endif()
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})

diff  --git a/lldb/bindings/python/CMakeLists.txt 
b/lldb/bindings/python/CMakeLists.txt
index b6584e389c83..baad7e8f0eba 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -163,7 +163,7 @@ function(finish_swig_python swig_target 
lldb_python_bindings_dir lldb_python_tar
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
 string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" 
lldb_python_target_dir ${lldb_python_target_dir})
   endif()
-  set(python_scripts_target "lldb-python-scripts")
+  set(python_scripts_target "${swig_target}-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
   add_custom_target(${python_scripts_target})
   add_dependencies(${python_scripts_target} ${swig_target})



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