Update README. Improve some debug output.

This commit is contained in:
Gregory Nutt 2016-04-23 14:27:32 -06:00
parent d4ac277df8
commit 422769e859
2 changed files with 53 additions and 19 deletions

View File

@ -2498,9 +2498,13 @@ Configuration sub-directories
2106-04-23: Configuration created. See status up to this data in 2106-04-23: Configuration created. See status up to this data in
the vnc configuration. That probably all applies here as well. the vnc configuration. That probably all applies here as well.
Only some initial testing has been performed: The configuration Only some initial testing has been performed: The configuration
does not work. The NuttX VNC server is crashing because of this is partially functional. Menus do appear and mouse input is
assertion: probably working correctly.
But there are a lot of instabilities. I see assertions of
various kinds and the RealVNC client often crashes as well.
Some of the assertions I see are:
while (sem_wait(&session->queuesem) < 0) while (sem_wait(&session->queuesem) < 0)
... ...
@ -2510,4 +2514,5 @@ Configuration sub-directories
I would think that could mean only that the semaphore counting is I would think that could mean only that the semaphore counting is
out of sync with the number of updates in the queue. out of sync with the number of updates in the queue.
But also the assertion at devif/devif_iobsend.c line: 102 which
probably means some kind of memory corruption.

View File

@ -64,7 +64,8 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#undef VNCSERVER_SEM_DEBUG #undef VNCSERVER_SEM_DEBUG /* Define to dump queue/semaphore state */
#undef VNCSERVER_SEM_DEBUG_SILENT /* Define to dump only suspicious conditions */
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -112,8 +113,14 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session,
FAR const char *msg, unsigned int unattached) FAR const char *msg, unsigned int unattached)
{ {
FAR struct vnc_fbupdate_s *update; FAR struct vnc_fbupdate_s *update;
unsigned int nqueued; int nqueued;
unsigned int nfree; int nfree;
int freesem;
int queuesem;
int freecount;
int queuecount;
int freewaiting;
int queuewaiting;
while (sem_wait(&g_dbgsem) < 0) while (sem_wait(&g_dbgsem) < 0)
{ {
@ -122,19 +129,40 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session,
/* Count structures in the list */ /* Count structures in the list */
for (nqueued = 0, update = (FAR struct vnc_fbupdate_s *)session->updqueue.head; nqueued = sq_count(&session->updqueue);
update != NULL; nfree = sq_count(&session->updfree);
nqueued++, update = update->flink);
for (nfree = 0, update = (FAR struct vnc_fbupdate_s *)session->updfree.head; freesem = session->freesem.semcount;
update != NULL; queuesem = session->queuesem.semcount;
nfree++, update = update->flink);
syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg); freecount = freesem > 0 ? freesem : 0;
syslog(LOG_INFO, " freesem: %d\n", session->freesem.semcount); queuecount = queuesem > 0 ? queuesem : 0;
syslog(LOG_INFO, " queued: %u\n", nqueued);
syslog(LOG_INFO, " free: %u\n", nfree); freewaiting = freesem < 0 ? -freesem : 0;
syslog(LOG_INFO, " unattached: %u\n", unattached); queuewaiting = queuesem < 0 ? -queuesem : 0;
#ifdef VNCSERVER_SEM_DEBUG_SILENT
/* This dumps most false alarms in the case where:
*
* - Updater was waiting on a semaphore (count is -1)
* - New update added to the queue (queue count is 1)
* - queuesem posted. Wakes up Updater and the count is 0.
*/
if ((nqueued + nfree) != (freecount + queuecount))
#endif
{
syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg);
syslog(LOG_INFO, " Free list:\n");
syslog(LOG_INFO, " semcount: %d\n", freecount);
syslog(LOG_INFO, " queued nodes: %u\n", nfree);
syslog(LOG_INFO, " waiting: %u\n", freewaiting);
syslog(LOG_INFO, " Qeued Updates:\n");
syslog(LOG_INFO, " semcount: %d\n", queuecount);
syslog(LOG_INFO, " queued nodes: %u\n", nqueued);
syslog(LOG_INFO, " waiting: %u\n", queuewaiting);
syslog(LOG_INFO, " Unqueued: %u\n", unattached);
}
sem_post(&g_dbgsem); sem_post(&g_dbgsem);
} }
@ -262,6 +290,8 @@ vnc_remove_queue(FAR struct vnc_session_s *session)
/* It is reserved.. go get it */ /* It is reserved.. go get it */
rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue); rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue);
vnc_sem_debug(session, "After remove", 0);
DEBUGASSERT(rect != NULL); DEBUGASSERT(rect != NULL);
/* Check if we just removed the whole screen update from the queue */ /* Check if we just removed the whole screen update from the queue */
@ -272,7 +302,6 @@ vnc_remove_queue(FAR struct vnc_session_s *session)
updvdbg("Whole screen update: nwhupd=%d\n", session->nwhupd); updvdbg("Whole screen update: nwhupd=%d\n", session->nwhupd);
} }
vnc_sem_debug(session, "After remove", 0);
sched_unlock(); sched_unlock();
return rect; return rect;
} }