Jim Nissen
2009-Apr-22 15:15 UTC
[dtrace-discuss] Structure bit-field causing Dtrace to throw alignment errors
I''ve got a real simple dtrace script, which I''m having some
issues
with. The script...
#pragma D option quiet
fbt::ssfcp_transport:entry
{
this->pkt=(fc_packet_t *) arg1;
this->frame=this->pkt->pkt_cmd_fhdr;
printf("%x \n",this->pkt->pkt_cmd_fhdr.d_id);
}
When it is run, I get the following errors...
dtrace: error on enabled probe ID 1 (ID 37303:
fbt:fcp:ssfcp_transport:entry): invalid alignment (0x6001245a791) in
action #3 at DIF offset 20
The d_id field is a bit-field, from this structure...
typedef struct frame_header {
#if defined(_BIT_FIELDS_LTOH)
uint32_t d_id : 24,
r_ctl : 8;
uint32_t s_id : 24,
rsvd : 8;
uint32_t f_ctl : 24,
type : 8;
uint32_t seq_cnt : 16,
df_ctl : 8,
seq_id : 8;
uint32_t rx_id : 16,
ox_id : 16;
uint32_t ro;
#else
uint32_t r_ctl : 8,
d_id : 24;
uint32_t rsvd : 8,
s_id : 24;
uint32_t type : 8,
f_ctl : 24;
uint32_t seq_id : 8,
df_ctl : 8,
seq_cnt : 16;
uint32_t ox_id : 16,
rx_id : 16;
uint32_t ro;
#endif /* _BIT_FIELDS_LTOH */
} fc_frame_hdr_t;
Is there any way to cast these bit-fields, to avoid the errors?
Thanks,
Jim