Commit 4fe4f97c authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Don't use 0xff for a hex digit!!

parent 548a3672
......@@ -283,7 +283,7 @@ void GDB_RSP::toHex(std::string& str, const Bits& bits) {
for (int i = len-1; i >= 0; --i) {
uint8_t byte = bits.get_uint8(i);
str.push_back(hex[byte >> 4]);
str.push_back(hex[byte & 0xff]);
str.push_back(hex[byte & 0xf]);
}
}
......
......@@ -25,13 +25,12 @@ void GDB_Serial::recv(RecvQueue::const_iterator i, RecvQueue::const_iterator end
Bits::size_type len = bits.size() / 8;
for (Bits::size_type j = 0; j < len; ++j) {
uint8_t b = bits.get_uint8(j);
uart(Bits(static_cast<uint8_t>(hex[b >> 4])));
uart(Bits(static_cast<uint8_t>(hex[b & 0xff])));
uart(Bits(static_cast<uint8_t>(b)));
chksum += b;
}
uart(Bits(static_cast<uint8_t>('#')));
uart(Bits(static_cast<uint8_t>(hex[chksum >> 4])));
uart(Bits(static_cast<uint8_t>(hex[chksum & 0xff])));
uart(Bits(static_cast<uint8_t>(hex[chksum & 0xf])));
}
}
}
......@@ -93,7 +92,7 @@ void GDB_Serial::runCommand() {
sum += body[i];
if (sum == ((hex1<<4) | hex2)) {
// std::cerr << "Executing " << body << std::endl;
std::cerr << "Executing " << body << std::endl;
echo(Bits(static_cast<uint8_t>('+')));
packet(Bits(body));
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment