This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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:
ada-lang.c.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |