Skip to content

Commit

Permalink
Enable commander disasm command while target is running.
Browse files Browse the repository at this point in the history
If the target is running, the disasm command doesn't try to read the PC.
  • Loading branch information
flit committed Mar 17, 2019
1 parent 6c2d076 commit 13adc4f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyocd/tools/pyocd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1556,10 +1556,14 @@ def _dump_peripheral_register(self, periph, reg, show_fields):

def print_disasm(self, code, startAddr, maxInstructions=None):
if not isCapstoneAvailable:
print("Warning: Disassembly is not available because the Capstone library is not installed")
print("Warning: Disassembly is not available because the Capstone library is not installed. "
"To install Capstone, run 'pip install capstone'.")
return

pc = self.target.read_core_register('pc') & ~1
if self.target.is_halted():
pc = self.target.read_core_register('pc') & ~1
else:
pc = -1
md = capstone.Cs(capstone.CS_ARCH_ARM, capstone.CS_MODE_THUMB)

addrLine = 0
Expand Down

0 comments on commit 13adc4f

Please sign in to comment.