]> git.sur5r.net Git - openocd/commitdiff
gdb: fix multi core gdb issue
authorPhilip Nye <philipnye@users.sf.net>
Mon, 14 Nov 2011 19:44:32 +0000 (19:44 +0000)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Thu, 17 Nov 2011 23:01:30 +0000 (23:01 +0000)
gdb_memory_map() correctly calculates the target specific number of flash banks, but then uses the total number (all targets) instead of the target specific number to construct its GDB response, causing a crash.

Change-Id: I3f8639b3e90303a59753ebe140ce4fff96fd5db0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/199
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/server/gdb_server.c

index 7c55e7cd952a7ccadf589fe1ffe4883abc72d643..cbc2b401c37596cd8134ea8b313dd2acf9d1ada9 100644 (file)
@@ -1741,7 +1741,7 @@ static int gdb_memory_map(struct connection *connection,
        qsort(banks, target_flash_banks, sizeof(struct flash_bank *),
                        compare_bank);
 
-       for (i = 0; i < flash_get_bank_count(); i++) {
+       for (i = 0; i < target_flash_banks; i++) {
                int j;
                unsigned sector_size = 0;
                uint32_t start;
@@ -2451,7 +2451,7 @@ static int gdb_target_start(struct target *target, const char *port)
                {
                        curr = head->target;
                        if (curr != target) curr->gdb_service = gdb_service;
-                       head = head->next;      
+                       head = head->next;
                }
        }
        return ret;
@@ -2462,7 +2462,7 @@ static int gdb_target_add_one(struct target *target)
        /*  one gdb instance per smp list */
        if ((target->smp) && (target->gdb_service)) return ERROR_OK;
        int retval = gdb_target_start(target, gdb_port_next);
-       if (retval == ERROR_OK) 
+       if (retval == ERROR_OK)
        {
                long portnumber;
                /* If we can parse the port number