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]

Re: [patch] Fix `return' of long/long-long results with no debuginfo


> 2009-03-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* stack.c (return_command <retval_exp>): New variables retval_expr
> 	and old_chain.  Inline parse_and_eval to initialize retval_expr.  Check
> 	RETVAL_EXPR for UNOP_CAST and set RETURN_TYPE to the RETURN_VALUE type
> 	if RETURN_TYPE is NULL.

This looks good to me, but I don't understand the error message when
the user forgot to cast the result. I wonder if we shouldn't just
preserve the old behavior which is to implicitly cast to "int"?

> >        if (return_type == NULL)
> > -	return_type = builtin_type (get_frame_arch (thisframe))->builtin_int;
> > +      	{
> > +	  if (retval_expr->elts[0].opcode != UNOP_CAST)
> > +	    error (_("Selected stack frame (with no associated function) "
> > +		     "requires an explicit cast of the value to return"));
> > +	  return_type = value_type (return_value);
> > +	}

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]