From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Insight Maling List Subject: [PATCH] "disassemble" crashes in console window Date: Tue, 21 Aug 2001 09:55:00 -0000 Message-id: X-SW-Source: 2001-q3/msg00165.html Hi, When disassembling in the console window, Insight would often crash. This happens because _initialize_gdbarch calls INIT_DISASSEMBLE_INFO_NO_ARCH with gdb_stdout, which is the vanilla gdb_stdout from top.c. Later when gdbtk_init is called, we delete gdb_stdout and reset it to a new stream which calls our fprintf routine. As a result, tm_print_insn_info contains a bogus stream for output. The following patch re-registers our new gdb_stdout as the default output stream. (And no, you cannot just call INIT_DISASSEMBLE_INFO again!) Keith ChangeLog 2001-08-21 Keith Seitz * generic/gdbtk.c (gdbtk_init): Reinitialize disassemle info's stream parameter: we just deleted the one it saved when we re-routed gdb_stdout to our own gdb_stdout. Patch Index: generic/gdbtk.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v retrieving revision 1.18 diff -u -p -r1.18 gdbtk.c --- gdbtk.c 2001/08/16 23:04:46 1.18 +++ gdbtk.c 2001/08/21 16:51:59 @@ -586,6 +586,10 @@ gdbtk_init (argv0) gdb_stdtarg = gdbtk_fileopen (); uiout = cli_out_new (gdb_stdout); + /* We need to re-register the standard disassembler's + output, since we just changed gdb_stdout. */ + tm_print_insn_info.stream = gdb_stdout; + #ifdef __CYGWIN32__ (void) FreeConsole (); #endif