* [RFA] fix gdb.ada/null_record.exp
@ 2007-01-02 11:30 Joel Brobecker
2007-01-02 14:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2007-01-02 11:30 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]
Hello,
Daniel reported that null_record.exp was failing. The test was failing
on my side as well, although not the same way (I was so intent on
finding out what the cause was that I didn't pay enough attention to
what Daniel posted - sorry).
Here is what I observed:
ptype empty
type = <void>
(gdb) FAIL: gdb.ada/null_record.exp: ptype on null record
The output is not a surprise when you look at what ada_evaluate_subexp
returns for OP_TYPE expressions:
case OP_TYPE:
/* The value is not supposed to be used. This is here to make it
easier to accommodate expressions that contain types. */
(*pos) += 2;
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
!!!-> return allocate_value (builtin_type_void);
else
error (_("Attempt to use a type name as an expression"));
The reason this was good enough is that, in GDB 6.4 (we are still
using this as our baseline), ptype_command was not doing a full
evaluation of the expression to get the type description. Rather,
it used a short-cut:
static struct type *
ptype_eval (struct expression *exp)
{
if (exp->elts[0].opcode == OP_TYPE)
{
return (exp->elts[1].type);
}
else
[...]
}
This was changed since then to call evaluate_type (expr) instead,
Knowing this, I discovered that calling ptype on probably any type
name would return this "<void>" type. I reproduced this with a non-
null record too, for instance.
The proposed fix is attached:
2007-01-02 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_evaluate_subexp) [OP_TYPE]: Return a value with
the appropriate type rather than a bogus void type.
Tested on x86-linux, no regression. Fixes the null_record.exp on my side.
OK to apply?
Thanks,
--
Joel
[-- Attachment #2: ada-lang.c.diff --]
[-- Type: text/plain, Size: 628 bytes --]
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.85
diff -u -p -r1.85 ada-lang.c
--- ada-lang.c 1 Dec 2006 00:32:29 -0000 1.85
+++ ada-lang.c 2 Jan 2007 10:52:36 -0000
@@ -8576,7 +8576,7 @@ ada_evaluate_subexp (struct type *expect
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return allocate_value (builtin_type_void);
+ return allocate_value (exp->elts[pc + 1].type);
else
error (_("Attempt to use a type name as an expression"));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] fix gdb.ada/null_record.exp
2007-01-02 11:30 [RFA] fix gdb.ada/null_record.exp Joel Brobecker
@ 2007-01-02 14:33 ` Daniel Jacobowitz
2007-01-04 6:33 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-01-02 14:33 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Tue, Jan 02, 2007 at 03:31:02PM +0400, Joel Brobecker wrote:
> 2007-01-02 Joel Brobecker <brobecker@adacore.com>
>
> * ada-lang.c (ada_evaluate_subexp) [OP_TYPE]: Return a value with
> the appropriate type rather than a bogus void type.
OK. Won't fix it here, I think, but I strongly suspect bad debug info.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] fix gdb.ada/null_record.exp
2007-01-02 14:33 ` Daniel Jacobowitz
@ 2007-01-04 6:33 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2007-01-04 6:33 UTC (permalink / raw)
To: gdb-patches
> > 2007-01-02 Joel Brobecker <brobecker@adacore.com>
> >
> > * ada-lang.c (ada_evaluate_subexp) [OP_TYPE]: Return a value with
> > the appropriate type rather than a bogus void type.
>
> OK. Won't fix it here, I think, but I strongly suspect bad debug info.
Thanks Daniel. Checked in.
(we'll get your test to pass...)
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-04 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-02 11:30 [RFA] fix gdb.ada/null_record.exp Joel Brobecker
2007-01-02 14:33 ` Daniel Jacobowitz
2007-01-04 6:33 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox