This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[unavailable regs/locals, 10/11] TUI + unavailable PC + changing frame.


CLI:

 (gdb) down
 #1  0x000000000040089d in main (argc=1, argv=0x7fffe1d6db88, envp=0x7fffe1d6db98)
     at ../../../src/gdb/testsuite/gdb.trace/unavailable.cc:207
 207       begin ();
 (gdb) 
 #2  <unavailable> in ?? ()

TUI:

 (gdb) down
 #1  0x000000000040089d in main (argc=1, argv=0x7fff3d151668, envp=0x7fff3d151678)
     at ../../../src/gdb/testsuite/gdb.trace/unavailable.cc:207
 (gdb) up
  PC not available
  ^^^^^^^^^^^^^^^^

This fixes the difference, making the TUI behave like the CLI.

-- 
Pedro Alves

2011-02-22  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Assume
	there's always a frame.  Use get_frame_pc_if_available instead of
	get_frame_pc, and if there's no PC available, don't look up a
	symtab.

---
 gdb/tui/tui-hooks.c |   34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

Index: src/gdb/tui/tui-hooks.c
===================================================================
--- src.orig/gdb/tui/tui-hooks.c	2011-01-13 15:08:12.696074999 +0000
+++ src/gdb/tui/tui-hooks.c	2011-02-02 11:37:31.837898996 +0000
@@ -190,6 +190,7 @@ static void
 tui_selected_frame_level_changed_hook (int level)
 {
   struct frame_info *fi;
+  CORE_ADDR pc;
 
   /* Negative level means that the selected frame was cleared.  */
   if (level < 0)
@@ -199,28 +200,29 @@ tui_selected_frame_level_changed_hook (i
   /* Ensure that symbols for this frame are read in.  Also, determine
      the source language of this frame, and switch to it if
      desired.  */
-  if (fi)
+  if (get_frame_pc_if_available (fi, &pc))
     {
       struct symtab *s;
-      
-      s = find_pc_symtab (get_frame_pc (fi));
+
+      s = find_pc_symtab (pc);
       /* elz: This if here fixes the problem with the pc not being
-         displayed in the tui asm layout, with no debug symbols.  The
-         value of s would be 0 here, and select_source_symtab would
-         abort the command by calling the 'error' function.  */
+	 displayed in the tui asm layout, with no debug symbols.  The
+	 value of s would be 0 here, and select_source_symtab would
+	 abort the command by calling the 'error' function.  */
       if (s)
-        select_source_symtab (s);
+	select_source_symtab (s);
+    }
 
-      /* Display the frame position (even if there is no symbols).  */
-      tui_show_frame_info (fi);
+  /* Display the frame position (even if there is no symbols or the PC
+     is not known).  */
+  tui_show_frame_info (fi);
 
-      /* Refresh the register window if it's visible.  */
-      if (tui_is_window_visible (DATA_WIN))
-        {
-          tui_refreshing_registers = 1;
-          tui_check_data_values (fi);
-          tui_refreshing_registers = 0;
-        }
+  /* Refresh the register window if it's visible.  */
+  if (tui_is_window_visible (DATA_WIN))
+    {
+      tui_refreshing_registers = 1;
+      tui_check_data_values (fi);
+      tui_refreshing_registers = 0;
     }
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]