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]

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


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


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