forked from Imagelibrary/binutils-gdb
Update comment for struct type's length field, introduce type_length_units
This patch tries to clean up a bit the blur around the length field in struct type, regarding its use with architectures with non-8-bits addressable memory. It clarifies that the field is expressed in host bytes, which is what is the closest to the current reality. It also introduces a new function to get the length of the type in target addressable memory units. gdb/ChangeLog: * gdbtypes.c (type_length_units): New function. * gdbtypes.h (type_length_units): New declaration. (struct type) <length>: Update comment.
This commit is contained in:
@@ -252,6 +252,17 @@ get_target_type (struct type *type)
|
||||
return type;
|
||||
}
|
||||
|
||||
/* See gdbtypes.h. */
|
||||
|
||||
unsigned int
|
||||
type_length_units (struct type *type)
|
||||
{
|
||||
struct gdbarch *arch = get_type_arch (type);
|
||||
int unit_size = gdbarch_addressable_memory_unit_size (arch);
|
||||
|
||||
return TYPE_LENGTH (type) / unit_size;
|
||||
}
|
||||
|
||||
/* Alloc a new type instance structure, fill it with some defaults,
|
||||
and point it at OLDTYPE. Allocate the new type instance from the
|
||||
same place as OLDTYPE. */
|
||||
|
||||
Reference in New Issue
Block a user