struct arc_reg_data_type *type = calloc(1, sizeof(*type));
struct reg_data_type_flags *flags = &type->data_type_flags;
struct reg_data_type_flags_field *fields = calloc(fields_sz, sizeof(*fields));
- struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*type));
+ type->reg_type_flags_field = fields;
+ struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*bitfields));
if (!(type && fields && bitfields)) {
Jim_SetResultFormatted(goi.interp, "Failed to allocate memory.");
goto fail;
struct arc_reg_data_type *type = calloc(1, sizeof(*type));
struct reg_data_type_struct *struct_type = &type->data_type_struct;
struct reg_data_type_struct_field *fields = calloc(fields_sz, sizeof(*fields));
- struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*type));
+ type->reg_type_struct_field = fields;
+ struct arc_reg_bitfield *bitfields = calloc(fields_sz, sizeof(*bitfields));
if (!(type && fields && bitfields)) {
Jim_SetResultFormatted(goi.interp, "Failed to allocate memory.");
goto fail;
int type_name_len = strlen(type_name);
int e = ERROR_OK;
- /* At least we need to specify 4 parameters: name, number, type and gdb_feature,
- * which means there should be 8 arguments */
- if (goi.argc < 8) {
+ /* At least we need to specify 4 parameters: name, number and gdb_feature,
+ * which means there should be 6 arguments. Also there can be additional paramters
+ * "-type <type>", "-g" and "-core" or "-bcr" which makes maximum 10 parameters. */
+ if (goi.argc < 6 || goi.argc > 10) {
free_reg_desc(reg);
Jim_SetResultFormatted(goi.interp,
- "Should be at least 8 argnuments: -name <name> "
- "-num <num> -type <type> -feature <gdb_feature>.");
+ "Should be at least 6 argnuments and not greater than 10: "
+ " -name <name> -num <num> -feature <gdb_feature> "
+ " [-type <type_name>] [-core|-bcr] [-g].");
return JIM_ERR;
}
target = get_current_target(ctx);
if (!target) {
Jim_SetResultFormatted(goi.interp, "No current target");
+ free_reg_desc(reg);
return JIM_ERR;
}