[Lldb-commits] [lldb] 3169d92 - Remove special Hexagon packet traversal code
Ted Woodward via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 5 10:05:56 PDT 2020
Author: Ted Woodward
Date: 2020-08-05T12:05:42-05:00
New Revision: 3169d920ccd16ec3c3e1bf5d91595b70a5278045
URL: https://github.com/llvm/llvm-project/commit/3169d920ccd16ec3c3e1bf5d91595b70a5278045
DIFF: https://github.com/llvm/llvm-project/commit/3169d920ccd16ec3c3e1bf5d91595b70a5278045.diff
LOG: Remove special Hexagon packet traversal code
On Hexagon, breakpoints need to be on the first instruction of a packet.
When the LLVM disassembler for Hexagon returned 32 bit instructions, we
needed code to find the start of the current packet. Now that the LLVM
disassembler for Hexagon returns packets instead of instructions, we always
have the first instruction of the packet. Remove the packet traversal code
because it can cause problems when the next packet has more than one
instruction.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D84966
Added:
Modified:
lldb/include/lldb/Core/Disassembler.h
lldb/source/Core/Disassembler.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/ThreadPlanStepRange.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index 926a74b933ef..d3b903b83c19 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -279,9 +279,6 @@ class InstructionList {
/// @param[in] start
/// The instruction index of the first instruction to check.
///
- /// @param[in] target
- /// A LLDB target object that is used to resolve addresses.
- ///
/// @param[in] ignore_calls
/// It true, then fine the first branch instruction that isn't
/// a function call (a branch that calls and returns to the next
@@ -298,7 +295,6 @@ class InstructionList {
/// found.
//------------------------------------------------------------------
uint32_t GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target,
bool ignore_calls,
bool *found_calls) const;
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 4da823c7a243..cc98b7309d6d 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -990,17 +990,15 @@ void InstructionList::Append(lldb::InstructionSP &inst_sp) {
uint32_t
InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target,
bool ignore_calls,
bool *found_calls) const {
size_t num_instructions = m_instructions.size();
uint32_t next_branch = UINT32_MAX;
- size_t i;
if (found_calls)
*found_calls = false;
- for (i = start; i < num_instructions; i++) {
+ for (size_t i = start; i < num_instructions; i++) {
if (m_instructions[i]->DoesBranch()) {
if (ignore_calls && m_instructions[i]->IsCall()) {
if (found_calls)
@@ -1012,42 +1010,6 @@ InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
}
}
- // Hexagon needs the first instruction of the packet with the branch. Go
- // backwards until we find an instruction marked end-of-packet, or until we
- // hit start.
- if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon) {
- // If we didn't find a branch, find the last packet start.
- if (next_branch == UINT32_MAX) {
- i = num_instructions - 1;
- }
-
- while (i > start) {
- --i;
-
- Status error;
- uint32_t inst_bytes;
- bool prefer_file_cache = false; // Read from process if process is running
- lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
- target.ReadMemory(m_instructions[i]->GetAddress(), prefer_file_cache,
- &inst_bytes, sizeof(inst_bytes), error, &load_addr);
- // If we have an error reading memory, return start
- if (!error.Success())
- return start;
- // check if this is the last instruction in a packet bits 15:14 will be
- // 11b or 00b for a duplex
- if (((inst_bytes & 0xC000) == 0xC000) ||
- ((inst_bytes & 0xC000) == 0x0000)) {
- // instruction after this should be the start of next packet
- next_branch = i + 1;
- break;
- }
- }
-
- if (next_branch == UINT32_MAX) {
- // We couldn't find the previous packet, so return start
- next_branch = start;
- }
- }
return next_branch;
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 36a2930f7915..e88911ad7210 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5947,10 +5947,8 @@ Process::AdvanceAddressToNextBranchInstruction(Address default_stop_addr,
return retval;
}
- uint32_t branch_index =
- insn_list->GetIndexOfNextBranchInstruction(insn_offset, target,
- false /* ignore_calls*/,
- nullptr);
+ uint32_t branch_index = insn_list->GetIndexOfNextBranchInstruction(
+ insn_offset, false /* ignore_calls*/, nullptr);
if (branch_index == UINT32_MAX) {
return retval;
}
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index f4b2ee3d08a2..3c42cd750dad 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -327,13 +327,9 @@ bool ThreadPlanStepRange::SetNextBranchBreakpoint() {
if (instructions == nullptr)
return false;
else {
- Target &target = GetThread().GetProcess()->GetTarget();
const bool ignore_calls = GetKind() == eKindStepOverRange;
- uint32_t branch_index =
- instructions->GetIndexOfNextBranchInstruction(pc_index, target,
- ignore_calls,
- &m_found_calls);
-
+ uint32_t branch_index = instructions->GetIndexOfNextBranchInstruction(
+ pc_index, ignore_calls, &m_found_calls);
Address run_to_address;
// If we didn't find a branch, run to the end of the range.
More information about the lldb-commits
mailing list