~ubuntu-branches/debian/jessie/gdb/jessie

« back to all changes in this revision

Viewing changes to gdb/ada-typeprint.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2010-03-20 01:21:29 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100320012129-t7h25y8zgr8c2369
Tags: 7.1-1
* New upstream release, including:
  - PIE support (Closes: #346409).
  - C++ improvements, including static_cast<> et al, namespace imports,
    and bug fixes in printing virtual base classes.
  - Multi-program debugging.  One GDB can now debug multiple programs
    at the same time.
  - Python scripting improvements, including gdb.parse_and_eval.
  - Updated MIPS Linux signal frame layout (Closes: #570875).
  - No internal error stepping over _dl_debug_state (Closes: #569551).
* Update to Standards-Version: 3.8.4 (no changes required).
* Include more relevant (and smaller) docs in the gdbserver package
  (Closes: #571132).
* Do not duplicate documentation in gdb64, gdb-source, and libgdb-dev.
* Fix crash when switching into TUI mode (Closes: #568489).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Support for printing Ada types for GDB, the GNU debugger.
2
2
   Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002,
3
 
   2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
3
   2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
4
 
5
5
   This file is part of GDB.
6
6
 
114
114
    }
115
115
}
116
116
 
117
 
/* Print range type TYPE on STREAM.  */
 
117
/* Print TYPE on STREAM, preferably as a range.  */
118
118
 
119
119
static void
120
120
print_range (struct type *type, struct ui_file *stream)
121
121
{
122
 
  struct type *target_type;
123
 
  target_type = TYPE_TARGET_TYPE (type);
124
 
  if (target_type == NULL)
125
 
    target_type = type;
126
 
 
127
 
  switch (TYPE_CODE (target_type))
 
122
  switch (TYPE_CODE (type))
128
123
    {
129
124
    case TYPE_CODE_RANGE:
130
 
    case TYPE_CODE_INT:
131
 
    case TYPE_CODE_BOOL:
132
 
    case TYPE_CODE_CHAR:
133
125
    case TYPE_CODE_ENUM:
 
126
      {
 
127
        struct type *target_type;
 
128
        target_type = TYPE_TARGET_TYPE (type);
 
129
        if (target_type == NULL)
 
130
          target_type = type;
 
131
        ada_print_scalar (target_type, ada_discrete_type_low_bound (type),
 
132
                          stream);
 
133
        fprintf_filtered (stream, " .. ");
 
134
        ada_print_scalar (target_type, ada_discrete_type_high_bound (type),
 
135
                          stream);
 
136
      }
134
137
      break;
135
138
    default:
136
 
      target_type = NULL;
137
 
      break;
138
 
    }
139
 
 
140
 
  if (TYPE_NFIELDS (type) < 2)
141
 
    {
142
 
      /* A range needs at least 2 bounds to be printed.  If there are less
143
 
         than 2, just print the type name instead of the range itself.
144
 
         This check handles cases such as characters, for example.
145
 
 
146
 
         If the name is not defined, then we don't print anything.
147
 
       */
148
139
      fprintf_filtered (stream, "%.*s",
149
140
                        ada_name_prefix_len (TYPE_NAME (type)),
150
141
                        TYPE_NAME (type));
151
 
    }
152
 
  else
153
 
    {
154
 
      /* We extract the range type bounds respectively from the first element
155
 
         and the last element of the type->fields array */
156
 
      const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type);
157
 
      const LONGEST upper_bound = (TYPE_CODE (type) == TYPE_CODE_RANGE
158
 
        ? (LONGEST) TYPE_HIGH_BOUND (type)
159
 
        : (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1));
160
 
 
161
 
      ada_print_scalar (target_type, lower_bound, stream);
162
 
      fprintf_filtered (stream, " .. ");
163
 
      ada_print_scalar (target_type, upper_bound, stream);
 
142
      break;
164
143
    }
165
144
}
166
145
 
331
310
    }
332
311
}
333
312
 
334
 
/* Print representation of special VAX floating-point type TYPE on STREAM.  */
335
 
 
336
 
static void
337
 
print_vax_floating_point_type (struct type *type, struct ui_file *stream)
338
 
{
339
 
  fprintf_filtered (stream, "<float format %c>",
340
 
                    ada_vax_float_type_suffix (type));
341
 
}
342
 
 
343
313
/* Print simple (constrained) array type TYPE on STREAM.  LEVEL is the
344
314
   recursion (indentation) level, in case the element type itself has
345
315
   nested structure, and SHOW is the number of levels of internal
352
322
  int bitsize;
353
323
  int n_indices;
354
324
 
355
 
  if (ada_is_packed_array_type (type))
 
325
  if (ada_is_constrained_packed_array_type (type))
356
326
    type = ada_coerce_to_simple_array_type (type);
357
327
 
358
328
  bitsize = 0;
770
740
 
771
741
  if (ada_is_aligner_type (type))
772
742
    ada_print_type (ada_aligned_type (type), "", stream, show, level);
773
 
  else if (ada_is_packed_array_type (type))
 
743
  else if (ada_is_constrained_packed_array_type (type))
774
744
    {
775
745
      if (TYPE_CODE (type) == TYPE_CODE_PTR)
776
746
        {
807
777
      case TYPE_CODE_INT:
808
778
        if (ada_is_fixed_point_type (type))
809
779
          print_fixed_point_type (type, stream);
810
 
        else if (ada_is_vax_floating_type (type))
811
 
          print_vax_floating_point_type (type, stream);
812
780
        else
813
781
          {
814
782
            char *name = ada_type_name (type);
825
793
      case TYPE_CODE_RANGE:
826
794
        if (ada_is_fixed_point_type (type))
827
795
          print_fixed_point_type (type, stream);
828
 
        else if (ada_is_vax_floating_type (type))
829
 
          print_vax_floating_point_type (type, stream);
830
796
        else if (ada_is_modular_type (type))
831
797
          fprintf_filtered (stream, "mod %s", 
832
798
                            int_string (ada_modulus (type), 10, 0, 0, 1));