このコードでは:
...
size_t bytes_over=0; //Number of bytes overthe region.
size_t byte_size=0; //Number of bytes overthe region.
if(isin_allocatedblock(mem, key_address,&bytes_over,&byte_size))
{
//** Seg Fault here
asprintf(err_msg_2nd,"%s:%d: %p is %Zu bytes inside a %Zu byte region allocated here\n",file, line, key_address, bytes_over,byte_size);
}
...
}
bool isin_allocatedblock(struct memory *mem, char *key_address, size_t *bytes_over, size_t *byte_size) {
...
*bytes_over = (previous_alloc_ptr+prev_alloc_sz) - key_address; //Right side is 1901
*byte_size = get_metadata_recordsize(meta_rec);
return true;
}
新しい値が割り当てられているgdbの右側にbytes_overを出力すると、取得します
$17 = <unknown type>
byte_size を印刷すると、次のようになります。
Function return type unknown.
asprint コマンドでセグ フォールトが発生するので、これら 2 つの変数の値を確認しようとしています。gdb で「苦情 5 を設定」し、gdb で実行した後にこれが表示されます (行番号は、bytes_over に値が割り当てられている行です):
During symbol reading, incomplete CFI data; unspecified registers (e.g., esi) at 0x8049acc.
isin_allocatedblock (mem=0x804cec8, key_address=0x804de64 "", bytes_over=
0xbffff078, byte_size=0xbffff074) at memory.c:471