You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/20 08:43:45 UTC

[GitHub] [incubator-nuttx] yamt opened a new pull request, #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

yamt opened a new pull request, #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305

   ## Summary
   Separate a few debug stuff from CONFIG_DEBUG_MM.
   
   * backtrace
   * dump and abort on failure
   
   ## Impact
   
   ## Testing
   compile tested a few combinations
   tested on esp32 with these new options disabled


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878152820


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   where are the separate commit?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878306656


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   but DEBUGASSERT get removed? it's very useful to generate the backtrace when debugging.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878119279


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   ```suggestion
         DEBUGPANIC();
   #endif
   ```
   Was the removal of the `DEBUGASSERT(false);` intended?
   I believe leaving it here may be valuable during debugging.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878320285


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   Yes. There is an explanation in commit message. Maybe debug assert should be optional, I do not know.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] yamt commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
yamt commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878593694


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   ok. i added it back as a separate option.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878306656


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   but DEBUGASSERT get removed? 



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] yamt commented on pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
yamt commented on PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#issuecomment-1132820103

   i pushed a lot of unrelated stuff to the branch mistakenly and then restored.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878120386


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   Ok, just noticed the separate commit just for this change. It makes sense.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878332420


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   DEBUGPANIC/DEBUGASSERT could generate the callstack which is very useful to know the abnormal location, so it's better to keep the as before. If user want to see heap info, he should also want to see the callback info too.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878180283


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   Here: https://github.com/apache/incubator-nuttx/pull/6305/commits/29c0a641e43d552f97aad88329cadc9371fb693d, in this same PR.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6305: Separate a few debug stuff from CONFIG_DEBUG_MM

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6305:
URL: https://github.com/apache/incubator-nuttx/pull/6305#discussion_r878180283


##########
mm/mm_heap/mm_malloc.c:
##########
@@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 #ifdef CONFIG_DEBUG_MM
   else
     {
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       struct mallinfo minfo;
+#endif
 
       mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
+#ifdef CONFIG_MM_DUMP_ON_FAILURE
       mm_mallinfo(heap, &minfo);
       mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n",
             minfo.arena, minfo.uordblks, minfo.fordblks,
             minfo.mxordblk, minfo.aordblks, minfo.ordblks);
       mm_memdump(heap, -1);
-      DEBUGASSERT(false);
+#endif

Review Comment:
   Here: https://github.com/apache/incubator-nuttx/pull/6305/commits/29c0a641e43d552f97aad88329cadc9371fb693d



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org