Bug 18155 - gdb TUI SEGVs when resizing asm window
Summary: gdb TUI SEGVs when resizing asm window
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-23 10:52 UTC by Anton Blanchard
Modified: 2015-07-02 13:03 UTC (History)
1 user (show)

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 Anton Blanchard 2015-03-23 10:52:24 UTC
To reproduce:

gdb /bin/bash
layout asm
[ resize the window ]

#0  tui_set_disassem_content (gdbarch=gdbarch@entry=0x1c99780, pc=4320912) at ../../binutils-gdb/gdb/tui/tui-disasm.c:195
#1  0x00000000004fbfab in tui_update_source_window_as_is (win_info=win_info@entry=0x1d32f00, gdbarch=gdbarch@entry=0x1c99780, s=s@entry=0x0, line_or_addr=..., 
    noerror=noerror@entry=1) at ../../binutils-gdb/gdb/tui/tui-winsource.c:98
#2  0x00000000004fc05c in tui_update_source_window (win_info=win_info@entry=0x1d32f00, gdbarch=gdbarch@entry=0x1c99780, s=s@entry=0x0, line_or_addr=..., 
    noerror=noerror@entry=1) at ../../binutils-gdb/gdb/tui/tui-winsource.c:78
#3  0x00000000004f9063 in make_visible_with_new_height (win_info=win_info@entry=0x1d32f00) at ../../binutils-gdb/gdb/tui/tui-win.c:1447
#4  0x00000000004fac7d in tui_resize_all () at ../../binutils-gdb/gdb/tui/tui-win.c:742
#5  0x00000000004fad69 in tui_async_resize_screen (arg=<optimised out>) at ../../binutils-gdb/gdb/tui/tui-win.c:858
#6  0x00000000005c4d6c in invoke_async_signal_handlers () at ../../binutils-gdb/gdb/event-loop.c:878
#7  gdb_do_one_event () at ../../binutils-gdb/gdb/event-loop.c:266
#8  0x00000000005c4f1e in start_event_loop () at ../../binutils-gdb/gdb/event-loop.c:333
#9  0x00000000005be8e3 in captured_command_loop (data=data@entry=0x0) at ../../binutils-gdb/gdb/main.c:321
#10 0x00000000005bb97d in catch_errors (func=func@entry=0x5be8d0 <captured_command_loop>, func_args=func_args@entry=0x0, errstring=errstring@entry=0x7acf59 "", 
    mask=mask@entry=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:240
#11 0x00000000005bf976 in captured_main (data=data@entry=0x7fff97c76c50) at ../../binutils-gdb/gdb/main.c:1156
#12 0x00000000005bb97d in catch_errors (func=func@entry=0x5beed0 <captured_main>, func_args=func_args@entry=0x7fff97c76c50, errstring=errstring@entry=0x7acf59 "", 
    mask=mask@entry=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:240
#13 0x00000000005bfe0b in gdb_main (args=args@entry=0x7fff97c76c50) at ../../binutils-gdb/gdb/main.c:1164
#14 0x0000000000461a05 in main (argc=<optimised out>, argv=<optimised out>) at ../../binutils-gdb/gdb/gdb.c:32
Comment 1 Sourceware Commits 2015-04-28 01:24:59 UTC
The master branch has been updated by Patrick Palka <ppalka@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9720679936fc4f710d718f13d903c7826e048a36

commit 9720679936fc4f710d718f13d903c7826e048a36
Author: Patrick Palka <patrick@parcs.ath.cx>
Date:   Sat Apr 25 21:59:02 2015 -0400

    Fix PR gdb/18155
    
    For no good reason the function tui_free_window() is freeing the locator
    window when we pass it an SRC_WIN or a DISASSEM_WIN.  This behavior
    doesn't make much sense because the locator window is always visible and
    its contents do not change when the main window changes.
    
    This behavior triggers the above PR because when we switch from one TUI
    window to another (in the PR, from the src window to the asm window) we
    call tui_free_window() on the previously active window (in the PR, the
    src window).  The function then frees the src window along with the
    locator window and later we segfault when the now-active asm window
    tries to query the locator window about the inferior's PC.
    
    This patch fixes this apparently wrong behavior by changing
    tui_free_window() to not free the locator window when we pass it an
    SRC_WIN or a DISASSEM_WIN.
    
    gdb/ChangeLog:
    
    	PR gdb/18155
    	* tui/tui-data.c (tui_free_window): Don't free the locator
    	window when passed an SRC_WIN or a DISASSEM_WIN.
Comment 2 Pedro Alves 2015-07-02 13:03:31 UTC
Should be fixed now.  Closing.