This is an automated email from Gerrit.

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

-- gerrit

commit 3ee49428f59bac832d101844baf17655d45756ab
Author: Salvador Arroyo <[email protected]>
Date:   Sat Oct 11 23:37:08 2014 +0200

    avoid segfaulting when attempting to set an unavailable type of breackpoint
    
    For example "bp 0x20000000 8 2" makes openocd segfaulting on a
    stm32f4x Discovery board.
    
    Change-Id: I1ddd46b1fa9ade78db2234ed975ccefb72539331
    Signed-off-by: Salvador Arroyo <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index d7a2c48..d659160 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3304,9 +3304,10 @@ static int handle_bp_command_set(struct command_context 
*cmd_ctx,
                uint32_t addr, uint32_t asid, uint32_t length, int hw)
 {
        struct target *target = get_current_target(cmd_ctx);
+       int retval;
 
        if (asid == 0) {
-               int retval = breakpoint_add(target, addr, length, hw);
+               retval = breakpoint_add(target, addr, length, hw);
                if (ERROR_OK == retval)
                        command_print(cmd_ctx, "breakpoint set at 0x%8.8" 
PRIx32 "", addr);
                else {
@@ -3314,7 +3315,11 @@ static int handle_bp_command_set(struct command_context 
*cmd_ctx,
                        return retval;
                }
        } else if (addr == 0) {
-               int retval = context_breakpoint_add(target, asid, length, hw);
+               if (target->type->add_context_breakpoint == NULL) {
+                       LOG_WARNING("Context breakpoint not available");
+                       return ERROR_OK;
+               }
+               retval = context_breakpoint_add(target, asid, length, hw);
                if (ERROR_OK == retval)
                        command_print(cmd_ctx, "Context breakpoint set at 
0x%8.8" PRIx32 "", asid);
                else {
@@ -3322,7 +3327,11 @@ static int handle_bp_command_set(struct command_context 
*cmd_ctx,
                        return retval;
                }
        } else {
-               int retval = hybrid_breakpoint_add(target, addr, asid, length, 
hw);
+               if (target->type->add_hybrid_breakpoint == NULL) {
+                       LOG_WARNING("Hybrid breakpoint not available");
+                       return ERROR_OK;
+               }
+               retval = hybrid_breakpoint_add(target, addr, asid, length, hw);
                if (ERROR_OK == retval)
                        command_print(cmd_ctx, "Hybrid breakpoint set at 
0x%8.8" PRIx32 "", asid);
                else {

-- 

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to