tdesc: bitfields may carry a type

a bitfield may carry a type (bool or int), add support for that.

Change-Id: Ic831a9b8eac8579e8fdd7d0f01b7f1c9259e6739
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4459
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
riscv-compliance-dev
Matthias Welwarsky 2018-03-08 14:40:10 +01:00 committed by Matthias Welwarsky
parent 78a44055c5
commit 0808c6e8a3
2 changed files with 13 additions and 5 deletions

View File

@ -1909,6 +1909,8 @@ static int gdb_memory_map(struct connection *connection,
static const char *gdb_get_reg_type_name(enum reg_type type)
{
switch (type) {
case REG_TYPE_BOOL:
return "bool";
case REG_TYPE_INT:
return "int";
case REG_TYPE_INT8:
@ -1921,6 +1923,8 @@ static const char *gdb_get_reg_type_name(enum reg_type type)
return "int64";
case REG_TYPE_INT128:
return "int128";
case REG_TYPE_UINT:
return "uint";
case REG_TYPE_UINT8:
return "uint8";
case REG_TYPE_UINT16:
@ -2040,9 +2044,9 @@ static int gdb_generate_reg_type_description(struct target *target,
type->id, type->reg_type_struct->size);
while (field != NULL) {
xml_printf(&retval, tdesc, pos, size,
"<field name=\"%s\" start=\"%d\" end=\"%d\"/>\n",
field->name, field->bitfield->start,
field->bitfield->end);
"<field name=\"%s\" start=\"%d\" end=\"%d\" type=\"%s\" />\n",
field->name, field->bitfield->start, field->bitfield->end,
gdb_get_reg_type_name(field->bitfield->type));
field = field->next;
}
@ -2088,8 +2092,9 @@ static int gdb_generate_reg_type_description(struct target *target,
field = type->reg_type_flags->fields;
while (field != NULL) {
xml_printf(&retval, tdesc, pos, size,
"<field name=\"%s\" start=\"%d\" end=\"%d\"/>\n",
field->name, field->bitfield->start, field->bitfield->end);
"<field name=\"%s\" start=\"%d\" end=\"%d\" type=\"%s\" />\n",
field->name, field->bitfield->start, field->bitfield->end,
gdb_get_reg_type_name(field->bitfield->type));
field = field->next;
}

View File

@ -25,12 +25,14 @@
struct target;
enum reg_type {
REG_TYPE_BOOL,
REG_TYPE_INT,
REG_TYPE_INT8,
REG_TYPE_INT16,
REG_TYPE_INT32,
REG_TYPE_INT64,
REG_TYPE_INT128,
REG_TYPE_UINT,
REG_TYPE_UINT8,
REG_TYPE_UINT16,
REG_TYPE_UINT32,
@ -66,6 +68,7 @@ struct reg_data_type_union {
struct reg_data_type_bitfield {
uint32_t start;
uint32_t end;
enum reg_type type;
};
struct reg_data_type_struct_field {