在此代码中:
...
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命令上遇到了一个seg错误,所以我试图查看这两个变量的值。我在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