[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)

2024-02-19 Thread Anton Korobeynikov via lldb-commits

asl wrote:

Tagging @kovdan01 

https://github.com/llvm/llvm-project/pull/82272
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits


@@ -108,13 +108,9 @@ else()
   linux/HostInfoLinux.cpp
   linux/LibcGlue.cpp
   linux/Support.cpp
+  android/HostInfoAndroid.cpp
+  android/LibcGlue.cpp
   )
-if (CMAKE_SYSTEM_NAME MATCHES "Android")

asl wrote:

Not quite. It's distant enough in many aspects (from the toolchain perspective) 
to have a separate cmake system name.

https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits


@@ -108,13 +108,9 @@ else()
   linux/HostInfoLinux.cpp
   linux/LibcGlue.cpp
   linux/Support.cpp
+  android/HostInfoAndroid.cpp
+  android/LibcGlue.cpp
   )
-if (CMAKE_SYSTEM_NAME MATCHES "Android")

asl wrote:

Well, so this is not a cmake problem then.

https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits

https://github.com/asl edited https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits


@@ -46,64 +46,64 @@ class Triple {
   enum ArchType {
 UnknownArch,
 
-arm,// ARM (little endian): arm, armv.*, xscale

asl wrote:

You can ignore these.

https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits


@@ -108,13 +108,9 @@ else()
   linux/HostInfoLinux.cpp
   linux/LibcGlue.cpp
   linux/Support.cpp
+  android/HostInfoAndroid.cpp
+  android/LibcGlue.cpp
   )
-if (CMAKE_SYSTEM_NAME MATCHES "Android")

asl wrote:

What is wrong with android detection? I doubt this is a proper solution

https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [clang] [mlir] [compiler-rt] [clang-tools-extra] [lldb] Fix Multiple Build Errors on different platforms (PR #77216)

2024-01-06 Thread Anton Korobeynikov via lldb-commits


@@ -46,64 +46,64 @@ class Triple {
   enum ArchType {
 UnknownArch,
 
-arm,// ARM (little endian): arm, armv.*, xscale

asl wrote:

Please do not do such large code reformatting. It makes impossible to review 
them

https://github.com/llvm/llvm-project/pull/77216
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 8be139f - [lldb] Add settings for expression evaluation memory allocations.

2023-05-02 Thread Anton Korobeynikov via lldb-commits

Author: Ilya Kuklin
Date: 2023-05-02T11:02:44-07:00
New Revision: 8be139fc1251b99316d65403bde9c2326b12da20

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

LOG: [lldb] Add settings for expression evaluation memory allocations.

Expression evaluation allocates memory for storing intermediate data during 
evaluation. For it to work properly it has to be allocated within target's 
available address space, for example within first 0x bytes for the 16-bit 
MSP430. The memory for such targets can be very tightly packed, but not all 
targets support GetMemoryRegionInfo API to pick an unused region, like MSP430 
with MSPDebug GDB server.

These settings allow the programmer to manually pick precisely where and how 
much memory to allocate for expression evaluation in order not to overlap with 
existing data in process memory.

Reviewed By: bulbazord

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

Added: 
lldb/test/API/commands/expression/memory-allocation/Makefile

lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py
lldb/test/API/commands/expression/memory-allocation/main.cpp

Modified: 
lldb/include/lldb/Target/ABI.h
lldb/include/lldb/Target/Target.h
lldb/source/Expression/IRMemoryMap.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.h
lldb/source/Target/Target.cpp
lldb/source/Target/TargetProperties.td

Removed: 




diff  --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index f0753172d3e71..f600e29c7c4b0 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -147,6 +147,8 @@ class ABI : public PluginInterface {
 
   virtual bool GetPointerReturnRegister(const char *) { return false; }
 
+  virtual uint64_t GetStackFrameSize() { return 512 * 1024; }
+
   static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec 
);
 
 protected:

diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index b557dd26a3acc..d15f0705630ce 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -204,6 +204,12 @@ class TargetProperties : public Properties {
 
   uint64_t GetExprErrorLimit() const;
 
+  uint64_t GetExprAllocAddress() const;
+
+  uint64_t GetExprAllocSize() const;
+
+  uint64_t GetExprAllocAlign() const;
+
   bool GetUseHexImmediates() const;
 
   bool GetUseFastStepping() const;

diff  --git a/lldb/source/Expression/IRMemoryMap.cpp 
b/lldb/source/Expression/IRMemoryMap.cpp
index 951444db86a87..de631370bb048 100644
--- a/lldb/source/Expression/IRMemoryMap.cpp
+++ b/lldb/source/Expression/IRMemoryMap.cpp
@@ -92,26 +92,26 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
 ret = llvm::alignTo(addr + alloc_size, 4096);
   }
 
+  uint64_t end_of_memory;
+  switch (GetAddressByteSize()) {
+  case 2:
+end_of_memory = 0xull;
+break;
+  case 4:
+end_of_memory = 0xull;
+break;
+  case 8:
+end_of_memory = 0xull;
+break;
+  default:
+lldbassert(false && "Invalid address size.");
+return LLDB_INVALID_ADDRESS;
+  }
+
   // Now, if it's possible to use the GetMemoryRegionInfo API to detect mapped
   // regions, walk forward through memory until a region is found that has
   // adequate space for our allocation.
   if (process_is_alive) {
-uint64_t end_of_memory;
-switch (process_sp->GetAddressByteSize()) {
-case 2:
-  end_of_memory = 0xull;
-  break;
-case 4:
-  end_of_memory = 0xull;
-  break;
-case 8:
-  end_of_memory = 0xull;
-  break;
-default:
-  lldbassert(false && "Invalid address size.");
-  return LLDB_INVALID_ADDRESS;
-}
-
 MemoryRegionInfo region_info;
 Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
 if (err.Success()) {
@@ -147,29 +147,40 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // to the end of the allocations we've already reported, or use a 'sensible'
   // default if this is our first allocation.
   if (m_allocations.empty()) {
-uint32_t address_byte_size = GetAddressByteSize();
-if (address_byte_size != UINT32_MAX) {
-  switch (address_byte_size) {
-  case 2:
-ret = 0x8000ull;
-break;
-  case 4:
-ret = 0xee00ull;
-break;
-  case 8:
-ret = 0xdead0fffull;
-break;
-  default:
-lldbassert(false && "Invalid address size.");
+uint64_t alloc_address = target_sp->GetExprAllocAddress();
+if (alloc_address > 0) {
+  if (alloc_address >= end_of_memory) {
+lldbassert(0 && "The allocation address for expression evaluation must 
"
+  

[Lldb-commits] [lldb] 81beb15 - [lldb] Add support for MSP430 in LLDB.

2023-04-17 Thread Anton Korobeynikov via lldb-commits

Author: Ilya Kuklin
Date: 2023-04-17T16:03:35-07:00
New Revision: 81beb15d7e54b16f4beba0bafd982d56c6b95222

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

LOG: [lldb] Add support for MSP430 in LLDB.

Add MSP430 to the list of available targets, implement MSP430 ABI, add support 
for debugging targets with 16-bit address size.

The update is intended for use with MSPDebug, a GDB server implementation for 
MSP430.

Reviewed By: bulbazord, DavidSpickett

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

Added: 
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.cpp
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.h
lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
lldb/test/API/functionalities/gdb_remote_client/TestMSP430MSPDebug.py
lldb/test/API/functionalities/gdb_remote_client/msp430.yaml

Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/include/lldb/Utility/DataExtractor.h
lldb/source/Expression/IRMemoryMap.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterFallback.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Target/Platform.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index 444d427c1bd44..2de517d765b2a 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -172,6 +172,8 @@ class ArchSpec {
 eCore_mips64r5el,
 eCore_mips64r6el,
 
+eCore_msp430,
+
 eCore_ppc_generic,
 eCore_ppc_ppc601,
 eCore_ppc_ppc602,

diff  --git a/lldb/include/lldb/Utility/DataExtractor.h 
b/lldb/include/lldb/Utility/DataExtractor.h
index dbf0bce8c8d0d..0b7e771ed4f86 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -843,9 +843,7 @@ class DataExtractor {
   /// \param[in] addr_size
   /// The size in bytes to use when extracting addresses.
   void SetAddressByteSize(uint32_t addr_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
-assert(addr_size == 4 || addr_size == 8);
-#endif
+assert(addr_size == 2 || addr_size == 4 || addr_size == 8);
 m_addr_size = addr_size;
   }
 

diff  --git a/lldb/source/Expression/IRMemoryMap.cpp 
b/lldb/source/Expression/IRMemoryMap.cpp
index 3c102dd4eaef1..951444db86a87 100644
--- a/lldb/source/Expression/IRMemoryMap.cpp
+++ b/lldb/source/Expression/IRMemoryMap.cpp
@@ -96,12 +96,21 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // regions, walk forward through memory until a region is found that has
   // adequate space for our allocation.
   if (process_is_alive) {
-const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8
-   ? 0xull
-   : 0xull;
-
-lldbassert(process_sp->GetAddressByteSize() == 4 ||
-   end_of_memory != 0xull);
+uint64_t end_of_memory;
+switch (process_sp->GetAddressByteSize()) {
+case 2:
+  end_of_memory = 0xull;
+  break;
+case 4:
+  end_of_memory = 0xull;
+  break;
+case 8:
+  end_of_memory = 0xull;
+  break;
+default:
+  lldbassert(false && "Invalid address size.");
+  return LLDB_INVALID_ADDRESS;
+}
 
 MemoryRegionInfo region_info;
 Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
@@ -137,26 +146,31 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // We've tried our algorithm, and it didn't work.  Now we have to reset back
   // to the end of the allocations we've already reported, or use a 'sensible'
   // default if this is our first allocation.
-
   if (m_allocations.empty()) {
 uint32_t address_byte_size = GetAddressByteSize();
 if (address_byte_size != UINT32_MAX) {
   switch (address_byte_size) {
-  case 8:
-ret = 0xdead0fffull;
+  case 2:
+ret = 0x8000ull;
 break;
   case 4:
 ret = 0xee00ull;
 break;
-  default:
+  case 8:
+ret = 0xdead0fffull;
 break;
+  default:
+lldbassert(false && "Invalid address size.");
+return LLDB_INVALID_ADDRESS;
   }
 }
   } else {
 auto back = m_allocations.rbegin();
 lldb::addr_t addr = back->first;
 size_t alloc_size = back->second.m_size;
-ret = llvm::alignTo(addr + alloc_size, 4096);
+auto arch = 

[Lldb-commits] [lldb] 8456120 - Revert "[lldb] Add support for MSP430 in LLDB."

2023-04-17 Thread Anton Korobeynikov via lldb-commits

Author: Anton Korobeynikov
Date: 2023-04-17T11:30:27-07:00
New Revision: 845612062389e3defbe073119b481a5472e9fc36

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

LOG: Revert "[lldb] Add support for MSP430 in LLDB."

This reverts commit 82c02b733c7736507a41a26bebd37d3f8e88bd4e.

Apparently, the original patch was not rebased onto `main

Added: 


Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/include/lldb/Utility/DataExtractor.h
lldb/source/Expression/IRMemoryMap.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterFallback.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Target/Platform.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp

Removed: 
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.cpp
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.h
lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
lldb/test/API/functionalities/gdb_remote_client/TestMSP430MSPDebug.py
lldb/test/API/functionalities/gdb_remote_client/msp430.yaml



diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index 2de517d765b2a..444d427c1bd44 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -172,8 +172,6 @@ class ArchSpec {
 eCore_mips64r5el,
 eCore_mips64r6el,
 
-eCore_msp430,
-
 eCore_ppc_generic,
 eCore_ppc_ppc601,
 eCore_ppc_ppc602,

diff  --git a/lldb/include/lldb/Utility/DataExtractor.h 
b/lldb/include/lldb/Utility/DataExtractor.h
index 0b7e771ed4f86..dbf0bce8c8d0d 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -843,7 +843,9 @@ class DataExtractor {
   /// \param[in] addr_size
   /// The size in bytes to use when extracting addresses.
   void SetAddressByteSize(uint32_t addr_size) {
-assert(addr_size == 2 || addr_size == 4 || addr_size == 8);
+#ifdef LLDB_CONFIGURATION_DEBUG
+assert(addr_size == 4 || addr_size == 8);
+#endif
 m_addr_size = addr_size;
   }
 

diff  --git a/lldb/source/Expression/IRMemoryMap.cpp 
b/lldb/source/Expression/IRMemoryMap.cpp
index 951444db86a87..3c102dd4eaef1 100644
--- a/lldb/source/Expression/IRMemoryMap.cpp
+++ b/lldb/source/Expression/IRMemoryMap.cpp
@@ -96,21 +96,12 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // regions, walk forward through memory until a region is found that has
   // adequate space for our allocation.
   if (process_is_alive) {
-uint64_t end_of_memory;
-switch (process_sp->GetAddressByteSize()) {
-case 2:
-  end_of_memory = 0xull;
-  break;
-case 4:
-  end_of_memory = 0xull;
-  break;
-case 8:
-  end_of_memory = 0xull;
-  break;
-default:
-  lldbassert(false && "Invalid address size.");
-  return LLDB_INVALID_ADDRESS;
-}
+const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8
+   ? 0xull
+   : 0xull;
+
+lldbassert(process_sp->GetAddressByteSize() == 4 ||
+   end_of_memory != 0xull);
 
 MemoryRegionInfo region_info;
 Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
@@ -146,31 +137,26 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // We've tried our algorithm, and it didn't work.  Now we have to reset back
   // to the end of the allocations we've already reported, or use a 'sensible'
   // default if this is our first allocation.
+
   if (m_allocations.empty()) {
 uint32_t address_byte_size = GetAddressByteSize();
 if (address_byte_size != UINT32_MAX) {
   switch (address_byte_size) {
-  case 2:
-ret = 0x8000ull;
+  case 8:
+ret = 0xdead0fffull;
 break;
   case 4:
 ret = 0xee00ull;
 break;
-  case 8:
-ret = 0xdead0fffull;
-break;
   default:
-lldbassert(false && "Invalid address size.");
-return LLDB_INVALID_ADDRESS;
+break;
   }
 }
   } else {
 auto back = m_allocations.rbegin();
 lldb::addr_t addr = back->first;
 size_t alloc_size = back->second.m_size;
-auto arch = target_sp->GetArchitecture().GetTriple().getArch();
-auto align = arch == llvm::Triple::msp430 ? 512 : 4096;
-ret = llvm::alignTo(addr + alloc_size, align);
+ret = llvm::alignTo(addr + alloc_size, 4096);
   }
 
   

[Lldb-commits] [lldb] 82c02b7 - [lldb] Add support for MSP430 in LLDB.

2023-04-17 Thread Anton Korobeynikov via lldb-commits

Author: Anton Korobeynikov
Date: 2023-04-17T11:05:09-07:00
New Revision: 82c02b733c7736507a41a26bebd37d3f8e88bd4e

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

LOG: [lldb] Add support for MSP430 in LLDB.

Add MSP430 to the list of available targets, implement MSP430 ABI, add support 
for debugging targets with 16-bit address size.

The update is intended for use with MSPDebug, a GDB server implementation for 
MSP430.

Reviewed By: bulbazord, DavidSpickett

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

Added: 
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.cpp
lldb/source/Plugins/ABI/MSP430/ABISysV_msp430.h
lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
lldb/test/API/functionalities/gdb_remote_client/TestMSP430MSPDebug.py
lldb/test/API/functionalities/gdb_remote_client/msp430.yaml

Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/include/lldb/Utility/DataExtractor.h
lldb/source/Expression/IRMemoryMap.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterFallback.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Target/Platform.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index 444d427c1bd44..2de517d765b2a 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -172,6 +172,8 @@ class ArchSpec {
 eCore_mips64r5el,
 eCore_mips64r6el,
 
+eCore_msp430,
+
 eCore_ppc_generic,
 eCore_ppc_ppc601,
 eCore_ppc_ppc602,

diff  --git a/lldb/include/lldb/Utility/DataExtractor.h 
b/lldb/include/lldb/Utility/DataExtractor.h
index dbf0bce8c8d0d..0b7e771ed4f86 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -843,9 +843,7 @@ class DataExtractor {
   /// \param[in] addr_size
   /// The size in bytes to use when extracting addresses.
   void SetAddressByteSize(uint32_t addr_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
-assert(addr_size == 4 || addr_size == 8);
-#endif
+assert(addr_size == 2 || addr_size == 4 || addr_size == 8);
 m_addr_size = addr_size;
   }
 

diff  --git a/lldb/source/Expression/IRMemoryMap.cpp 
b/lldb/source/Expression/IRMemoryMap.cpp
index 3c102dd4eaef1..951444db86a87 100644
--- a/lldb/source/Expression/IRMemoryMap.cpp
+++ b/lldb/source/Expression/IRMemoryMap.cpp
@@ -96,12 +96,21 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // regions, walk forward through memory until a region is found that has
   // adequate space for our allocation.
   if (process_is_alive) {
-const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8
-   ? 0xull
-   : 0xull;
-
-lldbassert(process_sp->GetAddressByteSize() == 4 ||
-   end_of_memory != 0xull);
+uint64_t end_of_memory;
+switch (process_sp->GetAddressByteSize()) {
+case 2:
+  end_of_memory = 0xull;
+  break;
+case 4:
+  end_of_memory = 0xull;
+  break;
+case 8:
+  end_of_memory = 0xull;
+  break;
+default:
+  lldbassert(false && "Invalid address size.");
+  return LLDB_INVALID_ADDRESS;
+}
 
 MemoryRegionInfo region_info;
 Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
@@ -137,26 +146,31 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
   // We've tried our algorithm, and it didn't work.  Now we have to reset back
   // to the end of the allocations we've already reported, or use a 'sensible'
   // default if this is our first allocation.
-
   if (m_allocations.empty()) {
 uint32_t address_byte_size = GetAddressByteSize();
 if (address_byte_size != UINT32_MAX) {
   switch (address_byte_size) {
-  case 8:
-ret = 0xdead0fffull;
+  case 2:
+ret = 0x8000ull;
 break;
   case 4:
 ret = 0xee00ull;
 break;
-  default:
+  case 8:
+ret = 0xdead0fffull;
 break;
+  default:
+lldbassert(false && "Invalid address size.");
+return LLDB_INVALID_ADDRESS;
   }
 }
   } else {
 auto back = m_allocations.rbegin();
 lldb::addr_t addr = back->first;
 size_t alloc_size = back->second.m_size;
-ret = llvm::alignTo(addr + alloc_size, 4096);
+auto arch