Skip to content

Commit 390aeed

Browse files
committed
Fix Arduino compile error
Local variable `end` shadowed function from `macros.h`.
1 parent 48dcec2 commit 390aeed

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/Debug/debugger.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -756,22 +756,22 @@ bool Debugger::saveState(Module *m, uint8_t *interruptData) {
756756
}
757757
case memState: {
758758
debug("receiving memory\n");
759-
uint32_t begin = read_B32(&program_state);
760-
uint32_t end = read_B32(&program_state);
761-
debug("memory offsets begin=%" PRIu32 " , end=%" PRIu32 "\n",
762-
begin, end);
763-
if (begin > end) {
759+
uint32_t start = read_B32(&program_state);
760+
uint32_t limit = read_B32(&program_state);
761+
debug("memory offsets start=%" PRIu32 " , limit=%" PRIu32 "\n",
762+
start, limit);
763+
if (start > limit) {
764764
FATAL("incorrect memory offsets\n");
765765
}
766-
uint32_t totalbytes = end - begin + 1;
766+
uint32_t totalbytes = limit - start + 1;
767767
uint8_t *mem_end =
768768
m->memory.bytes + m->memory.pages * (uint32_t)PAGE_SIZE;
769769
debug("will copy #%" PRIu32 " bytes\n", totalbytes);
770-
if ((m->bytes + begin) + totalbytes > mem_end) {
770+
if ((m->bytes + start) + totalbytes > mem_end) {
771771
FATAL("memory overflow\n");
772772
}
773-
memcpy(m->memory.bytes + begin, program_state, totalbytes + 1);
774-
for (auto i = begin; i <= (begin + totalbytes - 1); i++) {
773+
memcpy(m->memory.bytes + start, program_state, totalbytes + 1);
774+
for (auto i = start; i <= (start + totalbytes - 1); i++) {
775775
debug("GOT byte idx %" PRIu32 " =%" PRIu8 "\n", i,
776776
m->memory.bytes[i]);
777777
}

0 commit comments

Comments
 (0)