xiaoxiang781216 commented on code in PR #9564:
URL: https://github.com/apache/nuttx/pull/9564#discussion_r1233481003
##########
mm/mempool/mempool.c:
##########
@@ -460,55 +462,55 @@ mempool_info_task(FAR struct mempool_s *pool,
void mempool_memdump(FAR struct mempool_s *pool,
FAR const struct mm_memdump_s *dump)
{
+ size_t blocksize = MEMPOOL_REALBLOCKSIZE(pool);
+
if (dump->pid == PID_MM_FREE)
{
FAR sq_entry_t *entry;
sq_for_every(&pool->queue, entry)
{
syslog(LOG_INFO, "%12zu%*p\n",
- pool->blocksize, MM_PTR_FMT_WIDTH,
- (FAR char *)entry);
+ blocksize, MM_PTR_FMT_WIDTH, (FAR char *)entry);
}
sq_for_every(&pool->iqueue, entry)
{
syslog(LOG_INFO, "%12zu%*p\n",
- pool->blocksize, MM_PTR_FMT_WIDTH,
- (FAR char *)entry);
+ blocksize, MM_PTR_FMT_WIDTH, (FAR char *)entry);
}
}
#if CONFIG_MM_BACKTRACE >= 0
else
{
FAR struct mempool_backtrace_s *buf;
- list_for_every_entry(&pool->alist, buf, struct mempool_backtrace_s,
- node)
+ list_for_every_entry(&pool->alist, buf,
+ struct mempool_backtrace_s, node)
{
if ((dump->pid == PID_MM_ALLOC || dump->pid == buf->pid) &&
buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
{
+ char tmp[CONFIG_MM_BACKTRACE * MM_PTR_FMT_WIDTH + 1] =
+ {
+ '\0'
+ };
+
# if CONFIG_MM_BACKTRACE > 0
- int i;
FAR const char *format = " %0*p";
-# endif
- char bt[CONFIG_MM_BACKTRACE * MM_PTR_FMT_WIDTH + 1];
+ int i;
- bt[0] = '\0';
-# if CONFIG_MM_BACKTRACE > 0
for (i = 0; i < CONFIG_MM_BACKTRACE && buf->backtrace[i]; i++)
{
- snprintf(bt + i * MM_PTR_FMT_WIDTH,
- sizeof(bt) - i * MM_PTR_FMT_WIDTH,
+ snprintf(tmp + i * MM_PTR_FMT_WIDTH,
+ sizeof(tmp) - i * MM_PTR_FMT_WIDTH,
format, MM_PTR_FMT_WIDTH - 1, buf->backtrace[i]);
}
# endif
syslog(LOG_INFO, "%6d%12zu%12lu%*p%s\n",
- (int)buf->pid, pool->blocksize, buf->seqno,
- MM_PTR_FMT_WIDTH,
- ((FAR char *)buf - pool->blocksize), bt);
+ (int)buf->pid, blocksize, buf->seqno,
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]