Conform to C99 integer types format specifiers
[openocd.git] / src / rtos / linux.c
index 68b2d1d2faec84792bd9ae752b78859856f2a072..b98cf453157a08ff1895b09ce17590b6a0f2aad2 100644 (file)
@@ -16,7 +16,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -140,9 +140,9 @@ static int linux_read_memory(struct target *target,
                return ERROR_FAIL;
        }
 #ifdef PHYS
-       target->type->read_phys_memory(target, pa, size, count, buffer);
+       target_read_phys_memory(target, pa, size, count, buffer);
 #endif
-       target->type->read_memory(target, address, size, count, buffer);
+       target_read_memory(target, address, size, count, buffer);
        return ERROR_OK;
 }
 
@@ -160,7 +160,7 @@ int fill_buffer(struct target *target, uint32_t addr, uint8_t *buffer)
 {
 
        if ((addr & 0xfffffffc) != addr)
-               LOG_INFO("unaligned address %x!!", addr);
+               LOG_INFO("unaligned address %" PRIx32 "!!", addr);
 
        int retval = linux_read_memory(target, addr, 4, 1, buffer);
        return retval;
@@ -217,7 +217,7 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
                if (found == 0) {
                        LOG_ERROR
                        (
-                               "current thread %" PRIx64 ": no target to perform access of core id %x",
+                               "current thread %" PRIx64 ": no target to perform access of core id %" PRIx32,
                                thread_id,
                                next->core_id);
                        return ERROR_FAIL;
@@ -226,7 +226,8 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
                /*LOG_INFO("thread %lx current on core %x",thread_id,
                 * target->coreid);*/
                retval =
-                       target_get_gdb_reg_list(target, &reg_list, &reg_list_size);
+                       target_get_gdb_reg_list(target, &reg_list, &reg_list_size,
+                                       REG_CLASS_GENERAL);
 
                if (retval != ERROR_OK)
                        return retval;
@@ -234,6 +235,8 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
                for (i = 0; i < reg_list_size; i++)
                        reg_packet_size += reg_list[i]->size;
 
+               assert(reg_packet_size > 0);
+
                *hex_reg_list = malloc(DIV_ROUND_UP(reg_packet_size, 8) * 2);
 
                hex_string = *hex_reg_list;
@@ -496,7 +499,7 @@ int get_current(struct target *target, int create)
                int retval;
 
                if (target_get_gdb_reg_list(head->target, &reg_list,
-                               &reg_list_size) != ERROR_OK) {
+                               &reg_list_size, REG_CLASS_GENERAL) != ERROR_OK) {
                        free(buffer);
                        return ERROR_TARGET_FAILURE;
                }
@@ -530,7 +533,7 @@ int get_current(struct target *target, int create)
                                        LOG_ERROR
                                                ("error in linux current thread update");
 
-                               if (create) {
+                               if (create && ct) {
                                        struct threads *t;
                                        t = calloc(1, sizeof(struct threads));
                                        t->base_addr = ct->TS;
@@ -1137,13 +1140,12 @@ int linux_gdb_thread_packet(struct target *target,
        char *tmp_str = out_str;
        tmp_str += sprintf(tmp_str, "m");
        struct threads *temp = linux_os->thread_list;
-       tmp_str += sprintf(tmp_str, "%016" PRIx64, temp->threadid);
-       temp = temp->next;
 
        while (temp != NULL) {
-               tmp_str += sprintf(tmp_str, ",");
                tmp_str += sprintf(tmp_str, "%016" PRIx64, temp->threadid);
                temp = temp->next;
+               if (temp)
+                       tmp_str += sprintf(tmp_str, ",");
        }
 
        gdb_put_packet(connection, out_str, strlen(out_str));
@@ -1522,7 +1524,7 @@ static int linux_os_create(struct target *target)
        os_linux->threads_needs_update = 0;
        os_linux->threadid_count = 1;
        os_linux->current_threads = NULL;
-       target->rtos->rtos_specific_params = (void *)os_linux;
+       target->rtos->rtos_specific_params = os_linux;
        ct->core_id = target->coreid;
        ct->threadid = -1;
        ct->TS = 0xdeadbeef;
@@ -1569,14 +1571,14 @@ static char *linux_ps_command(struct target *target)
                                if (temp->context)
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%d\t\t%d\t\t%x\t\t%s\n",
-                                                       (int)temp->pid, temp->oncpu,
+                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                                else
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%d\t\t%d\t\t%x\t\t%s\n",
-                                                       (int)temp->pid, temp->oncpu,
+                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                        }
 

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)