forked from auracaster/openocd
target, register: allow a register hidden from gdb and 'reg' cmd
Introduce a 'hidden' flag in struct reg to support a register cache containing different views of same data: e.g. Cortex-M has primask, basepri, faultmask and control registers accessed as one word. With the hidden flag we can add an reg_list item corresponding to hw access without exposing the register to user level. All the struct reg are allocated with calloc() but one in xscale.c allocated by malloc(). Change this one to use calloc() as well to guarantee initial value hidden=false Change-Id: I8da9f5a5a60777ae7ef943a841307487bd80fc6f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5325 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
109dc1975f
commit
f8453ae52c
@@ -1189,7 +1189,7 @@ static int gdb_get_registers_packet(struct connection *connection,
|
||||
return gdb_error(connection, retval);
|
||||
|
||||
for (i = 0; i < reg_list_size; i++) {
|
||||
if (reg_list[i] == NULL || reg_list[i]->exist == false)
|
||||
if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden)
|
||||
continue;
|
||||
reg_packet_size += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
|
||||
}
|
||||
@@ -1203,7 +1203,7 @@ static int gdb_get_registers_packet(struct connection *connection,
|
||||
reg_packet_p = reg_packet;
|
||||
|
||||
for (i = 0; i < reg_list_size; i++) {
|
||||
if (reg_list[i] == NULL || reg_list[i]->exist == false)
|
||||
if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden)
|
||||
continue;
|
||||
if (!reg_list[i]->valid) {
|
||||
retval = reg_list[i]->type->get(reg_list[i]);
|
||||
@@ -2176,7 +2176,7 @@ static int get_reg_features_list(struct target *target, char const **feature_lis
|
||||
*feature_list = calloc(1, sizeof(char *));
|
||||
|
||||
for (int i = 0; i < reg_list_size; i++) {
|
||||
if (reg_list[i]->exist == false)
|
||||
if (reg_list[i]->exist == false || reg_list[i]->hidden)
|
||||
continue;
|
||||
|
||||
if (reg_list[i]->feature != NULL
|
||||
@@ -2270,7 +2270,7 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
|
||||
int i;
|
||||
for (i = 0; i < reg_list_size; i++) {
|
||||
|
||||
if (reg_list[i]->exist == false)
|
||||
if (reg_list[i]->exist == false || reg_list[i]->hidden)
|
||||
continue;
|
||||
|
||||
if (strcmp(reg_list[i]->feature->name, features[current_feature]))
|
||||
|
||||
Reference in New Issue
Block a user