@@ -3992,19 +3992,19 @@ static int handle_bp_command_set(struct command_invocation *cmd,
39923992static COMMAND_HELPER (parse_bp_length , uint32_t asid , target_addr_t addr ,
39933993 int hw , unsigned int * length )
39943994{
3995- if (strcmp (CMD_ARGV [1 ], "default ") == 0 ) {
3996- struct target * target = get_current_target (CMD_CTX );
3997- int ret_errno = target_get_default_breakpoint_size (target , addr , asid , hw , length );
3998- if (ret_errno == ERROR_NOT_IMPLEMENTED ) {
3999- command_print (CMD , "Default breakpoint size derivation is "
4000- "not implemented on target %s" , target_name (target ));
4001- } else if (ret_errno != ERROR_OK ) {
4002- command_print (CMD , "Unknown error when deriving default breakpoint size" );
4003- }
4004- return ret_errno ;
3995+ if (strcmp (CMD_ARGV [1 ], "default ") != 0 ) {
3996+ COMMAND_PARSE_NUMBER (u32 , CMD_ARGV [1 ], * length );
3997+ return ERROR_OK ;
40053998 }
4006- COMMAND_PARSE_NUMBER (u32 , CMD_ARGV [1 ], * length );
4007- return ERROR_OK ;
3999+ struct target * target = get_current_target (CMD_CTX );
4000+ int ret_errno = target_get_default_breakpoint_size (target , addr , asid , hw , length );
4001+ if (ret_errno == ERROR_NOT_IMPLEMENTED ) {
4002+ command_print (CMD , "Default breakpoint size derivation is "
4003+ "not implemented on target %s" , target_name (target ));
4004+ } else if (ret_errno != ERROR_OK ) {
4005+ command_print (CMD , "Unknown error when deriving default breakpoint size" );
4006+ }
4007+ return ret_errno ;
40084008}
40094009
40104010COMMAND_HANDLER (handle_bp_command )
@@ -4013,6 +4013,7 @@ COMMAND_HANDLER(handle_bp_command)
40134013 uint32_t asid ;
40144014 uint32_t length ;
40154015 int hw = BKPT_SOFT ;
4016+ int ret_errno ;
40164017
40174018 switch (CMD_ARGC ) {
40184019 case 0 :
@@ -4021,29 +4022,37 @@ COMMAND_HANDLER(handle_bp_command)
40214022 case 2 :
40224023 asid = 0 ;
40234024 COMMAND_PARSE_ADDRESS (CMD_ARGV [0 ], addr );
4024- CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4025+ ret_errno = CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4026+ if (ret_errno != ERROR_OK )
4027+ return ret_errno ;
40254028 return handle_bp_command_set (CMD , addr , asid , length , hw );
40264029
40274030 case 3 :
40284031 if (strcmp (CMD_ARGV [2 ], "hw" ) == 0 ) {
40294032 hw = BKPT_HARD ;
40304033 COMMAND_PARSE_ADDRESS (CMD_ARGV [0 ], addr );
40314034 asid = 0 ;
4032- CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4035+ ret_errno = CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4036+ if (ret_errno != ERROR_OK )
4037+ return ret_errno ;
40334038 return handle_bp_command_set (CMD , addr , asid , length , hw );
40344039 } else if (strcmp (CMD_ARGV [2 ], "hw_ctx" ) == 0 ) {
40354040 hw = BKPT_HARD ;
40364041 COMMAND_PARSE_NUMBER (u32 , CMD_ARGV [0 ], asid );
40374042 addr = 0 ;
4038- CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4043+ ret_errno = CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4044+ if (ret_errno != ERROR_OK )
4045+ return ret_errno ;
40394046 return handle_bp_command_set (CMD , addr , asid , length , hw );
40404047 }
40414048 /* fallthrough */
40424049 case 4 :
40434050 hw = BKPT_HARD ;
40444051 COMMAND_PARSE_ADDRESS (CMD_ARGV [0 ], addr );
40454052 COMMAND_PARSE_NUMBER (u32 , CMD_ARGV [1 ], asid );
4046- CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4053+ ret_errno = CALL_COMMAND_HANDLER (parse_bp_length , asid , addr , hw , & length );
4054+ if (ret_errno != ERROR_OK )
4055+ return ret_errno ;
40474056 return handle_bp_command_set (CMD , addr , asid , length , hw );
40484057
40494058 default :
0 commit comments