Make linux_stop_lwp be a shared function
[deliverable/binutils-gdb.git] / gdb / ada-typeprint.c
index a43ced7cfb7e34ef43dcbb1ec43801b61d152d85..fd8513893eb1605268c44f8a13a2ce1a6e819bb9 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Ada types for GDB, the GNU debugger.
-   Copyright (C) 1986-2014 Free Software Foundation, Inc.
+   Copyright (C) 1986-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -32,9 +32,7 @@
 #include "c-lang.h"
 #include "typeprint.h"
 #include "ada-lang.h"
-
 #include <ctype.h>
-#include <errno.h>
 
 static int print_selected_record_field_types (struct type *, struct type *,
                                              int, int,
@@ -117,6 +115,9 @@ type_is_full_subrange_of_target_type (struct type *type)
   if (subtype == NULL)
     return 0;
 
+  if (is_dynamic_type (type))
+    return 0;
+
   if (ada_discrete_type_low_bound (type)
       != ada_discrete_type_low_bound (subtype))
     return 0;
@@ -158,15 +159,36 @@ print_range (struct type *type, struct ui_file *stream,
     case TYPE_CODE_ENUM:
       {
        struct type *target_type;
+       LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
+       int got_error = 0;
 
        target_type = TYPE_TARGET_TYPE (type);
        if (target_type == NULL)
          target_type = type;
-       ada_print_scalar (target_type, ada_discrete_type_low_bound (type),
-                         stream);
-       fprintf_filtered (stream, " .. ");
-       ada_print_scalar (target_type, ada_discrete_type_high_bound (type),
-                         stream);
+
+       TRY
+         {
+           lo = ada_discrete_type_low_bound (type);
+           hi = ada_discrete_type_high_bound (type);
+         }
+       CATCH (e, RETURN_MASK_ERROR)
+         {
+           /* This can happen when the range is dynamic.  Sometimes,
+              resolving dynamic property values requires us to have
+              access to an actual object, which is not available
+              when the user is using the "ptype" command on a type.
+              Print the range as an unbounded range.  */
+           fprintf_filtered (stream, "<>");
+           got_error = 1;
+         }
+       END_CATCH
+
+       if (!got_error)
+         {
+           ada_print_scalar (target_type, lo, stream);
+           fprintf_filtered (stream, " .. ");
+           ada_print_scalar (target_type, hi, stream);
+         }
       }
       break;
     default:
This page took 0.036439 seconds and 4 git commands to generate.