This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] MI: Error out on -var-create invalid FRAME-ADDR
On Mon, 10 Aug 2009 18:54:52 +0200, Vladimir Prus wrote:
> Jan Kratochvil wrote:
>
> > - Â Â Âif (innermost_block && fi != NULL)
> > + Â Â Âif (innermost_block)
> > {
> > +ÂÂÂÂÂÂÂ Â/* User could specify explicit FRAME-ADDR which was not found but
> > +ÂÂÂÂÂÂÂ Â Â EXPRESSION is frame specific and we would not be able to evaluate
> > +ÂÂÂÂÂÂÂ Â Â it correctly next time. ÂWith VALID_BLOCK set we must also set
> > +ÂÂÂÂÂÂÂ Â Â FRAME and THREAD_ID. Â*/
> > +ÂÂÂÂÂÂÂ Âif (fi == NULL)
> > +ÂÂÂÂÂÂÂ Â Â{
> > +ÂÂÂÂÂÂÂ Â Â Âfprintf_unfiltered (gdb_stderr, "Failed to find the specified"
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ Â" frame.\n");
> > +ÂÂÂÂÂÂÂ Â Â Âreturn NULL;
> > +ÂÂÂÂÂÂÂ Â Â}
>
> Why is this fprintf + NULL return, as opposed to error?
I had there error before but changed it to match the code several lines above:
/* Don't allow variables to be created for types. */
if (var->root->exp->elts[0].opcode == OP_TYPE)
{
do_cleanups (old_chain);
fprintf_unfiltered (gdb_stderr, "Attempt to use a type name"
" as an expression.\n");
return NULL;
}
+
mi_gdb_test "-var-create int * int" \
"&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create int"
Expecting this former case cannot be changed due to MI2 compatibility but I am
free to change the new error "Failed to find the specified frame." to use
error(). Check it in with or without error()?
Thanks,
Jan