cancel: [PATCH 4/4] compile: New 'compile print'

Jan Kratochvil
2015-04-05T17:01:34Z

On Thu, 26 Mar 2015 21:57:52 +0100, Jan Kratochvil wrote:
> + fprintf_unfiltered (buf,
> +"__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
> +"typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
> +"if (" COMPILE_I_PRINT_EXPR_TAKE_ADDRESS ")\n"
> +"\tmemcpy (" COMPILE_I_PRINT_OUT_ARG ", &" COMPILE_I_EXPR_VAL ",\n"
> + "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
> +"else\n"
> +"\tmemcpy (" COMPILE_I_PRINT_OUT_ARG ", " COMPILE_I_EXPR_VAL ",\n"
> + "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
> + , input, input);

This cannot work, when trying to print struct variable GCC fails for the
second memcpy() with:
gdb command line:7:2: error: cannot convert to a pointer type^M
It will need to perform two compilation steps (or just one if the first one is
the right kind).

Jan