openocd: use proper format with uint32_t 19/5819/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 18 Aug 2020 16:56:53 +0000 (18:56 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 5 Sep 2020 16:12:44 +0000 (17:12 +0100)
Modify the format strings to properly handle uint32_t data types.

Change-Id: I4de49bf02c9e37b72240224c23fc83abe8a4fa83
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5819
Tested-by: jenkins
src/pld/xilinx_bit.c
src/rtos/ThreadX.c
src/rtos/hwthread.c
src/rtos/linux.c
src/server/gdb_server.c

index a975a7a0c29881c69a117d342c137f16d2c1e24c..f83d8942d38fb717f6e5e5367f00632d46f1df7a 100644 (file)
@@ -119,7 +119,7 @@ int xilinx_read_bit_file(struct xilinx_bit_file *bit_file, const char *filename)
        if (read_section(input_file, 4, 'e', &bit_file->length, &bit_file->data) != ERROR_OK)
                return ERROR_PLD_FILE_LOAD_FAILED;
 
-       LOG_DEBUG("bit_file: %s %s %s,%s %" PRIi32 "", bit_file->source_file, bit_file->part_name,
+       LOG_DEBUG("bit_file: %s %s %s,%s %" PRIu32 "", bit_file->source_file, bit_file->part_name,
                bit_file->date, bit_file->time, bit_file->length);
 
        fclose(input_file);
index 9605533aa448d79ddbb415f6a4d7cf5f3085b3e5..302641bae4bb549af64c305a277907f205c26c23 100644 (file)
@@ -248,7 +248,7 @@ static const struct rtos_register_stacking *get_stacking_info_arm926ejs(const st
                LOG_DEBUG("  solicited stack");
                return param->stacking_info + 0;
        } else {
-               LOG_DEBUG("  interrupt stack: %u", flag);
+               LOG_DEBUG("  interrupt stack: %" PRIu32, flag);
                return param->stacking_info + 1;
        }
 }
index 38e42a04117687d15b604a19db8b2e09a885bd96..e0789aa63acf0887b79ab44a94582725ba75346e 100644 (file)
@@ -281,7 +281,7 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id,
 
        struct reg *reg = register_get_by_number(curr->reg_cache, reg_num, true);
        if (!reg) {
-               LOG_ERROR("Couldn't find register %d in thread %" PRId64 ".", reg_num,
+               LOG_ERROR("Couldn't find register %" PRIu32 " in thread %" PRId64 ".", reg_num,
                                thread_id);
                return ERROR_FAIL;
        }
index dbbf97b4467ae2a3de26c6345b7cb6783a97b288..44e132d36ea0e6d13307e356921353dbcff75d32 100644 (file)
@@ -1483,13 +1483,13 @@ static char *linux_ps_command(struct target *target)
                                if (temp->context)
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       "%" PRIu32 "\t\t%" PRIu32 "\t\t%" PRIx32 "\t\t%s\n",
                                                        temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                                else
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       "%" PRIu32 "\t\t%" PRIu32 "\t\t%" PRIx32 "\t\t%s\n",
                                                        temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                        }
index 85d3c14b12e2bc0b02bb37f154ac2e2344d5eed9..c369665547f14c545a832c824fea5b87a23759d0 100644 (file)
@@ -1388,8 +1388,8 @@ static int gdb_set_register_packet(struct connection *connection,
        }
 
        if (chars != (DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2)) {
-               LOG_ERROR("gdb sent %d bits for a %d-bit register (%s)",
-                               (int) chars * 4, reg_list[reg_num]->size, reg_list[reg_num]->name);
+               LOG_ERROR("gdb sent %zu bits for a %" PRIu32 "-bit register (%s)",
+                               chars * 4, reg_list[reg_num]->size, reg_list[reg_num]->name);
                free(bin_buf);
                free(reg_list);
                return ERROR_SERVER_REMOTE_CLOSED;
@@ -2050,7 +2050,7 @@ static int gdb_generate_reg_type_description(struct target *target,
                }
                /* <vector id="id" type="type" count="count"/> */
                xml_printf(&retval, tdesc, pos, size,
-                               "<vector id=\"%s\" type=\"%s\" count=\"%d\"/>\n",
+                               "<vector id=\"%s\" type=\"%s\" count=\"%" PRIu32 "\"/>\n",
                                type->id, type->reg_type_vector->type->id,
                                type->reg_type_vector->count);
 
@@ -2097,11 +2097,11 @@ static int gdb_generate_reg_type_description(struct target *target,
                         *  <field name="name" start="start" end="end"/> ...
                         * </struct> */
                        xml_printf(&retval, tdesc, pos, size,
-                                       "<struct id=\"%s\" size=\"%d\">\n",
+                                       "<struct id=\"%s\" size=\"%" PRIu32 "\">\n",
                                        type->id, type->reg_type_struct->size);
                        while (field != NULL) {
                                xml_printf(&retval, tdesc, pos, size,
-                                               "<field name=\"%s\" start=\"%d\" end=\"%d\" type=\"%s\" />\n",
+                                               "<field name=\"%s\" start=\"%" PRIu32 "\" end=\"%" PRIu32 "\" type=\"%s\" />\n",
                                                field->name, field->bitfield->start, field->bitfield->end,
                                                gdb_get_reg_type_name(field->bitfield->type));
 
@@ -2142,14 +2142,14 @@ static int gdb_generate_reg_type_description(struct target *target,
                 *  <field name="name" start="start" end="end"/> ...
                 * </flags> */
                xml_printf(&retval, tdesc, pos, size,
-                               "<flags id=\"%s\" size=\"%d\">\n",
+                               "<flags id=\"%s\" size=\"%" PRIu32 "\">\n",
                                type->id, type->reg_type_flags->size);
 
                struct reg_data_type_flags_field *field;
                field = type->reg_type_flags->fields;
                while (field != NULL) {
                        xml_printf(&retval, tdesc, pos, size,
-                                       "<field name=\"%s\" start=\"%d\" end=\"%d\" type=\"%s\" />\n",
+                                       "<field name=\"%s\" start=\"%" PRIu32 "\" end=\"%" PRIu32 "\" type=\"%s\" />\n",
                                        field->name, field->bitfield->start, field->bitfield->end,
                                        gdb_get_reg_type_name(field->bitfield->type));
 
@@ -2302,9 +2302,9 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
                                xml_printf(&retval, &tdesc, &pos, &size,
                                                "<reg name=\"%s\"", reg_list[i]->name);
                                xml_printf(&retval, &tdesc, &pos, &size,
-                                               " bitsize=\"%d\"", reg_list[i]->size);
+                                               " bitsize=\"%" PRIu32 "\"", reg_list[i]->size);
                                xml_printf(&retval, &tdesc, &pos, &size,
-                                               " regnum=\"%d\"", reg_list[i]->number);
+                                               " regnum=\"%" PRIu32 "\"", reg_list[i]->number);
                                if (reg_list[i]->caller_save)
                                        xml_printf(&retval, &tdesc, &pos, &size,
                                                        " save-restore=\"yes\"");

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)