]> git.sur5r.net Git - openocd/commitdiff
Bogus error message in GDB removed
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 4 Mar 2008 21:12:01 +0000 (21:12 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 4 Mar 2008 21:12:01 +0000 (21:12 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@443 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/flash/flash.c
src/flash/flash.h
src/server/gdb_server.c

index db4449d51720d8cbaf83c9df3592342749c3c05d..92ac6fd6c315c1ee918fb5a2179bec0909557611 100644 (file)
@@ -181,6 +181,17 @@ flash_bank_t *get_flash_bank_by_num_noprobe(int num)
        return NULL;
 }
 
+int flash_get_bank_count()
+{
+       flash_bank_t *p;
+       int i = 0;
+       for (p = flash_banks; p; p = p->next)
+       {
+               i++;
+       }
+       return i;
+}
+
 flash_bank_t *get_flash_bank_by_num(int num)
 {
        flash_bank_t *p = get_flash_bank_by_num_noprobe(num);
index 7ba516abd69758684d4bd9bc5f640329cc68b9dc..2e6c1ec0949a9736f729efd1516784c62aa39239 100644 (file)
@@ -77,6 +77,7 @@ extern int flash_init_drivers(struct command_context_s *cmd_ctx);
 extern int flash_erase_address_range(target_t *target, u32 addr, u32 length);
 extern int flash_write(target_t *target, image_t *image, u32 *written, int erase);
 extern void flash_set_dirty(void);
+extern int flash_get_bank_count();
 
 extern flash_bank_t *get_flash_bank_by_num(int num);
 extern flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr);
index 74722e108e99b13a5875d2d6f237544f8ed6a2e5..a8b6023131e9fb967c8a8996c32d786704375b37 100644 (file)
@@ -1560,8 +1560,8 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
 
                xml_printf(&retval, &xml, &pos, &size, "<memory-map>\n");
 
-               int i = 0;
-               for (;;)
+               int i;
+               for (i=0; i<flash_get_bank_count(); i++)
                {
                        p = get_flash_bank_by_num(i);
                        if (p == NULL)
@@ -1575,7 +1575,6 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
                                "<property name=\"blocksize\">0x%x</property>\n" \
                                "</memory>\n", \
                                p->base, p->size, blocksize);
-                       i++;
                }
 
                xml_printf(&retval, &xml, &pos, &size, "</memory-map>\n");