@@ -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) {
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 <froydnj@codesourcery.com> --- gdbstub.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-)