Commit d6fc1b397bca686d2ac92f4e8f470c98472a3c4d

Authored by aliguori
1 parent 6b917547

gdbstub: Return appropriate watch message to gdb (Jan Kiszka)

Return the appropriate type prefix (r, a, none) when reporting
watchpoint hits to the gdb front-end.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5737 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 15 additions and 2 deletions
gdbstub.c
... ... @@ -1493,6 +1493,7 @@ static void gdb_vm_stopped(void *opaque, int reason)
1493 1493 {
1494 1494 GDBState *s = opaque;
1495 1495 char buf[256];
  1496 + const char *type;
1496 1497 int ret;
1497 1498  
1498 1499 if (s->state == RS_SYSCALL)
... ... @@ -1503,8 +1504,20 @@ static void gdb_vm_stopped(void *opaque, int reason)
1503 1504  
1504 1505 if (reason == EXCP_DEBUG) {
1505 1506 if (s->env->watchpoint_hit) {
1506   - snprintf(buf, sizeof(buf), "T%02xwatch:" TARGET_FMT_lx ";",
1507   - SIGTRAP,
  1507 + switch (s->env->watchpoint[s->env->watchpoint_hit - 1].type &
  1508 + (PAGE_READ | PAGE_WRITE)) {
  1509 + case PAGE_READ:
  1510 + type = "r";
  1511 + break;
  1512 + case PAGE_READ | PAGE_WRITE:
  1513 + type = "a";
  1514 + break;
  1515 + default:
  1516 + type = "";
  1517 + break;
  1518 + }
  1519 + snprintf(buf, sizeof(buf), "T%02x%swatch:" TARGET_FMT_lx ";",
  1520 + SIGTRAP, type,
1508 1521 s->env->watchpoint[s->env->watchpoint_hit - 1].vaddr);
1509 1522 put_packet(s, buf);
1510 1523 s->env->watchpoint_hit = 0;
... ...