Fix the monitor 'screendump' command
cover Fix the monitor 'screendump' command
The screendump command was recently broken in qemu-svn. Since many test suites depend on the command, it's important to get it fixed.
The following two patches do just that.
console.c | 5 +++++ hw/vga.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-)
PATCH 1/2 fix vga screendump
Commit 4812 ("Implement resolution switching in common console code") uses qemu_console_resize() instead of dpy_resize(). This means console->ds is examined instead of the VGA private ds, and the resize does not take place, leading to a segfault.
Fix by modifying the DisplayState directly rather than swapping the pointer.
--- hw/vga.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
hw/vga.c +3 -4
@@ -2281,11 +2281,11 @@ int ppm_save(const char *filename, uint8_t *data,static void vga_screen_dump (void *opaque,const char *filename) {VGAState *s = (VGAState *)opaque; -DisplayState *saved_ds, ds1, *ds = &ds1; +DisplayState saved_ds, *ds = s->ds;/* XXX: this is a little hackish */ vga_invalidate_display (s); - saved_ds = s->ds; + saved_ds = *s->ds;memset (ds,0 ,sizeof (DisplayState)); ds->dpy_update = vga_save_dpy_update;
@@ -2293,7 +2293,6 @@ static void vga_screen_dump(void *opaque, const char *filename) ds->dpy_refresh = vga_save_dpy_refresh; ds->depth =32 ; - s->ds = ds; s->graphic_mode =-1 ;vga_update_display (s);
@@ -2302,5 +2301,5 @@ static void vga_screen_dump(void *opaque, const char *filename) s->ds->linesize);qemu_free (ds->data); } - s->ds = saved_ds; + *s->ds = saved_ds; }
Signature · 1 line
1.5.6.1
PATCH 2/2 fix screendump with multiple consoles
In reply to Avi Kivitypretend to be the active console while a screendump takes place.
--- console.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
console.c +5 -0
@@ -167,10 +167,15 @@ void vga_hw_invalidate(void)void vga_hw_screen_dump (const char *filename) { +TextConsole *previous_active_console; + + previous_active_console = active_console; + active_console = consoles[0 ];/* There is currently no was of specifying which screen we want to dump, so always dump the dirst one. */ if (consoles[0 ]->hw_screen_dump) consoles[0 ]->hw_screen_dump (consoles[0 ]->hw, filename); + active_console = previous_active_console; }void vga_hw_text_update (console_ch_t *chardata)
Signature · 1 line
1.5.6.1
Quoted 5 lines · Avi Kivity
The screendump command was recently broken in qemu-svn. Since many test suites depend on the command, it's important to get it fixed.
The following two patches do just that.
Another patch is needed (attached).
Signature · 1 line
error compiling committee.c: too many arguments to function
console.c +2 -1
@@ -1334,7 +1334,8 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)void qemu_console_resize (QEMUConsole *console,int width,int height) { -if (console->g_width != width || console->g_height != height) { +if (console->g_width != width || console->g_height != height + || !console->ds->data) { console->g_width = width; console->g_height = height;if (active_console == console) {