-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add DEBUGASSERT_MM_FREE_NODE macro #5968
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -24,14 +24,48 @@ | |||
****************************************************************************/ | ||||
|
||||
#include <assert.h> | ||||
#include <debug.h> | ||||
|
||||
#include <tinyara/mm/mm.h> | ||||
|
||||
/**************************************************************************** | ||||
* Pre-processor Definitions | ||||
****************************************************************************/ | ||||
|
||||
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) | ||||
#define DEBUGASSERT_MM_FREE_NODE(heap, node) \ | ||||
do { \ | ||||
DEBUGASSERT(node); \ | ||||
if (!((node)->blink)) { \ | ||||
abort_mode = true; \ | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DEBUGPANIC() is a macro for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 504 in 4cced9a
mfdbg operation has dependency with abort_mode. if after print mfdbg( using dbg), up_assert is called, dbg can't finsh printing. So, To complete print just before up_assert, abort mode setting is needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact.., This issue is not solved by setting abort_mode early about loadable user heap.. . |
||||
mfdbg("Corrupted free node %08x\n", node); \ | ||||
mm_dump_heap_free_node_list(heap); \ | ||||
mm_dump_node((struct mm_allocnode_s *)node, "CORRUPT NODE"); \ | ||||
mm_dump_node((struct mm_allocnode_s *)((char *)node - (node->preceding & ~MM_ALLOC_BIT)), "PREV NODE"); \ | ||||
mm_dump_node((struct mm_allocnode_s *)((char *)node + node->size), "NEXT NODE"); \ | ||||
DEBUGPANIC(); \ | ||||
} \ | ||||
} while (0) | ||||
|
||||
#else | ||||
#define DEBUGASSERT_MM_FREE_NODE(heap, node) \ | ||||
do { \ | ||||
DEBUGASSERT(node); \ | ||||
if (!((node)->blink)) { \ | ||||
mfdbg("Corrupted free node %08x\n", node); \ | ||||
mm_dump_heap_free_node_list(heap); \ | ||||
mm_dump_node((struct mm_allocnode_s *)node, "CORRUPT NODE"); \ | ||||
mm_dump_node((struct mm_allocnode_s *)((char *)node - (node->preceding & ~MM_ALLOC_BIT)), "PREV NODE"); \ | ||||
mm_dump_node((struct mm_allocnode_s *)((char *)node + node->size), "NEXT NODE"); \ | ||||
DEBUGPANIC(); \ | ||||
} \ | ||||
} while (0) | ||||
|
||||
#endif | ||||
|
||||
|
||||
#define REMOVE_NODE_FROM_LIST(node) \ | ||||
do { \ | ||||
DEBUGASSERT((node)->blink); \ | ||||
(node)->blink->flink = (node)->flink; \ | ||||
if ((node)->flink) { \ | ||||
(node)->flink->blink = (node)->blink; \ | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any reasons to separate DEBUGASSERT_MM_NODE according to build type? I think both are same except setting of
abort_mode
. If it is not necessary as I said in below comment, we don't need to separate them.