]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-fortran-common.patch
- up to 7.3.1
[packages/gdb.git] / gdb-fortran-common.patch
1 Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
2 ===================================================================
3 --- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c   2011-05-25 17:06:19.000000000 +0200
4 +++ gdb-7.2.90.20110525/gdb/dwarf2read.c        2011-05-25 17:10:46.000000000 +0200
5 @@ -7665,12 +7665,14 @@ read_set_type (struct die_info *die, str
6    return set_die_type (die, set_type, cu);
7  }
8  
9 -/* First cut: install each common block member as a global variable.  */
10 +/* Create appropriate locally-scoped variables for all the DW_TAG_common_block
11 +   entries.  Create also TYPE_CODE_STRUCT listing all such variables to be
12 +   available for `info common'.  COMMON_BLOCK_DOMAIN is used to sepate the
13 +   common blocks name namespace from regular variable names.  */
14  
15  static void
16  read_common_block (struct die_info *die, struct dwarf2_cu *cu)
17  {
18 -  struct die_info *child_die;
19    struct attribute *attr;
20    struct symbol *sym;
21    CORE_ADDR base = (CORE_ADDR) 0;
22 @@ -7695,20 +7697,67 @@ read_common_block (struct die_info *die,
23      }
24    if (die->child != NULL)
25      {
26 +      struct objfile *objfile = cu->objfile;
27 +      struct die_info *child_die;
28 +      struct type *type;
29 +      struct field *field;
30 +      char *name;
31 +      struct symbol *sym;
32 +
33 +      type = alloc_type (objfile);
34 +      TYPE_CODE (type) = TYPE_CODE_STRUCT;
35 +      /* Artificial type to be used only by `info common'.  */
36 +      TYPE_NAME (type) = "<common>";
37 +
38 +      child_die = die->child;
39 +      while (child_die && child_die->tag)
40 +       {
41 +         TYPE_NFIELDS (type)++;
42 +         child_die = sibling_die (child_die);
43 +       }
44 +
45 +      TYPE_FIELDS (type) = obstack_alloc (&objfile->objfile_obstack,
46 +                                         sizeof (*TYPE_FIELDS (type))
47 +                                         * TYPE_NFIELDS (type));
48 +      memset (TYPE_FIELDS (type), 0, sizeof (*TYPE_FIELDS (type))
49 +                                    * TYPE_NFIELDS (type));
50 +      
51 +      field = TYPE_FIELDS (type);
52        child_die = die->child;
53        while (child_die && child_die->tag)
54         {
55           LONGEST offset;
56  
57 +         /* Create the symbol in the DW_TAG_common_block block in the current
58 +            symbol scope.  */
59           sym = new_symbol (child_die, NULL, cu);
60 +
61 +         /* Undocumented in DWARF3, when it can be present?  */
62           if (sym != NULL
63               && handle_data_member_location (child_die, cu, &offset))
64             {
65               SYMBOL_VALUE_ADDRESS (sym) = base + offset;
66               add_symbol_to_list (sym, &global_symbols);
67             }
68 +
69 +         if (SYMBOL_CLASS (sym) == LOC_STATIC)
70 +           SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
71 +         else
72 +           SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
73 +         FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
74 +         FIELD_NAME (*field) = SYMBOL_NATURAL_NAME (sym);
75 +         field++;
76           child_die = sibling_die (child_die);
77         }
78 +
79 +      /* TYPE_LENGTH (type) is left 0 - it is only a virtual structure even
80 +        with no consecutive address space.  */
81 +
82 +      sym = new_symbol (die, type, cu);
83 +      /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static.  */
84 +      SYMBOL_VALUE_ADDRESS (sym) = base;
85 +
86 +      set_die_type (die, type, cu);
87      }
88  }
89  
90 @@ -11376,6 +11425,13 @@ new_symbol_full (struct die_info *die, s
91             {
92               var_decode_location (attr, sym, cu);
93               attr2 = dwarf2_attr (die, DW_AT_external, cu);
94 +
95 +             /* Fortran explicitly imports any global symbols to the local
96 +                scope by DW_TAG_common_block.  */
97 +             if (cu->language == language_fortran && die->parent
98 +                 && die->parent->tag == DW_TAG_common_block)
99 +               attr2 = NULL;
100 +
101               if (SYMBOL_CLASS (sym) == LOC_STATIC
102                   && SYMBOL_VALUE_ADDRESS (sym) == 0
103                   && !dwarf2_per_objfile->has_section_at_zero)
104 @@ -11548,6 +11604,11 @@ new_symbol_full (struct die_info *die, s
105           SYMBOL_CLASS (sym) = LOC_TYPEDEF;
106           list_to_add = &global_symbols;
107           break;
108 +       case DW_TAG_common_block:
109 +         SYMBOL_CLASS (sym) = LOC_STATIC;
110 +         SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN;
111 +         add_symbol_to_list (sym, cu->list_in_scope);
112 +         break;
113         default:
114           /* Not a tag we recognize.  Hopefully we aren't processing
115              trash data, but since we must specifically ignore things
116 Index: gdb-7.2.90.20110525/gdb/f-lang.c
117 ===================================================================
118 --- gdb-7.2.90.20110525.orig/gdb/f-lang.c       2011-05-25 17:06:22.000000000 +0200
119 +++ gdb-7.2.90.20110525/gdb/f-lang.c    2011-05-25 17:07:02.000000000 +0200
120 @@ -446,27 +446,3 @@ _initialize_f_language (void)
121  
122    add_language (&f_language_defn);
123  }
124 -
125 -SAVED_F77_COMMON_PTR head_common_list = NULL;  /* Ptr to 1st saved COMMON  */
126 -
127 -/* This routine finds the first encountred COMMON block named "name" 
128 -   that belongs to function funcname.  */
129 -
130 -SAVED_F77_COMMON_PTR
131 -find_common_for_function (char *name, char *funcname)
132 -{
133 -
134 -  SAVED_F77_COMMON_PTR tmp;
135 -
136 -  tmp = head_common_list;
137 -
138 -  while (tmp != NULL)
139 -    {
140 -      if (strcmp (tmp->name, name) == 0
141 -         && strcmp (tmp->owning_function, funcname) == 0)
142 -       return (tmp);
143 -      else
144 -       tmp = tmp->next;
145 -    }
146 -  return (NULL);
147 -}
148 Index: gdb-7.2.90.20110525/gdb/f-lang.h
149 ===================================================================
150 --- gdb-7.2.90.20110525.orig/gdb/f-lang.h       2011-05-25 17:06:22.000000000 +0200
151 +++ gdb-7.2.90.20110525/gdb/f-lang.h    2011-05-25 17:07:02.000000000 +0200
152 @@ -52,36 +52,8 @@ enum f90_range_type
153      NONE_BOUND_DEFAULT         /* "(low:high)"  */
154    };
155  
156 -struct common_entry
157 -  {
158 -    struct symbol *symbol;     /* The symbol node corresponding
159 -                                  to this component */
160 -    struct common_entry *next; /* The next component */
161 -  };
162 -
163 -struct saved_f77_common
164 -  {
165 -    char *name;                        /* Name of COMMON */
166 -    char *owning_function;     /* Name of parent function */
167 -    int secnum;                        /* Section # of .bss */
168 -    CORE_ADDR offset;          /* Offset from .bss for 
169 -                                  this block */
170 -    struct common_entry *entries;      /* List of block's components */
171 -    struct common_entry *end_of_entries;       /* ptr. to end of components */
172 -    struct saved_f77_common *next;     /* Next saved COMMON block */
173 -  };
174 -
175 -typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR;
176 -
177 -typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
178 -
179 -extern SAVED_F77_COMMON_PTR head_common_list;  /* Ptr to 1st saved COMMON  */
180 -
181 -extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
182 -
183  #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned  */
184  #define BLANK_COMMON_NAME_MF77     "__BLNK__"  /* MF77 assigned  */
185 -#define BLANK_COMMON_NAME_LOCAL    "__BLANK"   /* Local GDB */
186  
187  /* When reasonable array bounds cannot be fetched, such as when 
188     you ask to 'mt print symbols' and there is no stack frame and 
189 Index: gdb-7.2.90.20110525/gdb/f-valprint.c
190 ===================================================================
191 --- gdb-7.2.90.20110525.orig/gdb/f-valprint.c   2011-05-25 17:06:22.000000000 +0200
192 +++ gdb-7.2.90.20110525/gdb/f-valprint.c        2011-05-25 17:07:02.000000000 +0200
193 @@ -34,6 +34,8 @@
194  #include "gdbcore.h"
195  #include "command.h"
196  #include "block.h"
197 +#include "dictionary.h"
198 +#include "gdb_assert.h"
199  
200  extern void _initialize_f_valprint (void);
201  static void info_common_command (char *, int);
202 @@ -501,22 +503,54 @@ f_val_print (struct type *type, const gd
203    return 0;
204  }
205  
206 -static void
207 -list_all_visible_commons (char *funname)
208 +static int
209 +info_common_command_for_block (struct block *block, struct frame_info *frame,
210 +                              const char *comname)
211  {
212 -  SAVED_F77_COMMON_PTR tmp;
213 -
214 -  tmp = head_common_list;
215 +  struct dict_iterator iter;
216 +  struct symbol *sym;
217 +  int values_printed = 0;
218 +  const char *name;
219 +  struct value_print_options opts;
220 +
221 +  get_user_print_options (&opts);
222 +
223 +  ALL_BLOCK_SYMBOLS (block, iter, sym)
224 +    if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
225 +      {
226 +       struct type *type = SYMBOL_TYPE (sym);
227 +       int index;
228 +
229 +       gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC);
230 +       gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
231 +
232 +       if (comname && (!SYMBOL_LINKAGE_NAME (sym)
233 +                       || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0))
234 +         continue;
235 +
236 +       values_printed = 1;
237 +       if (SYMBOL_PRINT_NAME (sym))
238 +         printf_filtered (_("Contents of F77 COMMON block '%s':\n"),
239 +                          SYMBOL_PRINT_NAME (sym));
240 +       else
241 +         printf_filtered (_("Contents of blank COMMON block:\n"));
242 +       
243 +       for (index = 0; index < TYPE_NFIELDS (type); index++)
244 +         {
245 +           struct value *val;
246 +
247 +           gdb_assert (field_is_static (&TYPE_FIELD (type, index)));
248 +           val = value_static_field (type, index);
249 +
250 +           printf_filtered ("%s = ", TYPE_FIELD_NAME (type, index));
251 +           value_print (val, gdb_stdout, &opts);
252 +           putchar_filtered ('\n');
253 +         }
254  
255 -  printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
256 +       putchar_filtered ('\n');
257 +      }
258  
259 -  while (tmp != NULL)
260 -    {
261 -      if (strcmp (tmp->owning_function, funname) == 0)
262 -       printf_filtered ("%s\n", tmp->name);
263 -
264 -      tmp = tmp->next;
265 -    }
266 +  return values_printed;
267  }
268  
269  /* This function is used to print out the values in a given COMMON 
270 @@ -526,11 +560,9 @@ list_all_visible_commons (char *funname)
271  static void
272  info_common_command (char *comname, int from_tty)
273  {
274 -  SAVED_F77_COMMON_PTR the_common;
275 -  COMMON_ENTRY_PTR entry;
276    struct frame_info *fi;
277 -  char *funname = 0;
278 -  struct symbol *func;
279 +  struct block *block;
280 +  int values_printed = 0;
281  
282    /* We have been told to display the contents of F77 COMMON 
283       block supposedly visible in this function.  Let us 
284 @@ -542,74 +574,31 @@ info_common_command (char *comname, int 
285    /* The following is generally ripped off from stack.c's routine 
286       print_frame_info().  */
287  
288 -  func = find_pc_function (get_frame_pc (fi));
289 -  if (func)
290 +  block = get_frame_block (fi, 0);
291 +  if (block == NULL)
292      {
293 -      /* In certain pathological cases, the symtabs give the wrong
294 -         function (when we are in the first function in a file which
295 -         is compiled without debugging symbols, the previous function
296 -         is compiled with debugging symbols, and the "foo.o" symbol
297 -         that is supposed to tell us where the file with debugging symbols
298 -         ends has been truncated by ar because it is longer than 15
299 -         characters).
300 -
301 -         So look in the minimal symbol tables as well, and if it comes
302 -         up with a larger address for the function use that instead.
303 -         I don't think this can ever cause any problems; there shouldn't
304 -         be any minimal symbols in the middle of a function.
305 -         FIXME:  (Not necessarily true.  What about text labels?)  */
306 -
307 -      struct minimal_symbol *msymbol = 
308 -       lookup_minimal_symbol_by_pc (get_frame_pc (fi));
309 -
310 -      if (msymbol != NULL
311 -         && (SYMBOL_VALUE_ADDRESS (msymbol)
312 -             > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
313 -       funname = SYMBOL_LINKAGE_NAME (msymbol);
314 -      else
315 -       funname = SYMBOL_LINKAGE_NAME (func);
316 -    }
317 -  else
318 -    {
319 -      struct minimal_symbol *msymbol =
320 -       lookup_minimal_symbol_by_pc (get_frame_pc (fi));
321 -
322 -      if (msymbol != NULL)
323 -       funname = SYMBOL_LINKAGE_NAME (msymbol);
324 -      else /* Got no 'funname', code below will fail.  */
325 -       error (_("No function found for frame."));
326 +      printf_filtered (_("No symbol table info available.\n"));
327 +      return;
328      }
329  
330 -  /* If comname is NULL, we assume the user wishes to see the 
331 -     which COMMON blocks are visible here and then return.  */
332 -
333 -  if (comname == 0)
334 +  while (block)
335      {
336 -      list_all_visible_commons (funname);
337 -      return;
338 +      if (info_common_command_for_block (block, fi, comname))
339 +       values_printed = 1;
340 +      /* After handling the function's top-level block, stop.  Don't
341 +         continue to its superblock, the block of per-file symbols.  */
342 +      if (BLOCK_FUNCTION (block))
343 +       break;
344 +      block = BLOCK_SUPERBLOCK (block);
345      }
346  
347 -  the_common = find_common_for_function (comname, funname);
348 -
349 -  if (the_common)
350 +  if (!values_printed)
351      {
352 -      if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
353 -       printf_filtered (_("Contents of blank COMMON block:\n"));
354 +      if (comname)
355 +       printf_filtered (_("No common block '%s'.\n"), comname);
356        else
357 -       printf_filtered (_("Contents of F77 COMMON block '%s':\n"), comname);
358 -
359 -      printf_filtered ("\n");
360 -      entry = the_common->entries;
361 -
362 -      while (entry != NULL)
363 -       {
364 -         print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0);
365 -         entry = entry->next;
366 -       }
367 +       printf_filtered (_("No common blocks.\n"));
368      }
369 -  else
370 -    printf_filtered (_("Cannot locate the common block %s in function '%s'\n"),
371 -                    comname, funname);
372  }
373  
374  void
375 Index: gdb-7.2.90.20110525/gdb/stack.c
376 ===================================================================
377 --- gdb-7.2.90.20110525.orig/gdb/stack.c        2011-05-25 17:05:21.000000000 +0200
378 +++ gdb-7.2.90.20110525/gdb/stack.c     2011-05-25 17:07:02.000000000 +0200
379 @@ -1525,6 +1525,8 @@ iterate_over_block_locals (struct block 
380         case LOC_COMPUTED:
381           if (SYMBOL_IS_ARGUMENT (sym))
382             break;
383 +         if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
384 +           break;
385           (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
386           break;
387  
388 Index: gdb-7.2.90.20110525/gdb/symtab.h
389 ===================================================================
390 --- gdb-7.2.90.20110525.orig/gdb/symtab.h       2011-05-25 17:05:21.000000000 +0200
391 +++ gdb-7.2.90.20110525/gdb/symtab.h    2011-05-25 17:07:02.000000000 +0200
392 @@ -411,7 +411,10 @@ typedef enum domain_enum_tag
393    TYPES_DOMAIN,
394  
395    /* Any type.  */
396 -  ALL_DOMAIN
397 +  ALL_DOMAIN,
398 +
399 +  /* Fortran common blocks.  Their naming must be separate from VAR_DOMAIN.  */
400 +  COMMON_BLOCK_DOMAIN
401  }
402  domain_enum;
403  
404 Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp
405 ===================================================================
406 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
407 +++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp      2011-05-25 17:07:02.000000000 +0200
408 @@ -0,0 +1,101 @@
409 +# Copyright 2008 Free Software Foundation, Inc.
410 +
411 +# This program is free software; you can redistribute it and/or modify
412 +# it under the terms of the GNU General Public License as published by
413 +# the Free Software Foundation; either version 2 of the License, or
414 +# (at your option) any later version.
415 +# 
416 +# This program is distributed in the hope that it will be useful,
417 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
418 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
419 +# GNU General Public License for more details.
420 +# 
421 +# You should have received a copy of the GNU General Public License
422 +# along with this program; if not, write to the Free Software
423 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
424 +
425 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
426 +
427 +set testfile "common-block"
428 +set srcfile ${testfile}.f90
429 +set binfile ${objdir}/${subdir}/${testfile}
430 +
431 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
432 +    untested "Couldn't compile ${srcfile}"
433 +    return -1
434 +}
435 +
436 +gdb_exit
437 +gdb_start
438 +gdb_reinitialize_dir $srcdir/$subdir
439 +gdb_load ${binfile}
440 +
441 +if ![runto MAIN__] then {
442 +    perror "couldn't run to breakpoint MAIN__"
443 +    continue
444 +}
445 +
446 +gdb_breakpoint [gdb_get_line_number "stop-here-out"]
447 +gdb_continue_to_breakpoint "stop-here-out"
448 +
449 +# Common block naming with source name /foo/:
450 +#                .symtab  DW_TAG_common_block's DW_AT_name
451 +# Intel Fortran  foo_     foo_
452 +# GNU Fortran    foo_     foo
453 +#set suffix "_"
454 +set suffix ""
455 +
456 +set int4 {(integer\(kind=4\)|INTEGER\(4\))}
457 +set real4 {(real\(kind=4\)|REAL\(4\))}
458 +set real8 {(real\(kind=8\)|REAL\(8\))}
459 +
460 +gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context."
461 +gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context."
462 +gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context."
463 +gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
464 +gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
465 +gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
466 +
467 +gdb_test "info locals" "ix_x = 11\r\niy_y = 22\r\niz_z = 33\r\nix = 1\r\niy = 2\r\niz = 3" "info locals out"
468 +gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix_x = 11\r\niy_y = 22\r\niz_z = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix = 1\r\niy = 2\r\niz = 3" "info common out"
469 +
470 +gdb_test "ptype ix" "type = $int4" "ptype ix out"
471 +gdb_test "ptype iy" "type = $real4" "ptype iy out"
472 +gdb_test "ptype iz" "type = $real8" "ptype iz out"
473 +gdb_test "ptype ix_x" "type = $int4" "ptype ix_x out"
474 +gdb_test "ptype iy_y" "type = $real4" "ptype iy_y out"
475 +gdb_test "ptype iz_z" "type = $real8" "ptype iz_z out"
476 +
477 +gdb_test "p ix" " = 1 *" "p ix out"
478 +gdb_test "p iy" " = 2 *" "p iy out"
479 +gdb_test "p iz" " = 3 *" "p iz out"
480 +gdb_test "p ix_x" " = 11 *" "p ix_x out"
481 +gdb_test "p iy_y" " = 22 *" "p iy_y out"
482 +gdb_test "p iz_z" " = 33 *" "p iz_z out"
483 +
484 +gdb_breakpoint [gdb_get_line_number "stop-here-in"]
485 +gdb_continue_to_breakpoint "stop-here-in"
486 +
487 +gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." "whatis foo$suffix in"
488 +gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." "ptype foo$suffix in"
489 +gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." "p foo$suffix in"
490 +gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "whatis fo_o$suffix in"
491 +gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "ptype fo_o$suffix in"
492 +gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "p fo_o$suffix in"
493 +
494 +gdb_test "info locals" "ix = 11\r\niy2 = 22\r\niz = 33\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3\r\niy = 5\r\niz_z = 55" "info locals in"
495 +gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix = 11\r\niy2 = 22\r\niz = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3" "info common in"
496 +
497 +gdb_test "ptype ix" "type = $int4" "ptype ix in"
498 +gdb_test "ptype iy2" "type = $real4" "ptype iy2 in"
499 +gdb_test "ptype iz" "type = $real8" "ptype iz in"
500 +gdb_test "ptype ix_x" "type = $int4" "ptype ix_x in"
501 +gdb_test "ptype iy_y" "type = $real4" "ptype iy_y in"
502 +gdb_test "ptype iz_z2" "type = $real8" "ptype iz_z2 in"
503 +
504 +gdb_test "p ix" " = 11 *" "p ix in"
505 +gdb_test "p iy2" " = 22 *" "p iy2 in"
506 +gdb_test "p iz" " = 33 *" "p iz in"
507 +gdb_test "p ix_x" " = 1 *" "p ix_x in"
508 +gdb_test "p iy_y" " = 2 *" "p iy_y in"
509 +gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
510 Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90
511 ===================================================================
512 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
513 +++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90      2011-05-25 17:07:02.000000000 +0200
514 @@ -0,0 +1,67 @@
515 +! Copyright 2008 Free Software Foundation, Inc.
516 +!
517 +! This program is free software; you can redistribute it and/or modify
518 +! it under the terms of the GNU General Public License as published by
519 +! the Free Software Foundation; either version 2 of the License, or
520 +! (at your option) any later version.
521 +!
522 +! This program is distributed in the hope that it will be useful,
523 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
524 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
525 +! GNU General Public License for more details.
526 +!
527 +! You should have received a copy of the GNU General Public License
528 +! along with this program; if not, write to the Free Software
529 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
530 +!
531 +! Ihis file is the Fortran source file for dynamic.exp.
532 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
533 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
534 +
535 +subroutine in
536 +
537 +   INTEGER*4            ix
538 +   REAL*4               iy2
539 +   REAL*8               iz
540 +
541 +   INTEGER*4            ix_x
542 +   REAL*4               iy_y
543 +   REAL*8               iz_z2
544 +
545 +   common /fo_o/ix,iy2,iz
546 +   common /foo/ix_x,iy_y,iz_z2
547 +
548 +   iy = 5
549 +   iz_z = 55
550 +
551 +   if (ix .ne. 11 .or. iy2 .ne. 22.0 .or. iz .ne. 33.0) call abort
552 +   if (ix_x .ne. 1 .or. iy_y .ne. 2.0 .or. iz_z2 .ne. 3.0) call abort
553 +
554 +   ix = 0                                      ! stop-here-in
555 +
556 +end subroutine in
557 +
558 +program common_test
559 +
560 +   INTEGER*4            ix
561 +   REAL*4               iy
562 +   REAL*8               iz
563 +
564 +   INTEGER*4            ix_x
565 +   REAL*4               iy_y
566 +   REAL*8               iz_z
567 +
568 +   common /foo/ix,iy,iz
569 +   common /fo_o/ix_x,iy_y,iz_z
570 +
571 +   ix = 1
572 +   iy = 2.0
573 +   iz = 3.0
574 +
575 +   ix_x = 11
576 +   iy_y = 22.0
577 +   iz_z = 33.0
578 +
579 +   call in                                     ! stop-here-out
580 +
581 +end program common_test
This page took 0.127569 seconds and 3 git commands to generate.