]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-fortran-common-reduce.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-fortran-common-reduce.patch
1 Index: gdb-7.2.50.20110117/gdb/f-lang.c
2 ===================================================================
3 --- gdb-7.2.50.20110117.orig/gdb/f-lang.c       2011-01-07 20:36:16.000000000 +0100
4 +++ gdb-7.2.50.20110117/gdb/f-lang.c    2011-01-17 15:56:07.000000000 +0100
5 @@ -57,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF,
6  /* Local functions */
7  
8  extern void _initialize_f_language (void);
9 -#if 0
10 -static void clear_function_list (void);
11 -static long get_bf_for_fcn (long);
12 -static void clear_bf_list (void);
13 -static void patch_all_commons_by_name (char *, CORE_ADDR, int);
14 -static SAVED_F77_COMMON_PTR find_first_common_named (char *);
15 -static void add_common_entry (struct symbol *);
16 -static void add_common_block (char *, CORE_ADDR, int, char *);
17 -static SAVED_FUNCTION *allocate_saved_function_node (void);
18 -static SAVED_BF_PTR allocate_saved_bf_node (void);
19 -static COMMON_ENTRY_PTR allocate_common_entry_node (void);
20 -static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void);
21 -static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int);
22 -#endif
23  
24  static void f_printchar (int c, struct type *type, struct ui_file * stream);
25  static void f_emit_char (int c, struct type *type,
26 @@ -461,185 +447,7 @@ _initialize_f_language (void)
27    add_language (&f_language_defn);
28  }
29  
30 -#if 0
31 -static SAVED_BF_PTR
32 -allocate_saved_bf_node (void)
33 -{
34 -  SAVED_BF_PTR new;
35 -
36 -  new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF));
37 -  return (new);
38 -}
39 -
40 -static SAVED_FUNCTION *
41 -allocate_saved_function_node (void)
42 -{
43 -  SAVED_FUNCTION *new;
44 -
45 -  new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION));
46 -  return (new);
47 -}
48 -
49 -static SAVED_F77_COMMON_PTR
50 -allocate_saved_f77_common_node (void)
51 -{
52 -  SAVED_F77_COMMON_PTR new;
53 -
54 -  new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON));
55 -  return (new);
56 -}
57 -
58 -static COMMON_ENTRY_PTR
59 -allocate_common_entry_node (void)
60 -{
61 -  COMMON_ENTRY_PTR new;
62 -
63 -  new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
64 -  return (new);
65 -}
66 -#endif
67 -
68  SAVED_F77_COMMON_PTR head_common_list = NULL;  /* Ptr to 1st saved COMMON  */
69 -SAVED_F77_COMMON_PTR tail_common_list = NULL;  /* Ptr to last saved COMMON  */
70 -SAVED_F77_COMMON_PTR current_common = NULL;    /* Ptr to current COMMON */
71 -
72 -#if 0
73 -static SAVED_BF_PTR saved_bf_list = NULL;      /* Ptr to (.bf,function) 
74 -                                                  list */
75 -static SAVED_BF_PTR saved_bf_list_end = NULL;  /* Ptr to above list's end */
76 -static SAVED_BF_PTR current_head_bf_list = NULL;    /* Current head of
77 -                                                      above list.  */
78 -
79 -static SAVED_BF_PTR tmp_bf_ptr;        /* Generic temporary for use 
80 -                                  in macros.  */
81 -
82 -/* The following function simply enters a given common block onto 
83 -   the global common block chain.  */
84 -
85 -static void
86 -add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab)
87 -{
88 -  SAVED_F77_COMMON_PTR tmp;
89 -  char *c, *local_copy_func_stab;
90 -
91 -  /* If the COMMON block we are trying to add has a blank 
92 -     name (i.e. "#BLNK_COM") then we set it to __BLANK
93 -     because the darn "#" character makes GDB's input 
94 -     parser have fits.  */
95 -
96 -
97 -  if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
98 -      || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
99 -    {
100 -
101 -      xfree (name);
102 -      name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
103 -      strcpy (name, BLANK_COMMON_NAME_LOCAL);
104 -    }
105 -
106 -  tmp = allocate_saved_f77_common_node ();
107 -
108 -  local_copy_func_stab = xmalloc (strlen (func_stab) + 1);
109 -  strcpy (local_copy_func_stab, func_stab);
110 -
111 -  tmp->name = xmalloc (strlen (name) + 1);
112 -
113 -  /* local_copy_func_stab is a stabstring, let us first extract the 
114 -     function name from the stab by NULLing out the ':' character.  */
115 -
116 -
117 -  c = NULL;
118 -  c = strchr (local_copy_func_stab, ':');
119 -
120 -  if (c)
121 -    *c = '\0';
122 -  else
123 -    error (_("Malformed function STAB found in add_common_block()"));
124 -
125 -
126 -  tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1);
127 -
128 -  strcpy (tmp->owning_function, local_copy_func_stab);
129 -
130 -  strcpy (tmp->name, name);
131 -  tmp->offset = offset;
132 -  tmp->next = NULL;
133 -  tmp->entries = NULL;
134 -  tmp->secnum = secnum;
135 -
136 -  current_common = tmp;
137 -
138 -  if (head_common_list == NULL)
139 -    {
140 -      head_common_list = tail_common_list = tmp;
141 -    }
142 -  else
143 -    {
144 -      tail_common_list->next = tmp;
145 -      tail_common_list = tmp;
146 -    }
147 -}
148 -#endif
149 -
150 -/* The following function simply enters a given common entry onto 
151 -   the "current_common" block that has been saved away.  */
152 -
153 -#if 0
154 -static void
155 -add_common_entry (struct symbol *entry_sym_ptr)
156 -{
157 -  COMMON_ENTRY_PTR tmp;
158 -
159 -
160 -
161 -  /* The order of this list is important, since 
162 -     we expect the entries to appear in decl.
163 -     order when we later issue "info common" calls.  */
164 -
165 -  tmp = allocate_common_entry_node ();
166 -
167 -  tmp->next = NULL;
168 -  tmp->symbol = entry_sym_ptr;
169 -
170 -  if (current_common == NULL)
171 -    error (_("Attempt to add COMMON entry with no block open!"));
172 -  else
173 -    {
174 -      if (current_common->entries == NULL)
175 -       {
176 -         current_common->entries = tmp;
177 -         current_common->end_of_entries = tmp;
178 -       }
179 -      else
180 -       {
181 -         current_common->end_of_entries->next = tmp;
182 -         current_common->end_of_entries = tmp;
183 -       }
184 -    }
185 -}
186 -#endif
187 -
188 -/* This routine finds the first encountred COMMON block named "name".  */
189 -
190 -#if 0
191 -static SAVED_F77_COMMON_PTR
192 -find_first_common_named (char *name)
193 -{
194 -
195 -  SAVED_F77_COMMON_PTR tmp;
196 -
197 -  tmp = head_common_list;
198 -
199 -  while (tmp != NULL)
200 -    {
201 -      if (strcmp (tmp->name, name) == 0)
202 -       return (tmp);
203 -      else
204 -       tmp = tmp->next;
205 -    }
206 -  return (NULL);
207 -}
208 -#endif
209  
210  /* This routine finds the first encountred COMMON block named "name" 
211     that belongs to function funcname.  */
212 @@ -662,193 +470,3 @@ find_common_for_function (char *name, ch
213      }
214    return (NULL);
215  }
216 -
217 -
218 -#if 0
219 -
220 -/* The following function is called to patch up the offsets 
221 -   for the statics contained in the COMMON block named
222 -   "name."  */
223 -
224 -static void
225 -patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum)
226 -{
227 -  COMMON_ENTRY_PTR entry;
228 -
229 -  blk->offset = offset;                /* Keep this around for future use.  */
230 -
231 -  entry = blk->entries;
232 -
233 -  while (entry != NULL)
234 -    {
235 -      SYMBOL_VALUE (entry->symbol) += offset;
236 -      SYMBOL_SECTION (entry->symbol) = secnum;
237 -
238 -      entry = entry->next;
239 -    }
240 -  blk->secnum = secnum;
241 -}
242 -
243 -/* Patch all commons named "name" that need patching.Since COMMON
244 -   blocks occur with relative infrequency, we simply do a linear scan on
245 -   the name.  Eventually, the best way to do this will be a
246 -   hashed-lookup.  Secnum is the section number for the .bss section
247 -   (which is where common data lives).  */
248 -
249 -static void
250 -patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum)
251 -{
252 -
253 -  SAVED_F77_COMMON_PTR tmp;
254 -
255 -  /* For blank common blocks, change the canonical reprsentation 
256 -     of a blank name */
257 -
258 -  if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
259 -      || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
260 -    {
261 -      xfree (name);
262 -      name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
263 -      strcpy (name, BLANK_COMMON_NAME_LOCAL);
264 -    }
265 -
266 -  tmp = head_common_list;
267 -
268 -  while (tmp != NULL)
269 -    {
270 -      if (COMMON_NEEDS_PATCHING (tmp))
271 -       if (strcmp (tmp->name, name) == 0)
272 -         patch_common_entries (tmp, offset, secnum);
273 -
274 -      tmp = tmp->next;
275 -    }
276 -}
277 -#endif
278 -
279 -/* This macro adds the symbol-number for the start of the function 
280 -   (the symbol number of the .bf) referenced by symnum_fcn to a 
281 -   list.  This list, in reality should be a FIFO queue but since 
282 -   #line pragmas sometimes cause line ranges to get messed up 
283 -   we simply create a linear list.  This list can then be searched 
284 -   first by a queueing algorithm and upon failure fall back to 
285 -   a linear scan.  */
286 -
287 -#if 0
288 -#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \
289 -  \
290 -  if (saved_bf_list == NULL) \
291 -{ \
292 -    tmp_bf_ptr = allocate_saved_bf_node(); \
293 -      \
294 -       tmp_bf_ptr->symnum_bf = (bf_sym); \
295 -         tmp_bf_ptr->symnum_fcn = (fcn_sym);  \
296 -           tmp_bf_ptr->next = NULL; \
297 -             \
298 -               current_head_bf_list = saved_bf_list = tmp_bf_ptr; \
299 -                 saved_bf_list_end = tmp_bf_ptr; \
300 -                 } \
301 -else \
302 -{  \
303 -     tmp_bf_ptr = allocate_saved_bf_node(); \
304 -       \
305 -         tmp_bf_ptr->symnum_bf = (bf_sym);  \
306 -          tmp_bf_ptr->symnum_fcn = (fcn_sym);  \
307 -            tmp_bf_ptr->next = NULL;  \
308 -              \
309 -                saved_bf_list_end->next = tmp_bf_ptr;  \
310 -                  saved_bf_list_end = tmp_bf_ptr; \
311 -                  }
312 -#endif
313 -
314 -/* This function frees the entire (.bf,function) list.  */
315 -
316 -#if 0
317 -static void
318 -clear_bf_list (void)
319 -{
320 -
321 -  SAVED_BF_PTR tmp = saved_bf_list;
322 -  SAVED_BF_PTR next = NULL;
323 -
324 -  while (tmp != NULL)
325 -    {
326 -      next = tmp->next;
327 -      xfree (tmp);
328 -      tmp = next;
329 -    }
330 -  saved_bf_list = NULL;
331 -}
332 -#endif
333 -
334 -int global_remote_debug;
335 -
336 -#if 0
337 -
338 -static long
339 -get_bf_for_fcn (long the_function)
340 -{
341 -  SAVED_BF_PTR tmp;
342 -  int nprobes = 0;
343 -
344 -  /* First use a simple queuing algorithm (i.e. look and see if the 
345 -     item at the head of the queue is the one you want).  */
346 -
347 -  if (saved_bf_list == NULL)
348 -    internal_error (__FILE__, __LINE__,
349 -                   _("cannot get .bf node off empty list"));
350 -
351 -  if (current_head_bf_list != NULL)
352 -    if (current_head_bf_list->symnum_fcn == the_function)
353 -      {
354 -       if (global_remote_debug)
355 -         fprintf_unfiltered (gdb_stderr, "*");
356 -
357 -       tmp = current_head_bf_list;
358 -       current_head_bf_list = current_head_bf_list->next;
359 -       return (tmp->symnum_bf);
360 -      }
361 -
362 -  /* If the above did not work (probably because #line directives were 
363 -     used in the sourcefile and they messed up our internal tables) we now do
364 -     the ugly linear scan.  */
365 -
366 -  if (global_remote_debug)
367 -    fprintf_unfiltered (gdb_stderr, "\ndefaulting to linear scan\n");
368 -
369 -  nprobes = 0;
370 -  tmp = saved_bf_list;
371 -  while (tmp != NULL)
372 -    {
373 -      nprobes++;
374 -      if (tmp->symnum_fcn == the_function)
375 -       {
376 -         if (global_remote_debug)
377 -           fprintf_unfiltered (gdb_stderr, "Found in %d probes\n", nprobes);
378 -         current_head_bf_list = tmp->next;
379 -         return (tmp->symnum_bf);
380 -       }
381 -      tmp = tmp->next;
382 -    }
383 -
384 -  return (-1);
385 -}
386 -
387 -static SAVED_FUNCTION_PTR saved_function_list = NULL;
388 -static SAVED_FUNCTION_PTR saved_function_list_end = NULL;
389 -
390 -static void
391 -clear_function_list (void)
392 -{
393 -  SAVED_FUNCTION_PTR tmp = saved_function_list;
394 -  SAVED_FUNCTION_PTR next = NULL;
395 -
396 -  while (tmp != NULL)
397 -    {
398 -      next = tmp->next;
399 -      xfree (tmp);
400 -      tmp = next;
401 -    }
402 -
403 -  saved_function_list = NULL;
404 -}
405 -#endif
406 Index: gdb-7.2.50.20110117/gdb/f-lang.h
407 ===================================================================
408 --- gdb-7.2.50.20110117.orig/gdb/f-lang.h       2011-01-17 15:47:37.000000000 +0100
409 +++ gdb-7.2.50.20110117/gdb/f-lang.h    2011-01-17 15:54:14.000000000 +0100
410 @@ -76,14 +76,9 @@ typedef struct saved_f77_common SAVED_F7
411  typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
412  
413  extern SAVED_F77_COMMON_PTR head_common_list;  /* Ptr to 1st saved COMMON  */
414 -extern SAVED_F77_COMMON_PTR tail_common_list;  /* Ptr to last saved COMMON  */
415 -extern SAVED_F77_COMMON_PTR current_common;    /* Ptr to current COMMON */
416  
417  extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
418  
419 -#define UNINITIALIZED_SECNUM -1
420 -#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
421 -
422  #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned  */
423  #define BLANK_COMMON_NAME_MF77     "__BLNK__"  /* MF77 assigned  */
424  #define BLANK_COMMON_NAME_LOCAL    "__BLANK"   /* Local GDB */
425 Index: gdb-7.2.50.20110117/gdb/f-valprint.c
426 ===================================================================
427 --- gdb-7.2.50.20110117.orig/gdb/f-valprint.c   2011-01-17 15:47:37.000000000 +0100
428 +++ gdb-7.2.50.20110117/gdb/f-valprint.c        2011-01-17 15:54:36.000000000 +0100
429 @@ -35,10 +35,6 @@
430  #include "command.h"
431  #include "block.h"
432  
433 -#if 0
434 -static int there_is_a_visible_common_named (char *);
435 -#endif
436 -
437  extern void _initialize_f_valprint (void);
438  static void info_common_command (char *, int);
439  static void list_all_visible_commons (char *);
440 @@ -604,67 +600,6 @@ info_common_command (char *comname, int 
441                      comname, funname);
442  }
443  
444 -/* This function is used to determine whether there is a
445 -   F77 common block visible at the current scope called 'comname'.  */
446 -
447 -#if 0
448 -static int
449 -there_is_a_visible_common_named (char *comname)
450 -{
451 -  SAVED_F77_COMMON_PTR the_common;
452 -  struct frame_info *fi;
453 -  char *funname = 0;
454 -  struct symbol *func;
455 -
456 -  if (comname == NULL)
457 -    error (_("Cannot deal with NULL common name!"));
458 -
459 -  fi = get_selected_frame (_("No frame selected"));
460 -
461 -  /* The following is generally ripped off from stack.c's routine 
462 -     print_frame_info().  */
463 -
464 -  func = find_pc_function (fi->pc);
465 -  if (func)
466 -    {
467 -      /* In certain pathological cases, the symtabs give the wrong
468 -         function (when we are in the first function in a file which
469 -         is compiled without debugging symbols, the previous function
470 -         is compiled with debugging symbols, and the "foo.o" symbol
471 -         that is supposed to tell us where the file with debugging symbols
472 -         ends has been truncated by ar because it is longer than 15
473 -         characters).
474 -
475 -         So look in the minimal symbol tables as well, and if it comes
476 -         up with a larger address for the function use that instead.
477 -         I don't think this can ever cause any problems; there shouldn't
478 -         be any minimal symbols in the middle of a function.
479 -         FIXME:  (Not necessarily true.  What about text labels?)  */
480 -
481 -      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
482 -
483 -      if (msymbol != NULL
484 -         && (SYMBOL_VALUE_ADDRESS (msymbol)
485 -             > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
486 -       funname = SYMBOL_LINKAGE_NAME (msymbol);
487 -      else
488 -       funname = SYMBOL_LINKAGE_NAME (func);
489 -    }
490 -  else
491 -    {
492 -      struct minimal_symbol *msymbol =
493 -       lookup_minimal_symbol_by_pc (fi->pc);
494 -
495 -      if (msymbol != NULL)
496 -       funname = SYMBOL_LINKAGE_NAME (msymbol);
497 -    }
498 -
499 -  the_common = find_common_for_function (comname, funname);
500 -
501 -  return (the_common ? 1 : 0);
502 -}
503 -#endif
504 -
505  void
506  _initialize_f_valprint (void)
507  {
This page took 0.075262 seconds and 3 git commands to generate.