I'm cross compiling from a linux host, building an application to run on my EM335x EVM. I'm unable to use the debugger to set breakpoints or pause inside a pthread. When I set a breakpoint it works the first time but the second time it would hit the breakpoint the app is out to lunch. If I let the thread run and try to Suspend the application it doesn't stop and I can no long control anything.
Any pthread based application I try to make exhibits this problem. I confirmed that running the a work loop that fails in a thread from main works as expected.
I have confirmed that all my host side tools are up to date and I built and debugged my app in a new project, in a new workspace and still have the same issues.
Any thoughts on why I can't stop in a thread?
Host: Ubuntu 12.04 in VMware Player (on windows 7)
Target: ti-sdk-am335x-evm-07.00.00.00 (Arago 2013.12 am335x-evm) netbooting from the above VM.
Tools: Code Composer Studio: Version: 6.1.0.00104
Minimal project that has this problem is attached and source is pasted in:
/*
* debugFails.c
*
* This application is not pausable in the the thread.
*
* Created on: May 5, 2015
* Author: user
*/
#include <sys/eventfd.h>
#include <pthread.h>
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <stdint.h>
// The call to nanosleep doesn't cause or prevent the problem, it's here simply
// to keep the message from flooding the console.
void delay(uint16_t msDelay) {
struct timespec request;
request.tv_sec = msDelay / 1000;
request.tv_nsec = (msDelay % 1000) * 1000000L;
while (( nanosleep( &request, &request ) == -1 ) && ( errno == EINTR )) {
continue;
}
}
void *PrintHello(void *threadid)
{
for (;;) {
printf("Hi guys.\n");
// setting a breakpoint on this line will stop the first time but will
// be a problem the second time it tries to stop.
delay(1000);
}
return 0;
}
// #define DONT_FAIL
int main (int argc, char *argv[])
{
#if defined DONT_FAIL
printf("Not a problem.\n");
for (;;) {
printf("Hi guys.\n");
delay(1000);
}
#endif
printf("Going to have a problem.\n");
pthread_t thread;
int rc;
printf("In main: creating thread\n");
rc = pthread_create(&thread, 0, PrintHello, 0);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
}
pthread_exit(0);
}