[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] gdbstub: add qSymbol handling for TARGET_MIPS
From: |
Nathan Froyd |
Subject: |
[Qemu-devel] [PATCH 6/6] gdbstub: add qSymbol handling for TARGET_MIPS |
Date: |
Fri, 17 Jul 2009 13:33:22 -0700 |
QEMU needs to know the address of _mdi_syscall so that breakpoints can
be set appropriately. But if QEMU is started from within GDB as:
(gdb) target remote | qemu -M mipssim -s -S ... -kernel /dev/null
...
(gdb) load
then QEMU's ELF loader never gets a chance to grovel through the ELF
file to look for the .sdeosabi section.
Therefore, the GDB stub needs to know how to ask GDB for the address of
_mdi_syscall so that the necessary breakpoint can be set.
Signed-off-by: Nathan Froyd <address@hidden>
---
gdbstub.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index bb38971..d881a66 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1937,6 +1937,35 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, buf);
}
break;
+ } else if (strncmp(p, "Symbol:", 7) == 0) {
+#if defined(TARGET_MIPS) && !defined(TARGET_MIPS64) &&
!defined(CONFIG_USER_ONLY)
+#define MDI_SYSCALL_SYMBOL "_mdi_syscall"
+ if (strncmp(p+7, ":", 1) == 0) {
+ /* GDB is telling us we can ask for symbols. Look for
+ _mdi_syscall. */
+ memtohex((char *)mem_buf, (const uint8_t *)MDI_SYSCALL_SYMBOL,
+ strlen(MDI_SYSCALL_SYMBOL));
+ mem_buf[strlen(MDI_SYSCALL_SYMBOL)*2] = 0;
+ snprintf(buf, sizeof(buf), "qSymbol:%s", mem_buf);
+ put_packet(s, buf);
+ break;
+ } else {
+ /* A response from a previous query. */
+ if (*(p+7) != ':') {
+ addr = strtoull(p+7, (char **)&p, 16);
+ hextomem(mem_buf, p+1, strlen(MDI_SYSCALL_SYMBOL)*2);
+
+ if (memcmp(mem_buf, MDI_SYSCALL_SYMBOL,
+ strlen(MDI_SYSCALL_SYMBOL)) == 0) {
+ install_semihosting_breakpoint(s->c_cpu, addr);
+ }
+ }
+ }
+ /* All done, regardless of whether we got the right symbol. */
+ put_packet(s, "OK");
+ break;
+#undef MDI_SYSCALL_SYMBOL
+#endif
}
#ifdef CONFIG_USER_ONLY
else if (strncmp(p, "Offsets", 7) == 0) {
--
1.6.3.2
- [Qemu-devel] [PATCH 0/6] target-mips: add MDI semihosting, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 1/6] sysemu: add section_callback argument to ELF loader, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 5/6] enable --semihosting option for TARGET_MIPS, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 4/6] target-mips: add MDI semihosting support to mipssim machine, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 3/6] add implementation of MIPS semihosting, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 2/6] add softmmu_target_strlen, Nathan Froyd, 2009/07/17
- [Qemu-devel] [PATCH 6/6] gdbstub: add qSymbol handling for TARGET_MIPS,
Nathan Froyd <=