Bug 14486 - resize crashes tui
Summary: resize crashes tui
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: tui (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.6
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-17 20:08 UTC by H.J. Lu
Modified: 2012-08-27 17:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2012-08-17 20:08:15 UTC
[hjl@gnu-6 gdb]$ gdb gdb
GNU gdb (GDB) 7.4.50.20120707-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /export/build/gnu/gdb/build-x86_64-linux/gdb/gdb...done.
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x6c430e: file /export/gnu/import/git/gdb/gdb/utils.c, line 897.
Breakpoint 2 at 0x4d621c: file /export/gnu/import/git/gdb/gdb/cli/cli-cmds.c, line 223.
(top-gdb) b main
Breakpoint 3 at 0x456f5b: file /export/gnu/import/git/gdb/gdb/gdb.c, line 29.
(top-gdb) r
Starting program: /export/build/gnu/gdb/build-x86_64-linux/gdb/gdb 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 3, 
During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x456f9b.
main (argc=1, argv=0x7fffffffdee8) at /export/gnu/import/git/gdb/gdb/gdb.c:29
29	  memset (&args, 0, sizeof args);
(top-gdb) layout asm

Resize window

(top-gdb) si

tui crashed:

(top-gdb) bt
#0  0x00000000004efb22 in tui_source_is_displayed (fname=0x593ce10 "bug4.js")
    at /export/gnu/import/git/gdb/gdb/tui/tui-source.c:337
#1  0x00000000004f0538 in tui_show_frame_info (fi=0xd1d800)
    at /export/gnu/import/git/gdb/gdb/tui/tui-stack.c:351
#2  0x00000000004eb1bd in tui_selected_frame_level_changed_hook (level=0)
    at /export/gnu/import/git/gdb/gdb/tui/tui-hooks.c:226
#3  0x00000000006cd470 in select_frame (fi=0xd1d800)
    at /export/gnu/import/git/gdb/gdb/frame.c:1419
#4  0x00000000005c9850 in restore_selected_frame (a_frame_id=..., frame_level=0)
    at /export/gnu/import/git/gdb/gdb/thread.c:1038
#5  0x00000000005c9aa3 in do_restore_current_thread_cleanup (arg=0x57d82f0)
    at /export/gnu/import/git/gdb/gdb/thread.c:1106
#6  0x000000000055c3c0 in do_my_cleanups (pmy_chain=0xc11c50 <cleanup_chain>, 
    old_chain=0x42ca0f0) at /export/gnu/import/git/gdb/gdb/cleanups.c:155
#7  0x000000000055c42d in do_cleanups (old_chain=0x42ca0f0)
    at /export/gnu/import/git/gdb/gdb/cleanups.c:177
#8  0x000000000053ecd9 in insert_breakpoint_locations ()
    at /export/gnu/import/git/gdb/gdb/breakpoint.c:2891
#9  0x000000000053e7c0 in insert_breakpoints ()
    at /export/gnu/import/git/gdb/gdb/breakpoint.c:2716
#10 0x00000000005b48f4 in proceed (addr=18446744073709551615, 
    siggnal=GDB_SIGNAL_DEFAULT, step=1)
    at /export/gnu/import/git/gdb/gdb/infrun.c:2205
Comment 1 H.J. Lu 2012-08-17 20:16:01 UTC
This patch

diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 9ba9b1d..2027ac4 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -334,7 +334,8 @@ tui_show_symtab_source (struct gdbarch *gdbarch, struct symtab *s,
 int
 tui_source_is_displayed (char *fname)
 {
-  return (TUI_SRC_WIN->generic.content_in_use 
+  return (TUI_SRC_WIN
+	  && TUI_SRC_WIN->generic.content_in_use 
 	  && (filename_cmp (((struct tui_win_element *)
 			     (tui_locator_win_info_ptr ())->
 			     content[0])->which_element.locator.file_name,

works for me.
Comment 2 Sourceware Commits 2012-08-27 17:01:00 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2012-08-27 17:00:42

Modified files:
	gdb            : ChangeLog 
	gdb/tui        : tui-source.c 

Log message:
	Check if TUI_SRC_WIN is not NULL before referencing it
	
	PR tui/14486
	* tui/tui-source.c (tui_source_is_displayed): Check if TUI_SRC_WIN
	is not NULL before referencing it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14636&r2=1.14637
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/tui/tui-source.c.diff?cvsroot=src&r1=1.30&r2=1.31
Comment 3 H.J. Lu 2012-08-27 17:44:14 UTC
Fixed.