gdb server: new feature, add stop reason in stop reply packet for gdb
[openocd.git] / src / target / nds32_v2.c
index 90961d7d8249ba95759ce4db40de8348c707d43c..3f5f636fd79a9b3cc205186ac1c79f000231c057 100644 (file)
@@ -534,6 +534,42 @@ static int nds32_v2_get_exception_address(struct nds32 *nds32,
        return ERROR_OK;
 }
 
+/**
+ * find out which watchpoint hits
+ * get exception address and compare the address to watchpoints
+ */
+static int nds32_v2_hit_watchpoint(struct target *target,
+               struct watchpoint **hit_watchpoint)
+{
+       uint32_t exception_address;
+       struct watchpoint *wp;
+       static struct watchpoint scan_all_watchpoint;
+       struct nds32 *nds32 = target_to_nds32(target);
+
+       scan_all_watchpoint.address = 0;
+       scan_all_watchpoint.rw = WPT_WRITE;
+       scan_all_watchpoint.next = 0;
+       scan_all_watchpoint.unique_id = 0x5CA8;
+
+       exception_address = nds32->watched_address;
+
+       if (exception_address == 0) {
+               /* send watch:0 to tell GDB to do software scan for hitting multiple watchpoints */
+               *hit_watchpoint = &scan_all_watchpoint;
+               return ERROR_OK;
+       }
+
+       for (wp = target->watchpoints; wp; wp = wp->next) {
+               if (((exception_address ^ wp->address) & (~wp->mask)) == 0) {
+                       /* TODO: dispel false match */
+                       *hit_watchpoint = wp;
+                       return ERROR_OK;
+               }
+       }
+
+       return ERROR_FAIL;
+}
+
 static int nds32_v2_run_algorithm(struct target *target,
                int num_mem_params,
                struct mem_param *mem_params,
@@ -747,6 +783,7 @@ struct target_type nds32_v2_target = {
        .remove_breakpoint = nds32_v2_remove_breakpoint,
        .add_watchpoint = nds32_v2_add_watchpoint,
        .remove_watchpoint = nds32_v2_remove_watchpoint,
+       .hit_watchpoint = nds32_v2_hit_watchpoint,
 
        /* MMU */
        .mmu = nds32_mmu,

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)