Some code smell fixes from sonarlint
This commit is contained in:
@@ -322,16 +322,22 @@ static char target_xml[] = /* QEMU gdb-xml/i386-32bit.xml with modificati
|
||||
#ifdef _WIN32
|
||||
static WSADATA wsa;
|
||||
#endif
|
||||
static int gdbstub_socket = -1, stop_reason_len = 0, in_gdbstub = 0;
|
||||
static int gdbstub_socket = -1;
|
||||
static int stop_reason_len = 0;
|
||||
static int in_gdbstub = 0;
|
||||
static uint32_t watch_addr;
|
||||
static char stop_reason[2048];
|
||||
|
||||
static gdbstub_client_t *first_client = NULL, *last_client = NULL;
|
||||
static gdbstub_client_t *first_client = NULL;
|
||||
static gdbstub_client_t *last_client = NULL;
|
||||
static mutex_t *client_list_mutex;
|
||||
|
||||
static void (*cpu_exec_shadow)(int cycs);
|
||||
static gdbstub_breakpoint_t *first_swbreak = NULL, *first_hwbreak = NULL,
|
||||
*first_rwatch = NULL, *first_wwatch = NULL, *first_awatch = NULL;
|
||||
static gdbstub_breakpoint_t *first_swbreak = NULL;
|
||||
static gdbstub_breakpoint_t *first_hwbreak = NULL;
|
||||
static gdbstub_breakpoint_t *first_rwatch = NULL;
|
||||
static gdbstub_breakpoint_t *first_wwatch = NULL;
|
||||
static gdbstub_breakpoint_t *first_awatch = NULL;
|
||||
|
||||
int gdbstub_step = 0, gdbstub_next_asap = 0;
|
||||
uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1];
|
||||
@@ -470,7 +476,8 @@ gdbstub_num_decode(char *p, int *dest, int mode)
|
||||
static int
|
||||
gdbstub_client_read_word(gdbstub_client_t *client, int *dest)
|
||||
{
|
||||
char *p = &client->packet[client->packet_pos], *q = p;
|
||||
char *p = &client->packet[client->packet_pos];
|
||||
char *q = p;
|
||||
while (((*p >= '0') && (*p <= '9')) || ((*p >= 'A') && (*p <= 'F')) || ((*p >= 'a') && (*p <= 'f')))
|
||||
*dest = ((*dest) << 4) | gdbstub_hex_decode(*p++);
|
||||
return p - q;
|
||||
@@ -599,7 +606,8 @@ static void
|
||||
gdbstub_client_respond(gdbstub_client_t *client)
|
||||
{
|
||||
/* Calculate checksum. */
|
||||
int checksum = 0, i;
|
||||
int checksum = 0;
|
||||
int i;
|
||||
for (i = 0; i < client->response_pos; i++)
|
||||
checksum += client->response[i];
|
||||
|
||||
@@ -716,12 +724,17 @@ gdbstub_client_read_reg(int index, uint8_t *buf)
|
||||
static void
|
||||
gdbstub_client_packet(gdbstub_client_t *client)
|
||||
{
|
||||
gdbstub_breakpoint_t *breakpoint, *prev_breakpoint = NULL, **first_breakpoint = NULL;
|
||||
gdbstub_breakpoint_t *breakpoint;
|
||||
gdbstub_breakpoint_t *prev_breakpoint = NULL;
|
||||
gdbstub_breakpoint_t **first_breakpoint = NULL;
|
||||
|
||||
#ifdef GDBSTUB_CHECK_CHECKSUM /* msys2 gdb 11.1 transmits qSupported and H with invalid checksum... */
|
||||
uint8_t rcv_checksum = 0, checksum = 0;
|
||||
#endif
|
||||
int i, j = 0, k = 0, l;
|
||||
int i;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int l;
|
||||
uint8_t buf[10] = { 0 };
|
||||
char *p;
|
||||
|
||||
@@ -1411,14 +1424,14 @@ gdbstub_cpu_exec(int cycs)
|
||||
|
||||
/* Add register dump. */
|
||||
uint8_t buf[10] = { 0 };
|
||||
int i, j, k;
|
||||
for (i = 0; i < GDB_REG_MAX; i++) {
|
||||
int j;
|
||||
for (int i = 0; i < GDB_REG_MAX; i++) {
|
||||
if (i >= 0x10)
|
||||
stop_reason[stop_reason_len++] = gdbstub_hex_encode(i >> 4);
|
||||
stop_reason[stop_reason_len++] = gdbstub_hex_encode(i & 0x0f);
|
||||
stop_reason[stop_reason_len++] = ':';
|
||||
j = gdbstub_client_read_reg(i, buf);
|
||||
for (k = 0; k < j; k++) {
|
||||
for (int k = 0; k < j; k++) {
|
||||
stop_reason[stop_reason_len++] = gdbstub_hex_encode(buf[k] >> 4);
|
||||
stop_reason[stop_reason_len++] = gdbstub_hex_encode(buf[k] & 0x0f);
|
||||
}
|
||||
@@ -1717,7 +1730,8 @@ gdbstub_mem_access(uint32_t *addrs, int access)
|
||||
if (in_gdbstub)
|
||||
return;
|
||||
|
||||
int width = access & (GDBSTUB_MEM_WRITE - 1), i;
|
||||
int width = access & (GDBSTUB_MEM_WRITE - 1);
|
||||
int i;
|
||||
|
||||
/* Go through the lists of watchpoints for this type of access. */
|
||||
gdbstub_breakpoint_t *watchpoint = (access & GDBSTUB_MEM_WRITE) ? first_wwatch : first_rwatch;
|
||||
|
||||
Reference in New Issue
Block a user