coredump: refine coredump info analyse
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
parent
f7adb52c8b
commit
c58bd521a3
1 changed files with 15 additions and 4 deletions
|
@ -110,6 +110,7 @@ static void coredump_dump_blkdev(pid_t pid)
|
|||
{
|
||||
FAR void *stream = &g_blockstream;
|
||||
FAR struct coredump_info_s *info;
|
||||
blkcnt_t nsectors;
|
||||
int ret;
|
||||
|
||||
if (g_blockstream.inode == NULL)
|
||||
|
@ -118,8 +119,12 @@ static void coredump_dump_blkdev(pid_t pid)
|
|||
return;
|
||||
}
|
||||
|
||||
nsectors = (sizeof(struct coredump_info_s) +
|
||||
g_blockstream.geo.geo_sectorsize - 1) /
|
||||
g_blockstream.geo.geo_sectorsize;
|
||||
|
||||
ret = g_blockstream.inode->u.i_bops->read(g_blockstream.inode,
|
||||
g_blockinfo, g_blockstream.geo.geo_nsectors - 1, 1);
|
||||
g_blockinfo, g_blockstream.geo.geo_nsectors - nsectors, nsectors);
|
||||
if (ret < 0)
|
||||
{
|
||||
_alert("Coredump information read fail\n");
|
||||
|
@ -149,10 +154,10 @@ static void coredump_dump_blkdev(pid_t pid)
|
|||
|
||||
info->magic = COREDUMP_MAGIC;
|
||||
info->size = g_blockstream.common.nput;
|
||||
info->time = time(NULL);
|
||||
info->time = time(NULL);
|
||||
uname(&info->name);
|
||||
ret = g_blockstream.inode->u.i_bops->write(g_blockstream.inode,
|
||||
(FAR void *)info, g_blockstream.geo.geo_nsectors - 1, 1);
|
||||
(FAR void *)info, g_blockstream.geo.geo_nsectors - nsectors, nsectors);
|
||||
if (ret < 0)
|
||||
{
|
||||
_alert("Coredump information write fail\n");
|
||||
|
@ -191,6 +196,7 @@ int coredump_set_memory_region(FAR struct memory_region_s *region)
|
|||
|
||||
int coredump_initialize(void)
|
||||
{
|
||||
blkcnt_t nsectors;
|
||||
int ret = 0;
|
||||
|
||||
if (CONFIG_BOARD_MEMORY_RANGE[0] != '\0')
|
||||
|
@ -216,7 +222,11 @@ int coredump_initialize(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
g_blockinfo = kmm_malloc(g_blockstream.geo.geo_sectorsize);
|
||||
nsectors = (sizeof(struct coredump_info_s) +
|
||||
g_blockstream.geo.geo_sectorsize - 1) /
|
||||
g_blockstream.geo.geo_sectorsize;
|
||||
|
||||
g_blockinfo = kmm_malloc(g_blockstream.geo.geo_sectorsize * nsectors);
|
||||
if (g_blockinfo == NULL)
|
||||
{
|
||||
_alert("Coredump device memory alloc fail\n");
|
||||
|
@ -227,6 +237,7 @@ int coredump_initialize(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
UNUSED(nsectors);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue