This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] ax-gdb.c: Add handling of TYPE_CODE_RANGE types.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>
- Date: Thu, 8 Mar 2012 14:28:34 -0800
- Subject: [RFA] ax-gdb.c: Add handling of TYPE_CODE_RANGE types.
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.
I'll work on a testcase for that next. In the meantime, tested on
x86_64-linux, no regression. OK to commit?
On a side note, I reviewed a bit the code, and I think we might want
to add the same sort of thing in gen_cast. But I haven't actually
produced a testcase that would cause an error, so I left this out.
At first glance, it seems to be the only area where it might be needed.
Thanks,
--
Joel
---
gdb/ax-gdb.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index cc057f8..a76e781 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -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:
--
1.7.1