"Cao,Bing Bu" <m...@linux.vnet.ibm.com> writes: > I have tested the issue use "-vga none -nographic" option. > QEMU segment faults. > > But i think there is no any text and graphic console created in this case. > The console[0] is NULL. > > The vga_hw_screen_dump() should return before console_select(). > What do you think? > > > --- > console.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/console.c b/console.c > index f6fe441..957948e 100644 > --- a/console.c > +++ b/console.c > @@ -184,6 +184,9 @@ void vga_hw_screen_dump(const char *filename) > console_select(0); > if (consoles[0] && consoles[0]->hw_screen_dump) { > consoles[0]->hw_screen_dump(consoles[0]->hw, filename); > + } else { > + fprintf(stderr,"no any console,could not screen dump \n"); > + return; > } > > console_select(previous_active_console->index);
Tab damage. Subject misspells "screendump". Error message could use some polish. Suggest "Can't screendump without a console". Please don't use printf & friends for output to the monitor user, it doesn't go to the monitor unless the monitor happens to be on stdio. Use error_printf() & friends. Except when the command is in QMP, and you need nice error reports in QMP. Then use qerror_report(). Yes, that's a pain to use. Except when the command is already implemented in QAPI. Then you use error_set() instead. Yes, that one's a PITA, too.