-Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
+Index: gdb-7.4.91.20120801/gdb/dwarf2read.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:13:02.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200
-@@ -5727,12 +5727,14 @@ read_set_type (struct die_info *die, str
+--- gdb-7.4.91.20120801.orig/gdb/dwarf2read.c 2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/dwarf2read.c 2012-08-01 18:38:54.201540500 +0200
+@@ -11073,12 +11073,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
-@@ -5757,10 +5759,40 @@ read_common_block (struct die_info *die,
+@@ -11103,20 +11105,67 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
child_die = die->child;
while (child_die && child_die->tag)
{
+ LONGEST offset;
+
+ /* Create the symbol in the DW_TAG_common_block block in the current
+ symbol scope. */
sym = new_symbol (child_die, NULL, cu);
+
+ /* Undocumented in DWARF3, when it can be present? */
- attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
- if (attr)
+ if (sym != NULL
+ && handle_data_member_location (child_die, cu, &offset))
{
-@@ -5778,8 +5810,25 @@ read_common_block (struct die_info *die,
- SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
+ SYMBOL_VALUE_ADDRESS (sym) = base + offset;
add_symbol_to_list (sym, &global_symbols);
}
+
}
}
-@@ -9106,6 +9155,13 @@ new_symbol (struct die_info *die, struct
+@@ -15155,6 +15204,13 @@ new_symbol_full (struct die_info *die, s
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
+ && die->parent->tag == DW_TAG_common_block)
+ attr2 = NULL;
+
- if (attr2 && (DW_UNSND (attr2) != 0))
- {
- struct pending **list_to_add;
-@@ -9277,6 +9333,11 @@ new_symbol (struct die_info *die, struct
+ if (SYMBOL_CLASS (sym) == LOC_STATIC
+ && SYMBOL_VALUE_ADDRESS (sym) == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+@@ -15319,6 +15375,11 @@ new_symbol_full (struct die_info *die, s
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- add_symbol_to_list (sym, &global_symbols);
+ list_to_add = &global_symbols;
break;
+ case DW_TAG_common_block:
+ SYMBOL_CLASS (sym) = LOC_STATIC;
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
-Index: gdb-7.1.90.20100711/gdb/f-lang.c
+Index: gdb-7.4.91.20120801/gdb/f-lang.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/f-lang.c 2010-07-13 00:24:04.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/f-lang.c 2010-07-13 00:25:56.000000000 +0200
-@@ -443,27 +443,3 @@ _initialize_f_language (void)
+--- gdb-7.4.91.20120801.orig/gdb/f-lang.c 2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-lang.c 2012-08-01 18:38:54.202540495 +0200
+@@ -370,27 +370,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
-SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */
-
-/* This routine finds the first encountred COMMON block named "name"
-- that belongs to function funcname */
+- that belongs to function funcname. */
-
-SAVED_F77_COMMON_PTR
--find_common_for_function (char *name, char *funcname)
+-find_common_for_function (const char *name, const char *funcname)
-{
-
- SAVED_F77_COMMON_PTR tmp;
- }
- return (NULL);
-}
-Index: gdb-7.1.90.20100711/gdb/f-lang.h
+Index: gdb-7.4.91.20120801/gdb/f-lang.h
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/f-lang.h 2010-07-13 00:24:04.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/f-lang.h 2010-07-13 00:25:56.000000000 +0200
-@@ -52,36 +52,8 @@ enum f90_range_type
+--- gdb-7.4.91.20120801.orig/gdb/f-lang.h 2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-lang.h 2012-08-01 18:38:54.203540489 +0200
+@@ -52,37 +52,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
-
-extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
-
--extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
+-extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+- const char *);
-
#define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
/* When reasonable array bounds cannot be fetched, such as when
you ask to 'mt print symbols' and there is no stack frame and
-Index: gdb-7.1.90.20100711/gdb/f-valprint.c
+Index: gdb-7.4.91.20120801/gdb/f-valprint.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/f-valprint.c 2010-07-13 00:24:25.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/f-valprint.c 2010-07-13 00:32:05.000000000 +0200
-@@ -34,6 +34,8 @@
+--- gdb-7.4.91.20120801.orig/gdb/f-valprint.c 2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-valprint.c 2012-08-01 18:41:26.411698186 +0200
+@@ -34,10 +34,11 @@
#include "gdbcore.h"
#include "command.h"
#include "block.h"
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
-@@ -486,22 +488,54 @@ f_val_print (struct type *type, const gd
- return 0;
+-static void list_all_visible_commons (const char *);
+ static void f77_create_arrayprint_offset_tbl (struct type *,
+ struct ui_file *);
+ static void f77_get_dynamic_length_of_aggregate (struct type *);
+@@ -420,22 +421,53 @@ f_val_print (struct type *type, const gd
+ gdb_flush (stream);
}
-static void
--list_all_visible_commons (char *funname)
+-list_all_visible_commons (const char *funname)
+static int
-+info_common_command_for_block (struct block *block, struct frame_info *frame,
-+ const char *comname)
++info_common_command_for_block (struct block *block, const char *comname)
{
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
-+ struct dict_iterator iter;
++ struct block_iterator iter;
+ struct symbol *sym;
+ int values_printed = 0;
+ const char *name;
+ }
- printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
-+ putchar_filtered ('\n');
-+ }
-
+-
- while (tmp != NULL)
- {
- if (strcmp (tmp->owning_function, funname) == 0)
- printf_filtered ("%s\n", tmp->name);
--
++ putchar_filtered ('\n');
++ }
+
- tmp = tmp->next;
- }
+ return values_printed;
}
/* This function is used to print out the values in a given COMMON
-@@ -511,11 +545,9 @@ list_all_visible_commons (char *funname)
+@@ -445,11 +477,9 @@ list_all_visible_commons (const char *fu
static void
info_common_command (char *comname, int from_tty)
{
- SAVED_F77_COMMON_PTR the_common;
- COMMON_ENTRY_PTR entry;
struct frame_info *fi;
-- char *funname = 0;
+- const char *funname = 0;
- struct symbol *func;
+ struct block *block;
+ int values_printed = 0;
/* We have been told to display the contents of F77 COMMON
block supposedly visible in this function. Let us
-@@ -527,74 +559,31 @@ info_common_command (char *comname, int
+@@ -461,87 +491,31 @@ info_common_command (char *comname, int
/* The following is generally ripped off from stack.c's routine
- print_frame_info() */
+ print_frame_info(). */
- func = find_pc_function (get_frame_pc (fi));
- if (func)
- up with a larger address for the function use that instead.
- I don't think this can ever cause any problems; there shouldn't
- be any minimal symbols in the middle of a function.
-- FIXME: (Not necessarily true. What about text labels) */
+- FIXME: (Not necessarily true. What about text labels?) */
-
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
}
- /* If comname is NULL, we assume the user wishes to see the
-- which COMMON blocks are visible here and then return */
+- which COMMON blocks are visible here and then return. */
-
- if (comname == 0)
+ while (block)
{
- list_all_visible_commons (funname);
- return;
-+ if (info_common_command_for_block (block, fi, comname))
++ if (info_common_command_for_block (block, comname))
+ values_printed = 1;
+ /* After handling the function's top-level block, stop. Don't
+ continue to its superblock, the block of per-file symbols. */
- if (the_common)
+ if (!values_printed)
{
+- struct frame_id frame_id = get_frame_id (fi);
+-
- if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
- printf_filtered (_("Contents of blank COMMON block:\n"));
+ if (comname)
-
- while (entry != NULL)
- {
+- fi = frame_find_by_id (frame_id);
+- if (fi == NULL)
+- {
+- warning (_("Unable to restore previously selected frame."));
+- break;
+- }
+-
- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0);
+-
+- /* print_variable_and_value invalidates FI. */
+- fi = NULL;
+-
- entry = entry->next;
- }
+ printf_filtered (_("No common blocks.\n"));
}
void
-Index: gdb-7.1.90.20100711/gdb/stack.c
+Index: gdb-7.4.91.20120801/gdb/stack.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/stack.c 2010-07-01 17:36:17.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/stack.c 2010-07-13 00:29:49.000000000 +0200
-@@ -1484,6 +1484,8 @@ iterate_over_block_locals (struct block
+--- gdb-7.4.91.20120801.orig/gdb/stack.c 2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/stack.c 2012-08-01 18:38:54.206540471 +0200
+@@ -1851,6 +1851,8 @@ iterate_over_block_locals (struct block
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
break;
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
break;
-Index: gdb-7.1.90.20100711/gdb/symtab.h
+Index: gdb-7.4.91.20120801/gdb/symtab.h
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/symtab.h 2010-07-12 23:07:33.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/symtab.h 2010-07-13 00:27:02.000000000 +0200
-@@ -396,7 +396,10 @@ typedef enum domain_enum_tag
- FUNCTIONS_DOMAIN,
+--- gdb-7.4.91.20120801.orig/gdb/symtab.h 2012-06-30 00:46:46.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/symtab.h 2012-08-01 18:38:54.206540471 +0200
+@@ -394,7 +394,10 @@ typedef enum domain_enum_tag
+
+ /* LABEL_DOMAIN may be used for names of labels (for gotos). */
- /* All defined types */
-- TYPES_DOMAIN
-+ TYPES_DOMAIN,
+- LABEL_DOMAIN
++ LABEL_DOMAIN,
+
+ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */
+ COMMON_BLOCK_DOMAIN
- }
- domain_enum;
+ } domain_enum;
-Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp
+ /* Searching domains, used for `search_symbols'. Element numbers are
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 00:25:56.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp 2012-08-01 18:38:54.207540465 +0200
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+set srcfile ${testfile}.f90
+set binfile ${objdir}/${subdir}/${testfile}
+
-+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
+gdb_test "p ix_x" " = 1 *" "p ix_x in"
+gdb_test "p iy_y" " = 2 *" "p iy_y in"
+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
-Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.f90
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.f90 2010-07-13 00:25:56.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90 2012-08-01 18:38:54.207540465 +0200
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!