Skip to content

Commit 7b42e36

Browse files
Damian-Nordiccarlescufi
authored andcommitted
net: openthread: Print the actual assert location
When OpenThread application is built with CONFIG_ASSERT and CONFIG_ASSERT_NO_MSG_INFO, OT_ASSERT() prints a location that points to the otPlatAssertFail() function instead of the code that actually failed an assertion. This is confusing and CONFIG_ASSERT_NO_MSG_INFO sometimes cannot be disabled because of flash size limitations. Make otPlatAssertFail() always print the actual assert location. Signed-off-by: Damian Krolik <[email protected]>
1 parent 5bafa25 commit 7b42e36

File tree

1 file changed

+6
-1
lines changed
  • modules/openthread/platform

1 file changed

+6
-1
lines changed

modules/openthread/platform/misc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,10 @@ void otPlatWakeHost(void)
9999

100100
void otPlatAssertFail(const char *aFilename, int aLineNumber)
101101
{
102-
__ASSERT(false, "OpenThread ASSERT @ %s:%d", aFilename, aLineNumber);
102+
/*
103+
* The code below is used instead of __ASSERT(false) to print the actual assert
104+
* location instead of __FILE__:__LINE__, which would point to this function.
105+
*/
106+
__ASSERT_PRINT("OpenThread ASSERT @ %s:%d\n", aFilename, aLineNumber);
107+
__ASSERT_POST_ACTION();
103108
}

0 commit comments

Comments
 (0)