Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: Hui Zhu <teawater@gmail.com>,
	gdb-patches ml <gdb-patches@sourceware.org>,
	       Joel Brobecker <brobecker@adacore.com>
Subject: [patch+7.6] [TUI] Fix scrolling missing '>' 7.6 regression  [Re: [PATCH] Fix gdb crash with tui]
Date: Wed, 13 Mar 2013 18:55:00 -0000	[thread overview]
Message-ID: <20130313185507.GB18563@host2.jankratochvil.net> (raw)
In-Reply-To: <513F7592.2080902@redhat.com>

On Tue, 12 Mar 2013 19:36:02 +0100, Pedro Alves wrote:
> Just doing any of these does fix the issue with the highlighted
> current line disappearing, so there's something else that needs
> fixing in addition.

That is the second patch for a regression by me.

#0  __memset_sse2 () at ../sysdeps/x86_64/memset.S:360
#1  in freehook (ptr=0x3a61ba0, caller=0x879de9 <xfree+31>) at mcheck.c:193
#2  in xfree (ptr=0x3a61ba0) at ./common/common-utils.c:108
#3  in find_and_open_source (filename=0x23c2010 "gdb.c", dirname=0x289cec0 "/home/jkratoch/redhat/gdb-clean/gdb", fullname=0x289cde0) at source.c:1008
#4  in open_source_file (s=0x289cd80) at source.c:1088
#5  in tui_set_source_content (s=0x289cd80, line_no=16, noerror=0) at ./tui/tui-source.c:61
#6  in tui_update_source_window_as_is (win_info=0x3a51a80, gdbarch=0x22d0000, s=0x289cd80, line_or_addr=..., noerror=0) at ./tui/tui-winsource.c:99
#7  in tui_show_symtab_source (gdbarch=0x22d0000, s=0x289cd80, line=..., noerror=0) at ./tui/tui-source.c:339 
#8  in tui_update_source_windows_with_line (s=0x289cd80, line=16) at ./tui/tui-winsource.c:201
#9  in tui_show_source (fullname=0x3a61ba0 "\225\225\225\225\225\225\225\225ratoch/redhat/gdb-clean/gdb/gdb.c", line=16) at ./tui/tui.c:542
#10 in tui_field_string (uiout=0x2296dc0, fldno=3, width=0, align=ui_noalign, fldname=0xfa09d9 "fullname", string=0x3a61ba0 "\225\225\225\225\225\225\225\225ratoch/redhat/gdb-clean/gdb/gdb.c") at ./tui/tui-out.c:92
#11 in uo_field_string (uiout=0x2296dc0, fldno=3, width=0, align=ui_noalign, fldname=0xfa09d9 "fullname", string=0x3a61ba0 "\225\225\225\225\225\225\225\225ratoch/redhat/gdb-clean/gdb/gdb.c") at ui-out.c:854
#12 in ui_out_field_string (uiout=0x2296dc0, fldname=0xfa09d9 "fullname", string=0x3a61ba0 "\225\225\225\225\225\225\225\225ratoch/redhat/gdb-clean/gdb/gdb.c") at ui-out.c:544
#13 in print_source_lines_base (s=0x289cd80, line=16, stopline=17, flags=PRINT_SOURCE_LINES_NOERROR) at source.c:1357
#14 in print_source_lines (s=0x289cd80, line=16, stopline=17, flags=(unknown: 0)) at source.c:1442
#15 in tui_vertical_source_scroll (scroll_direction=BACKWARD_SCROLL, num_to_scroll=1) at ./tui/tui-source.c:393
#16 in tui_scroll_backward (win_to_scroll=0x3a51a80, num_to_scroll=1) at ./tui/tui-win.c:538
#17 in tui_dispatch_ctrl_char (ch=259) at ./tui/tui-command.c:118
#18 in tui_getc (fp=0x7ffff663b660 <_IO_2_1_stdin_>) at ./tui/tui-io.c:692
#19 in rl_read_key () at input.c:448


I did not expect this may happen...

No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu but it does
not say much for TUI.


Thanks,
Jan


2013-03-13  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* source.c (print_source_lines_base): Make a local copy of
	symtab_to_fullname.

diff --git a/gdb/source.c b/gdb/source.c
index 828d953..201e848 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1355,11 +1355,17 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
 				 symtab_to_filename_for_display (s));
 	  if (ui_out_is_mi_like_p (uiout)
 	      || !ui_out_test_flags (uiout, ui_source_list))
-	    {
-	      const char *fullname = symtab_to_fullname (s);
+ 	    {
+	      const char *s_fullname = symtab_to_fullname (s);
+	      char *local_fullname;
 
-	      ui_out_field_string (uiout, "fullname", fullname);
-	    }
+	      /* ui_out_field_string may free S_FULLNAME by calling
+	         open_source_file for it again.  */
+	      local_fullname = alloca (strlen (s_fullname) + 1);
+	      strcpy (local_fullname, s_fullname);
+
+	      ui_out_field_string (uiout, "fullname", local_fullname);
+ 	    }
 
 	  ui_out_text (uiout, "\n");
 	}


  parent reply	other threads:[~2013-03-13 18:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 14:14 [PATCH] Fix gdb crash with tui Hui Zhu
2013-03-11 19:25 ` Jan Kratochvil
2013-03-12  3:15   ` Hui Zhu
2013-03-12 12:22     ` Hui Zhu
2013-03-12 12:37       ` Jan Kratochvil
2013-03-12 13:21         ` Hui Zhu
2013-03-12 14:21           ` Hui Zhu
2013-03-12 16:04         ` Pedro Alves
2013-03-12 16:35           ` Pedro Alves
2013-03-12 18:36 ` Pedro Alves
2013-03-12 18:42   ` Pedro Alves
2013-03-13 18:55   ` Jan Kratochvil [this message]
2013-03-14  1:46     ` [patch+7.6] [TUI] Fix scrolling missing '>' 7.6 regression [Re: [PATCH] Fix gdb crash with tui] Hui Zhu
2013-03-14 12:53     ` Pedro Alves
2013-03-14 14:44       ` [commit+7.6] " Jan Kratochvil
2013-03-13 18:55   ` [patch+7.6] [TUI] Fix scrolling crash " Jan Kratochvil
2013-03-14  1:46     ` Hui Zhu
2013-03-14 12:33     ` Pedro Alves
2013-03-14 14:41       ` [commit+7.6] " Jan Kratochvil
2013-03-14 14:57         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130313185507.GB18563@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=teawater@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox