Skip to content

Commit 9c2fca6

Browse files
adamgreenfacchinm
authored andcommitted
Fix bug in Platform_Set/ClearHardwareBreakpoint()
I hit this bug when attempting to use temporary breakpoints on setup() in ThreadMRI but it is bad enough that I fixed it in the kernel mode version of MRI at the same time rather than wait for my backprop of core MRI changes.
1 parent 90d0686 commit 9c2fca6

File tree

2 files changed

+12
-12
lines changed
  • libraries

2 files changed

+12
-12
lines changed

libraries/MRI/src/architectures/armv7-m/armv7-m.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -938,16 +938,16 @@ static int doesKindIndicate32BitInstruction(uint32_t kind)
938938
void Platform_SetHardwareBreakpoint(uint32_t address)
939939
{
940940
uint32_t* pFPBBreakpointComparator;
941-
uint16_t currentInstructionWord;
941+
uint16_t firstInstructionWord;
942942

943943
__try
944944
{
945-
currentInstructionWord = getFirstHalfWordOfCurrentInstruction();
945+
firstInstructionWord = throwingMemRead16(address);
946946
}
947947
__catch
948948
__rethrow;
949949

950-
pFPBBreakpointComparator = enableFPBBreakpoint(address, isInstruction32Bit(currentInstructionWord));
950+
pFPBBreakpointComparator = enableFPBBreakpoint(address, isInstruction32Bit(firstInstructionWord));
951951
if (!pFPBBreakpointComparator)
952952
__throw(exceededHardwareResourcesException);
953953
}
@@ -968,16 +968,16 @@ void Platform_ClearHardwareBreakpointOfGdbKind(uint32_t address, uint32_t kind)
968968

969969
void Platform_ClearHardwareBreakpoint(uint32_t address)
970970
{
971-
uint16_t currentInstructionWord;
971+
uint16_t firstInstructionWord;
972972

973973
__try
974974
{
975-
currentInstructionWord = getFirstHalfWordOfCurrentInstruction();
975+
firstInstructionWord = throwingMemRead16(address);
976976
}
977977
__catch
978978
__rethrow;
979979

980-
disableFPBBreakpointComparator(address, isInstruction32Bit(currentInstructionWord));
980+
disableFPBBreakpointComparator(address, isInstruction32Bit(firstInstructionWord));
981981
}
982982

983983

libraries/ThreadMRI/src/architectures/armv7-m/armv7-m.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -975,16 +975,16 @@ static int doesKindIndicate32BitInstruction(uint32_t kind)
975975
void Platform_SetHardwareBreakpoint(uint32_t address)
976976
{
977977
uint32_t* pFPBBreakpointComparator;
978-
uint16_t currentInstructionWord;
978+
uint16_t firstInstructionWord;
979979

980980
__try
981981
{
982-
currentInstructionWord = getFirstHalfWordOfCurrentInstruction();
982+
firstInstructionWord = throwingMemRead16(address);
983983
}
984984
__catch
985985
__rethrow;
986986

987-
pFPBBreakpointComparator = enableFPBBreakpoint(address, isInstruction32Bit(currentInstructionWord));
987+
pFPBBreakpointComparator = enableFPBBreakpoint(address, isInstruction32Bit(firstInstructionWord));
988988
if (!pFPBBreakpointComparator)
989989
__throw(exceededHardwareResourcesException);
990990
}
@@ -1005,16 +1005,16 @@ void Platform_ClearHardwareBreakpointOfGdbKind(uint32_t address, uint32_t kind)
10051005

10061006
void Platform_ClearHardwareBreakpoint(uint32_t address)
10071007
{
1008-
uint16_t currentInstructionWord;
1008+
uint16_t firstInstructionWord;
10091009

10101010
__try
10111011
{
1012-
currentInstructionWord = getFirstHalfWordOfCurrentInstruction();
1012+
firstInstructionWord = throwingMemRead16(address);
10131013
}
10141014
__catch
10151015
__rethrow;
10161016

1017-
disableFPBBreakpointComparator(address, isInstruction32Bit(currentInstructionWord));
1017+
disableFPBBreakpointComparator(address, isInstruction32Bit(firstInstructionWord));
10181018
}
10191019

10201020

0 commit comments

Comments
 (0)