projects
/
fw
/
stlink
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #128 from schodet/unaligned-read
[fw/stlink]
/
gdbserver
/
gdb-remote.c
diff --git
a/gdbserver/gdb-remote.c
b/gdbserver/gdb-remote.c
index f6bf02d26a82c0faaaa45196e885fe8d8eeddc25..edf53389b6f1f3cc75969c2912a9dd6f3065e3f5 100644
(file)
--- a/
gdbserver/gdb-remote.c
+++ b/
gdbserver/gdb-remote.c
@@
-11,12
+11,16
@@
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
+#ifdef __MINGW32__
+#include "mingw.h"
+#else
#include <sys/poll.h>
#include <sys/poll.h>
+#endif
static const char hex[] = "0123456789abcdef";
int gdb_send_packet(int fd, char* data) {
static const char hex[] = "0123456789abcdef";
int gdb_send_packet(int fd, char* data) {
-
unsigned
length = strlen(data) + 5;
+
int
length = strlen(data) + 5;
char* packet = malloc(length); /* '$' data (hex) '#' cksum (hex) */
memset(packet, 0, length);
char* packet = malloc(length); /* '$' data (hex) '#' cksum (hex) */
memset(packet, 0, length);
@@
-24,7
+28,7
@@
int gdb_send_packet(int fd, char* data) {
packet[0] = '$';
uint8_t cksum = 0;
packet[0] = '$';
uint8_t cksum = 0;
- for(int i = 0; i < strlen(data); i++) {
+ for(
unsigned
int i = 0; i < strlen(data); i++) {
packet[i + 1] = data[i];
cksum += data[i];
}
packet[i + 1] = data[i];
cksum += data[i];
}