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 v3 7/9] compile: New 'compile print'


On 04/11/2015 08:44 PM, Jan Kratochvil wrote:

> +    case COMPILE_I_PRINT_ADDRESS_SCOPE:
> +    case COMPILE_I_PRINT_VALUE_SCOPE:
> +      fputs_unfiltered ("#include <string.h>\n"

OOC, why do we need the include?

> +			"void "
> +			GCC_FE_WRAPPER_FUNCTION
> +			" (struct "
> +			COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
> +			" *"
> +			COMPILE_I_SIMPLE_REGISTER_ARG_NAME
> +			", "
> +			COMPILE_I_PRINT_OUT_ARG_TYPE
> +			" "
> +			COMPILE_I_PRINT_OUT_ARG
> +			") {\n",
> +			buf);
> +      break;
> +
>      case COMPILE_I_RAW_SCOPE:
>        break;
>      default:

> @@ -354,6 +355,114 @@ copy_sections (bfd *abfd, asection *sect, void *data)
>    do_cleanups (cleanups);
>  }
>  
> +/* Fetch the type of COMPILE_I_EXPR_PTR_TYPE and COMPILE_I_EXPR_VAL
> +   symbols in OBJFILE so we can calculate how much memory to allocate
> +   for the out parameter.  This avoids needing a malloc in the generated
> +   code.  Throw an error if anything fails.
> +   Set *OUT_VALUE_TAKE_ADDRESSP depending whether inferior code should
> +   copy COMPILE_I_EXPR_VAL or its address - this depends on __auto_type
> +   array-to-pointer type conversion of COMPILE_I_EXPR_VAL, as detected
> +   by COMPILE_I_EXPR_PTR_TYPE preserving the array type.  */

This comment seems a bit stale.  At least, I don't see an
OUT_VALUE_TAKE_ADDRESSP parameter.

> +
> +static struct type *
> +get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
> +		    enum compile_i_scope_types scope)
> +{
> +  struct symbol *gdb_ptr_type_sym, *gdb_val_sym;
> +  struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type, *retval;
> +  const struct block *block;
> +  const struct blockvector *bv;
> +  int nblocks = 0;
> +  int block_loop = 0;

Otherwise this looks reasonable to me.

Thanks,
Pedro Alves


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