ax-gdb.c: Add handling of TYPE_CODE_RANGE types.
authorJoel Brobecker <brobecker@gnat.com>
Wed, 14 Mar 2012 01:38:30 +0000 (01:38 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 14 Mar 2012 01:38:30 +0000 (01:38 +0000)
This patch fixes an error that occurs with GDB + GDBserver when
trying to insert a breakpoint with a condition that involves
a range type. For instance:

    type INT_T  is range 0 .. 1000;
    INT_VAR : INT_T := 12;

And then trying to insert the breakpoint:

    (gdb) break foo.adb:18 if int_var > 15
    Breakpoint 1 at 0x4021eb: file foo.adb, line 18.
    (gdb) cont
    Continuing.
    /[...]/ax-gdb.c:560: internal-error: gen_fetch: bad type code
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

This patch fixes the problem by adding handling for range types
in gen_fetch.

gdb/ChangeLog:

        * ax-gdb.c (gen_fetch): Add handling for TYPE_CODE_RANGE types.

gdb/ChangeLog
gdb/ax-gdb.c

index 8004bd9..d941d33 100644 (file)
@@ -1,5 +1,9 @@
 2012-03-13  Joel Brobecker  <brobecker@adacore.com>
 
+       * ax-gdb.c (gen_fetch): Add handling for TYPE_CODE_RANGE types.
+
+2012-03-13  Joel Brobecker  <brobecker@adacore.com>
+
        * aix-thread.c (supply_fprs): Make more consistent with fill_fprs.
 
 2012-03-13  Chris January  <chris.january@allinea.com>
index bd81338..126a4e7 100644 (file)
@@ -515,6 +515,9 @@ gen_fetch (struct agent_expr *ax, struct type *type)
       ax_trace_quick (ax, TYPE_LENGTH (type));
     }
 
+  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+    type = TYPE_TARGET_TYPE (type);
+
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_PTR: