+2020-12-11 Tom Tromey <tromey@adacore.com>
+
+ * ada-tasks.c (struct ada_tasks_pspace_data) <cpu_id_offset>: New
+ field.
+ (ada_get_tcb_types_info): Look for __gnat_gdb_cpu_first_id.
+ (read_atcb): Use cpu_id_offset.
+
2020-12-10 Kevin Buettner <kevinb@redhat.com>
* ada-lang.c (ada_fold_name): Fix off-by-one error.
/* The index of various fields in the ATCB record and sub-records. */
struct atcb_fieldnos atcb_fieldno {};
+
+ /* On some systems, gdbserver applies an offset to the CPU that is
+ reported. */
+ unsigned int cpu_id_offset = 0;
};
/* Key to our per-program-space data. */
if (fieldnos.ll_lwp < 0)
fieldnos.ll_lwp = ada_get_field_index (ll_type, "thread_id", 1);
+ /* Check for the CPU offset. */
+ bound_minimal_symbol first_id_sym
+ = lookup_bound_minimal_symbol ("__gnat_gdb_cpu_first_id");
+ unsigned int first_id = 0;
+ if (first_id_sym.minsym != nullptr)
+ {
+ CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (first_id_sym);
+ /* This symbol always has type uint32_t. */
+ struct type *u32type = builtin_type (target_gdbarch ())->builtin_uint32;
+ first_id = value_as_long (value_at (u32type, addr));
+ }
+
/* Set all the out parameters all at once, now that we are certain
that there are no potential error() anymore. */
pspace_data = get_ada_tasks_pspace_data (current_program_space);
pspace_data->atcb_ll_type = ll_type;
pspace_data->atcb_call_type = call_type;
pspace_data->atcb_fieldno = fieldnos;
+ pspace_data->cpu_id_offset = first_id;
return NULL;
}
}
task_info->base_cpu
- = value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.base_cpu));
+ = (pspace_data->cpu_id_offset
+ + value_as_long (value_field (common_value,
+ pspace_data->atcb_fieldno.base_cpu)));
/* And finally, compute the task ptid. Note that there is not point
in computing it if the task is no longer alive, in which case