-
Notifications
You must be signed in to change notification settings - Fork 594
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?
Conversation
os/mm/mm_heap/mm_node.h
Outdated
do { \ | ||
DEBUGASSERT(node); \ | ||
if (!((node)->blink)) { \ | ||
abort_mode = true; \ |
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.
DEBUGPANIC() is a macro for up_assert
function and up_assert sets abort_mode
to true internally. Is it necessary?
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.
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
#define mfdbg(format, ...) \
do { \
if (!IS_SECURE_STATE()) { \
if (abort_mode || up_interrupt_context()) { \
lldbg(format, ##__VA_ARGS__); \
} else { \
dbg(format, ##__VA_ARGS__); \
} \
} \
} while (0)
#else
#define mfdbg(format, ...) dbg(format, ##__VA_ARGS__)
#endif
Line 504 in 4cced9a
#define mfdbg(format, ...) \ |
mfdbg operation has dependency with abort_mode.
if after print mfdbg( using dbg), up_assert is called, dbg can't finsh printing.
becase uart driver and lib stdout buffer is stop and print only using lldbg.
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 comment
The 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.. .
So, I'm checking to add lib stdout flush at up_assert.c
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.
I raised flushing log uart PR #6660
|
||
/**************************************************************************** | ||
* Pre-processor Definitions | ||
****************************************************************************/ | ||
|
||
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) | ||
#define DEBUGASSERT_MM_FREE_NODE(heap, node) \ |
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.
add mm_dump_heap_free_node_list function. This function prints the hex valuse contents of heap free nodes using heap free node list. example logs: ` ######################################################################################### Dump heap free node list [ndx], [HEAD]: [FREE NODES(SIZE)] ` ######################################################################################### 0, 1003dc80: 1, 1003dc98: 2, 1003dcb0: 3, 1003dcc8: 0200f220(240) 4, 1003dce0: 5, 1003dcf8: 02012dc0(592) 02016b70(576) 6, 1003dd10: 0201eb70(1488) 7, 1003dd28: 8, 1003dd40: 9, 1003dd58: 10, 1003dd70: 11, 1003dd88: 12, 1003dda0: 13, 1003ddb8: 14, 1003ddd0: 15, 1003dde8: 16, 1003de00: 02201a10(1828320) 17, 1003de18: 18, 1003de30: ` ######################################################################################### Signed-off-by: eunwoo.nam <[email protected]>
add the dump_node function, which was static, to the header for use in other codes and move it to mm_heap_dbg.c. Signed-off-by: eunwoo.nam <[email protected]>
6d39ad7
to
482b169
Compare
The back link of heap free node cannot be null at any time, If null, it is an assert situation. Therefore, in the REMOVE_NODE_FROM_LIST macro, null is checked with DEBUGASSERT. But we can't known why the back link of the free node became null. Therefore, This commit adds DEBUGASSERT_MM_FREE_NODE macro, that print addresses of free nodes, head list of free node link and corrupted node nearby node for debugging. Signed-off-by: eunwoo.nam <[email protected]>
482b169
to
ea6f456
Compare
5ebb969
to
077f88b
Compare
commit 1
commit 2
commit 3