public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-vla: https://bugzilla.redhat.com/show_bug.cgi?id=654331
@ 2010-11-20  4:31 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2010-11-20  4:31 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-vla has been updated
       via  a2144eb95b6717b9bed0050941b4349bf38ce00e (commit)
      from  92e2d9797f67a91bd16116328489da1179bc76d5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a2144eb95b6717b9bed0050941b4349bf38ce00e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Nov 20 05:30:19 2010 +0100

    https://bugzilla.redhat.com/show_bug.cgi?id=654331

-----------------------------------------------------------------------

Summary of changes:
 gdb/defs.h                                         |    2 +
 gdb/dwarf2loc.c                                    |    8 ++++-
 gdb/stack.c                                        |    7 ++++
 .../gdb.fortran/dynamic-other-frame-stub.f90       |   24 +++++++++++++
 gdb/testsuite/gdb.fortran/dynamic-other-frame.exp  |   37 ++++++++++++++++++++
 gdb/testsuite/gdb.fortran/dynamic-other-frame.f90  |   36 +++++++++++++++++++
 gdb/utils.c                                        |   26 ++++++++++++++
 7 files changed, 139 insertions(+), 1 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
 create mode 100644 gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
 create mode 100644 gdb/testsuite/gdb.fortran/dynamic-other-frame.f90

First 500 lines of diff:
diff --git a/gdb/defs.h b/gdb/defs.h
index d36f7c1..cfe2e19 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -398,6 +398,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void);
 extern struct cleanup *
   set_batch_flag_and_make_cleanup_restore_page_info (void);
 
+extern struct cleanup *make_cleanup_restore_selected_frame (void);
+
 extern char *gdb_realpath (const char *);
 extern char *xfullpath (const char *);
 
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index afc7907..5b683e3 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1053,7 +1053,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
 {
   struct value *retval;
   struct dwarf_expr_context *ctx;
-  struct cleanup *old_chain = make_cleanup (null_cleanup, 0);
+  struct cleanup *old_chain;
 
   if (size == 0)
     {
@@ -1063,6 +1063,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
       return retval;
     }
 
+  old_chain = make_cleanup (null_cleanup, 0);
+
   ctx = dwarf_expr_prep_ctx (frame, data, size, per_cu);
 
   if (ctx->num_pieces > 0)
@@ -1098,6 +1100,10 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
 	    CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0);
 	    int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
 
+	    /* Frame may be needed for check_typedef of TYPE_DYNAMIC.  */
+	    make_cleanup_restore_selected_frame ();
+	    select_frame (frame);
+
 	    /* object_address_set called here is required in ALLOCATE_VALUE's
 	       CHECK_TYPEDEF for the object's possible
 	       DW_OP_push_object_address.  */
diff --git a/gdb/stack.c b/gdb/stack.c
index 1e0c2e6..23f7f56 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -366,6 +366,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 	        {
                   const struct language_defn *language;
 		  struct value_print_options opts;
+		  struct cleanup *old_chain;
 
                   /* Use the appropriate language to display our symbol,
                      unless the user forced the language to a specific
@@ -378,7 +379,13 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 		  get_raw_print_options (&opts);
 		  opts.deref_ref = 0;
 		  opts.summary = summary;
+
+		  /* Frame may be needed for check_typedef of TYPE_DYNAMIC.  */
+		  old_chain = make_cleanup_restore_selected_frame ();
+		  select_frame (frame);
 		  common_val_print (val, stb->stream, 2, &opts, language);
+		  do_cleanups (old_chain);
+
 		  ui_out_field_stream (uiout, "value", stb);
 	        }
 	      else
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
new file mode 100644
index 0000000..261ce17
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
@@ -0,0 +1,24 @@
+! Copyright 2010 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+subroutine bar
+  real :: dummy
+  dummy = 1
+end subroutine bar
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
new file mode 100644
index 0000000..4fdd5ee
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
@@ -0,0 +1,37 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+set testfile "dynamic-other-frame"
+set srcfile1 ${testfile}.f90
+set srcfile2 ${testfile}-stub.f90
+set objfile2 ${objdir}/${subdir}/${testfile}-stub.o
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f77}] != ""
+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f77}] != "" } {
+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
+    return -1
+}
+
+clean_restart ${executable}
+
+if ![runto bar_] then {
+    perror "couldn't run to bar_"
+    continue
+}
+
+gdb_test "bt" {foo \(string='hello'.*}
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
new file mode 100644
index 0000000..2bc637d
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
@@ -0,0 +1,36 @@
+! Copyright 2010 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+subroutine foo (string)
+  interface
+    subroutine bar
+    end subroutine
+  end interface
+  character string*(*)
+  call bar                                ! stop-here
+end subroutine foo
+program test
+  interface
+    subroutine foo (string)
+    character string*(*)
+    end subroutine
+  end interface
+  call foo ('hello')
+end
diff --git a/gdb/utils.c b/gdb/utils.c
index 98b8ae3..6f71e66 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2198,6 +2198,32 @@ set_batch_flag_and_make_cleanup_restore_page_info (void)
   return back_to;
 }
 
+/* Helper for make_cleanup_restore_page_info.  */
+
+static void
+do_restore_selected_frame_cleanup (void *arg)
+{
+  struct frame_id *frame_idp = arg;
+
+  select_frame (frame_find_by_id (*frame_idp));
+
+  xfree (frame_idp);
+}
+
+/* Provide cleanup for restoring currently selected frame.  Use frame_id for
+   the case the current frame becomes stale in the meantime.  */
+
+struct cleanup *
+make_cleanup_restore_selected_frame (void)
+{
+  struct frame_id *frame_idp;
+
+  frame_idp = xmalloc (sizeof (*frame_idp));
+  *frame_idp = get_frame_id (get_selected_frame (NULL));
+
+  return make_cleanup (do_restore_selected_frame_cleanup, frame_idp);
+}
+
 /* Set the screen size based on LINES_PER_PAGE and CHARS_PER_LINE.  */
 
 static void


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-20  4:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-20  4:31 [SCM] archer-jankratochvil-vla: https://bugzilla.redhat.com/show_bug.cgi?id=654331 jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).