This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit/Ada] Print value of array indexed by Boolean
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 19 Nov 2009 17:56:37 -0500
- Subject: [commit/Ada] Print value of array indexed by Boolean
When we switched the compiler to using the DWARF boolean encoding instead
of redefining an enumeration named "boolean", we had to make a few updates
Jto accomodate for that (Boolean is now no longer a TYPE_CODE_ENUM, but
a TYPE_CODE_BOOL). There is one location that we missed, causing the failure
described below.
Considering:
type Table is array (Boolean) of Integer;
My_Table : Table := (1234, 5678);
Trying to print either value of My_Table yielded:
(gdb) p my_table (false)
'POS only defined on discrete types
(gdb) p my_table (true)
'POS only defined on discrete types
Fixed thusly. Tested on x86_64-linux. Checked in.
--
Joel
>From 4d14d5fc00511116df1d778c77f78a9109195f9c Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 19 Nov 2009 17:16:50 -0500
Subject: [PATCH] [Ada] Print value of array indexed by Boolean
When we switched the compiler to use proper boolean types with DWARF,
we had to make a few updates to accomodate for that (Boolean is now no
longer a TYPE_CODE_ENUM, but a TYPE_CODE_BOOL). There is one location
that we missed, causing the failure described below.
Considering:
type Table is array (Boolean) of Integer;
My_Table : Table := (1234, 5678);
Trying to print either value of My_Table yielded:
(gdb) p my_table (false)
'POS only defined on discrete types
(gdb) p my_table (true)
'POS only defined on discrete types
Fixed thusly.
gdb/
* ada-lang.c (discrete_type_p): TYPE_CODE_BOOL is also a discrete type.
Tested on x86_64-linux.
---
gdb/ada-lang.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e7a8e3a..86af234 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3588,6 +3588,7 @@ discrete_type_p (struct type *type)
case TYPE_CODE_INT:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
+ case TYPE_CODE_BOOL:
return 1;
default:
return 0;
--
1.6.0.4