* [Qemu-devel] [PATCH] Enable monitor commands in GDB stub
@ 2008-12-10 22:36 Julian Stecklina
2009-02-03 4:16 ` [Qemu-devel] " Julian Stecklina
0 siblings, 1 reply; 2+ messages in thread
From: Julian Stecklina @ 2008-12-10 22:36 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 579 bytes --]
Hello,
I have added support for the qRcmd packet to the GDB stub. This lets
you issue "monitor foo" in GDB and have it executed in qemu's monitor.
A quick test suggests that it works fine, but I am quite new to the
qemu codebase, so I don't know if calling 'monitor_handle_command'
directly from the GDB stub violates any assumptions.
Please keep me CC'd.
Regards,
--
Julian Stecklina
Well, take it from an old hand: the only reason it would be easier to
program in C is that you can't easily express complex problems in C,
so you don't. - Erik Naggum (in comp.lang.lisp)
[-- Attachment #2: Add qRcmd support in GDB stub --]
[-- Type: text/x-diff, Size: 1948 bytes --]
diff --git a/console.h b/console.h
index 6ee40cc..3ae4f86 100644
--- a/console.h
+++ b/console.h
@@ -192,6 +192,7 @@ extern uint8_t _translate_keycode(const int key);
does not need to include console.h */
/* monitor.c */
void monitor_init(CharDriverState *hd, int show_banner);
+void monitor_handle_command(const char *cmdline);
void term_puts(const char *str);
void term_vprintf(const char *fmt, va_list ap);
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
diff --git a/gdbstub.c b/gdbstub.c
index 72feac6..a1ad53d 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1290,6 +1290,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
char buf[MAX_PACKET_LENGTH];
uint8_t mem_buf[MAX_PACKET_LENGTH];
uint8_t *registers;
+ char *monitor_cmd;
target_ulong addr, len;
#ifdef DEBUG_GDB
@@ -1529,7 +1530,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
case 'q':
case 'Q':
/* parse any 'q' packets here */
- if (!strcmp(p,"qemu.sstepbits")) {
+ if (strncmp(p, "Rcmd,", 5) == 0) {
+ p += 5;
+ len = strlen(p) / 2;
+ monitor_cmd = mem_buf;
+ hextomem((uint8_t *)monitor_cmd, p, len);
+ monitor_cmd[len] = 0;
+ monitor_handle_command(monitor_cmd);
+ put_packet(s, "OK");
+ break;
+ } else if (!strcmp(p,"qemu.sstepbits")) {
/* Query Breakpoint bit definitions */
snprintf(buf, sizeof(buf), "ENABLE=%x,NOIRQ=%x,NOTIMER=%x",
SSTEP_ENABLE,
diff --git a/monitor.c b/monitor.c
index 0d55433..fc21ae3 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2215,7 +2215,7 @@ static int default_fmt_size = 4;
#define MAX_ARGS 16
-static void monitor_handle_command(const char *cmdline)
+void monitor_handle_command(const char *cmdline)
{
const char *p, *pstart, *typestr;
char *q;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH] Enable monitor commands in GDB stub
2008-12-10 22:36 [Qemu-devel] [PATCH] Enable monitor commands in GDB stub Julian Stecklina
@ 2009-02-03 4:16 ` Julian Stecklina
0 siblings, 0 replies; 2+ messages in thread
From: Julian Stecklina @ 2009-02-03 4:16 UTC (permalink / raw)
To: qemu-devel
Julian Stecklina <jsteckli@os.inf.tu-dresden.de> writes:
> Hello,
>
> I have added support for the qRcmd packet to the GDB stub. This lets
> you issue "monitor foo" in GDB and have it executed in qemu's monitor.
>
> A quick test suggests that it works fine, but I am quite new to the
> qemu codebase, so I don't know if calling 'monitor_handle_command'
> directly from the GDB stub violates any assumptions.
Any comments on the patch? I use it since I posted this patch in
December without problems.
Regards,
--
Julian Stecklina
Well, take it from an old hand: the only reason it would be easier to
program in C is that you can't easily express complex problems in C,
so you don't. - Erik Naggum (in comp.lang.lisp)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-03 4:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 22:36 [Qemu-devel] [PATCH] Enable monitor commands in GDB stub Julian Stecklina
2009-02-03 4:16 ` [Qemu-devel] " Julian Stecklina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).