Skip to content

Commit

Permalink
Revert "[lldb] Add support for MSP430 in LLDB."
Browse files Browse the repository at this point in the history
This reverts commit 82c02b7.

Apparently, the original patch was not rebased onto `main
  • Loading branch information
asl committed Apr 17, 2023
1 parent 5041fe8 commit 8456120
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 1,078 deletions.
2 changes: 0 additions & 2 deletions lldb/include/lldb/Utility/ArchSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ class ArchSpec {
eCore_mips64r5el,
eCore_mips64r6el,

eCore_msp430,

eCore_ppc_generic,
eCore_ppc_ppc601,
eCore_ppc_ppc602,
Expand Down
4 changes: 3 additions & 1 deletion lldb/include/lldb/Utility/DataExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
36 changes: 11 additions & 25 deletions lldb/source/Expression/IRMemoryMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 0xffffull;
break;
case 4:
end_of_memory = 0xffffffffull;
break;
case 8:
end_of_memory = 0xffffffffffffffffull;
break;
default:
lldbassert(false && "Invalid address size.");
return LLDB_INVALID_ADDRESS;
}
const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8
? 0xffffffffffffffffull
: 0xffffffffull;

lldbassert(process_sp->GetAddressByteSize() == 4 ||
end_of_memory != 0xffffffffull);

MemoryRegionInfo region_info;
Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
Expand Down Expand Up @@ -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 = 0xdead0fff00000000ull;
break;
case 4:
ret = 0xee000000ull;
break;
case 8:
ret = 0xdead0fff00000000ull;
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);
}

return ret;
Expand Down
4 changes: 1 addition & 3 deletions lldb/source/Expression/LLVMUserExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) {
Status alloc_error;

auto arch = target->GetArchitecture().GetTriple().getArch();
const size_t stack_frame_size =
arch == llvm::Triple::msp430 ? 512 : 512 * 1024;
const size_t stack_frame_size = 512 * 1024;

const bool zero_memory = false;

Expand Down
4 changes: 0 additions & 4 deletions lldb/source/Host/common/NativeProcessProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
static const uint8_t g_i386_opcode[] = {0xCC};
static const uint8_t g_mips64_opcode[] = {0x00, 0x00, 0x00, 0x0d};
static const uint8_t g_mips64el_opcode[] = {0x0d, 0x00, 0x00, 0x00};
static const uint8_t g_msp430_opcode[] = {0x43, 0x43};
static const uint8_t g_s390x_opcode[] = {0x00, 0x01};
static const uint8_t g_ppc_opcode[] = {0x7f, 0xe0, 0x00, 0x08}; // trap
static const uint8_t g_ppcle_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
Expand All @@ -529,9 +528,6 @@ NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
case llvm::Triple::mips64el:
return llvm::ArrayRef(g_mips64el_opcode);

case llvm::Triple::msp430:
return llvm::ArrayRef(g_msp430_opcode);

case llvm::Triple::systemz:
return llvm::ArrayRef(g_s390x_opcode);

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ABI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC SystemZ X86)
foreach(target AArch64 ARM ARC Hexagon Mips PowerPC SystemZ X86)
if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(${target})
endif()
Expand Down

0 comments on commit 8456120

Please sign in to comment.