This is an automated email from Gerrit.

Paul Fertser ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1446

-- gerrit

commit 7d17a90a26c917aaf23e2e04eddc8a4508156835
Author: Paul Fertser <[email protected]>
Date:   Sun Jun 16 11:11:32 2013 +0400

    armv4_5: prevent segfault when gdb connects to an underinitialised target
    
    This prevents segmentation fault that can occur on cortex_a targets if
    gdb connection is established before it's halted and CPSR examined.
    
    Change-Id: Id996200e0fd95440496509c1fecaabbdbf425e23
    Tested-by: Henrik Nordstrom <[email protected]>
    Signed-off-by: Paul Fertser <[email protected]>

diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index 10f84d8..91830f5 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -429,7 +429,11 @@ struct reg *arm_reg_current(struct arm *arm, unsigned 
regnum)
        if (regnum > 16)
                return NULL;
 
-       r = arm->core_cache->reg_list + arm->map[regnum];
+       if (!arm->map) {
+               LOG_ERROR("Register map is not available yet, the target is not 
fully initialised");
+               r = arm->core_cache->reg_list + regnum;
+       } else
+               r = arm->core_cache->reg_list + arm->map[regnum];
 
        /* e.g. invalid CPSR said "secure monitor" mode on a core
         * that doesn't support it...

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to