Go forward to Function Types.
Go backward to Typedefs.
Go up to Types.
Unions
======
union u_tag {
int u_int;
float u_float;
char* u_char;
} an_u;
This code generates a stab for a union tag and a stab for a union
variable. Both use the `N_LSYM' stab type. If a union variable is
scoped locally to the procedure in which it is defined, its stab is
located immediately preceding the `N_LBRAC' for the procedure's block
start.
The stab for the union tag, however, is located preceding the code
for the procedure in which it is defined. The stab type is `N_LSYM'.
This would seem to imply that the union type is file scope, like the
struct type `s_tag'. This is not true. The contents and position of
the stab for `u_type' do not convey any infomation about its procedure
local scope.
# 128 is N_LSYM
.stabs "u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;",
128,0,0,0
The symbol descriptor `T', following the `name:' means that the stab
describes an enumeration, structure, or union tag. The type descriptor
`u', following the `23=' of the type definition, narrows it down to a
union type definition. Following the `u' is the number of bytes in the
union. After that is a list of union element descriptions. Their
format is NAME:TYPE, BIT OFFSET INTO THE UNION, NUMBER OF BYTES FOR THE
ELEMENT;.
The stab for the union variable is:
.stabs "an_u:23",128,0,0,-20 # 128 is N_LSYM
`-20' specifies where the variable is stored (*note Stack
Variables::.).