This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix internal error in TUI
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 20 Mar 2010 01:20:28 -0400
- Subject: [commit] Fix internal error in TUI
This patch is for Debian bug #568489.
If you start gdb with a file, but no running program, and hit C-x 2 to
switch into TUI mode, GDB crashes. There's a NULL gdbarch which gets
passed to various gdbarch routines.
I spent a while poring over the gdbarch management in TUI, and found
it quite confusing. This seems like the best fix. Part of this could
be improved, in theory, by looking up the architecture associated with
"main"; but in practice, get_current_arch will match main when the
program is not yet running. Later on, there's an explicit gdbarch.
Tested on x86_64-linux and committed.
--
Daniel Jacobowitz
CodeSourcery
2010-03-20 Daniel Jacobowitz <dan@codesourcery.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Default to
get_current_arch.
* tui/tui-layout.c (extract_display_start_addr): Likewise.
Index: tui/tui-disasm.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-disasm.c,v
retrieving revision 1.33
diff -u -p -r1.33 tui-disasm.c
--- tui/tui-disasm.c 1 Jan 2010 07:32:07 -0000 1.33
+++ tui/tui-disasm.c 20 Mar 2010 04:17:05 -0000
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
@@ -330,7 +331,7 @@ tui_get_begin_asm_address (struct gdbarc
{
struct tui_gen_win_info *locator;
struct tui_locator_element *element;
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
locator = tui_locator_win_info_ptr ();
Index: tui/tui-layout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-layout.c,v
retrieving revision 1.36
diff -u -p -r1.36 tui-layout.c
--- tui/tui-layout.c 1 Jan 2010 07:32:07 -0000 1.36
+++ tui/tui-layout.c 20 Mar 2010 04:17:05 -0000
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "command.h"
#include "symtab.h"
#include "frame.h"
@@ -522,7 +523,7 @@ static void
extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
enum tui_layout_type cur_layout = tui_current_layout ();
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
CORE_ADDR pc;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();