1
0
Fork 0
forked from nuttx/nuttx-update

nuttxgdb: fix memdump busyloop when nodesize is 0

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-11-25 12:13:40 +08:00 committed by Xiang Xiao
parent 659e3f87a0
commit 1f2435641d
2 changed files with 5 additions and 1 deletions

View file

@ -81,6 +81,7 @@ void mm_foreach(FAR struct mm_heap_s *heap, mm_node_handler_t handler,
node = (FAR struct mm_allocnode_s *)((FAR char *)node + nodesize))
{
nodesize = MM_SIZEOF_NODE(node);
DEBUGASSERT(nodesize >= MM_SIZEOF_ALLOCNODE);
minfo("region=%d node=%p size=%zu preceding=%u (%c %c)\n",
region, node, nodesize, (unsigned int)node->preceding,
MM_PREVNODE_IS_FREE(node) ? 'F' : 'A',

View file

@ -466,6 +466,9 @@ class MMNode(gdb.Value, p.MMFreeNode):
@property
def nextnode(self) -> MMNode:
if not self.nodesize:
return None
addr = int(self.address) + self.nodesize
type = utils.lookup_type("struct mm_freenode_s").pointer()
# Use gdb.Value for better performance
@ -551,7 +554,7 @@ class MMHeap(Value, p.MMHeap):
def nodes(self) -> Generator[MMNode, None, None]:
for start, end in self.regions:
node = start
while node.address <= end.address:
while node and node.address <= end.address:
yield node
node = node.nextnode