Skip to content

Commit 06b8da5

Browse files
committed
Core: rename a parameter (NFC)
The parameter `type` in the software breakpoint manager indicates the length of the instruction sequence. Rename the parameter to `size` to reflect that.
1 parent f1c1e73 commit 06b8da5

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Headers/DebugServer2/Core/SoftwareBreakpointManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SoftwareBreakpointManager : public BreakpointManager {
2929
virtual int hit(Target::Thread *thread, Site &site) override;
3030

3131
protected:
32-
virtual void getOpcode(uint32_t type, ByteVector &opcode) const;
32+
virtual void getOpcode(size_t size, ByteVector &opcode) const;
3333

3434
protected:
3535
virtual ErrorCode enableLocation(Site const &site,

Sources/Core/ARM/SoftwareBreakpointManager.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,24 @@ int SoftwareBreakpointManager::hit(Target::Thread *thread, Site &site) {
104104
#endif
105105
}
106106

107-
void SoftwareBreakpointManager::getOpcode(uint32_t type,
107+
void SoftwareBreakpointManager::getOpcode(size_t size,
108108
ByteVector &opcode) const {
109109
#if defined(OS_WIN32) && defined(ARCH_ARM)
110-
if (type == 4) {
110+
if (size == 4) {
111111
static const uint32_t WinARMBPType = 2;
112112
DS2LOG(Warning,
113113
"requesting a breakpoint of size %u on Windows ARM, "
114-
"adjusting to type %u",
115-
type, WinARMBPType);
116-
type = WinARMBPType;
114+
"adjusting to size %u",
115+
size, WinARMBPType);
116+
size = WinARMBPType;
117117
}
118118
#endif
119119

120120
opcode.clear();
121121

122122
// TODO: We shouldn't have preprocessor checks for ARCH_ARM vs ARCH_ARM64
123123
// because we might be an ARM64 binary debugging an ARM inferior.
124-
switch (type) {
124+
switch (size) {
125125
#if defined(ARCH_ARM)
126126
case 2: // udf #1
127127
opcode.push_back('\xde');
@@ -152,8 +152,8 @@ void SoftwareBreakpointManager::getOpcode(uint32_t type,
152152
break;
153153
#endif
154154
default:
155-
DS2LOG(Error, "invalid breakpoint type %d", type);
156-
DS2BUG("invalid breakpoint type");
155+
DS2LOG(Error, "unsupported breakpoint width '%zu'", size);
156+
DS2BUG("unsupported breakpoint width");
157157
break;
158158
}
159159

Sources/Core/RISCV/SoftwareBreakpointManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ int SoftwareBreakpointManager::hit(Target::Thread *thread, Site &site) {
1414
return super::hit(state.pc(), site) ? 0 : -1;
1515
}
1616

17-
void SoftwareBreakpointManager::getOpcode(uint32_t type,
17+
void SoftwareBreakpointManager::getOpcode(size_t size,
1818
ByteVector &opcode) const {
1919
opcode.clear();
2020

21-
switch (type) {
21+
switch (size) {
2222
case 2: // c.ebreak
2323
opcode.push_back('\x02');
2424
opcode.push_back('\x90');
@@ -30,7 +30,7 @@ void SoftwareBreakpointManager::getOpcode(uint32_t type,
3030
opcode.push_back('\x00');
3131
break;
3232
default:
33-
DS2LOG(Error, "unsupported breakpoint width '%u'", type);
33+
DS2LOG(Error, "unsupported breakpoint width '%zu'", size);
3434
DS2BUG("unsupported breakpoint width");
3535
break;
3636
}

Sources/Core/X86/SoftwareBreakpointManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ int SoftwareBreakpointManager::hit(Target::Thread *thread, Site &site) {
4747
return -1;
4848
}
4949

50-
void SoftwareBreakpointManager::getOpcode(uint32_t type,
50+
void SoftwareBreakpointManager::getOpcode(size_t size,
5151
ByteVector &opcode) const {
52-
DS2ASSERT(type == 1);
52+
DS2ASSERT(size == 1);
5353
opcode.clear();
5454
opcode.push_back('\xcc'); // int 3
5555
}

0 commit comments

Comments
 (0)