Debug instrumentation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@47 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
e0f2dd1408
commit
fd34c0c113
@ -45,6 +45,10 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_DUMP_ON_EXIT
|
||||||
|
#include <nuttx/fs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Private Definitions
|
* Private Definitions
|
||||||
************************************************************/
|
************************************************************/
|
||||||
@ -57,6 +61,57 @@
|
|||||||
* Private Funtions
|
* Private Funtions
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
* Name: _up_dumponexit
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Dump the state of all tasks whenever on task exits. This
|
||||||
|
* is debug instrumentation that was added to check file-
|
||||||
|
* related reference counting but could be useful again
|
||||||
|
* sometime in the future.
|
||||||
|
*
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_DUMP_ON_EXIT) && defined(CONFIG_DEBUG)
|
||||||
|
static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
dbg(" TCB=%p name=%s\n", tcb, tcb->name);
|
||||||
|
if (tcb->filelist)
|
||||||
|
{
|
||||||
|
dbg(" filelist refcount=%d\n",
|
||||||
|
tcb->filelist->fl_crefs);
|
||||||
|
|
||||||
|
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
|
||||||
|
{
|
||||||
|
struct inode *inode = tcb->filelist->fl_files[i].f_inode;
|
||||||
|
if (inode)
|
||||||
|
{
|
||||||
|
dbg(" fd=%d refcount=%d\n",
|
||||||
|
i, inode->i_crefs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tcb->streams)
|
||||||
|
{
|
||||||
|
dbg(" streamlist refcount=%d\n",
|
||||||
|
tcb->streams->sl_crefs);
|
||||||
|
|
||||||
|
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
|
||||||
|
{
|
||||||
|
struct file_struct *filep = &tcb->streams->sl_streams[i];
|
||||||
|
if (filep->fs_filedes >= 0)
|
||||||
|
{
|
||||||
|
dbg(" fd=%d nbytes=%d\n",
|
||||||
|
filep->fs_filedes,
|
||||||
|
filep->fs_bufpos - filep->fs_bufstart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Public Funtions
|
* Public Funtions
|
||||||
************************************************************/
|
************************************************************/
|
||||||
@ -76,6 +131,11 @@ void _exit(int status)
|
|||||||
|
|
||||||
dbg("TCB=%p exitting\n", tcb);
|
dbg("TCB=%p exitting\n", tcb);
|
||||||
|
|
||||||
|
#if defined(CONFIG_DUMP_ON_EXIT) && defined(CONFIG_DEBUG)
|
||||||
|
dbg("Other tasks:\n");
|
||||||
|
sched_foreach(_up_dumponexit, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Remove the tcb task from the ready-to-run list. We can
|
/* Remove the tcb task from the ready-to-run list. We can
|
||||||
* ignore the return value because we know that a context
|
* ignore the return value because we know that a context
|
||||||
* switch is needed.
|
* switch is needed.
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
|
#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
|
||||||
#define CONFIG_SUPPRESS_SERIAL_INTS 1 /* Console will poll */
|
#define CONFIG_SUPPRESS_SERIAL_INTS 1 /* Console will poll */
|
||||||
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
||||||
|
#undef CONFIG_DUMP_ON_EXIT /* Dumpt task state on exit */
|
||||||
|
|
||||||
/* LED definitions */
|
/* LED definitions */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user