- int retval = breakpoint_add(target, addr, length, hw);
- if (ERROR_OK == retval)
- command_print(cmd_ctx, "breakpoint set at 0x%8.8" PRIx32 "", addr);
- else
- LOG_ERROR("Failure setting breakpoint");
- return retval;
+
+ if (asid == 0)
+ { int retval = breakpoint_add(target, addr, length, hw);
+ if (ERROR_OK == retval)
+ command_print(cmd_ctx, "breakpoint set at 0x%8.8" PRIx32 "", addr);
+ else
+ {
+ LOG_ERROR("Failure setting breakpoint, the same address(IVA) is already used");
+ return retval;
+ }
+ }
+ else if (addr == 0)
+ {
+ int 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
+ {
+ LOG_ERROR("Failure setting breakpoint, the same address(CONTEXTID) is already used");
+ return retval;
+ }
+ }
+ else
+ {
+ int 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
+ {
+ LOG_ERROR("Failure setting breakpoint, the same address is already used");
+ return retval;
+ }
+ }
+ return ERROR_OK;
+
+