How to debug multi-threading problems

OP (Company: Mehraris) #5527307
Rate this post
useful
not useful
Hi everyone.

we had performed a project with discovery f746 board that within it 
there just was a GUI task to run emwin functions.

Another functions(such as reading and writing in sd card by fatfs , usb, 
spi and stuff) were placed in the routines of Buttons.

After several times the process of USB (writing in USB flash memory) was 
ran ,

the running process stuck in RTOS's functions.

After that we decided to add another thread for USB In such a way that, 
after pressing related button ,a message is sent to this thread.

At the first it works fine but after several times running this thread, 
mkdir function (for creating a folder in USB flash memory) returns 
FR_NOT_ENOUGH_CORE value and the program stops running.

For resolving this problem we increased stack and heap size and memory 
that is assigned to the thread but it didn't affect.

In new version of our project we just added a new thread and the routine 
that was placed in Notification sent by related button was moved into 
new thread and another sections of projects haven't changed.

In old version of project that there just was one thread , mkdir 
function never had returned FR_NOT_ENOUGH_CORE value.

It seems this problem is related to multi threading but we don't know 
how to find out running process and fix problem.

Could anyone help us to resolve this problem?

We'll appreciate your suggestions.
Guest #5527381
Rate this post
useful
not useful
Hi,

can you monitor the memory consumption of the threads? For me this 
sounds like a memory leak. (I.e. the thread allocates new memory every 
time it runs without freeing it afterwards.)

Best regards,
 Martin L.
(Company: CETPA) #5600779
Rate this post
useful
not useful
Above links broken, So, you can use Debugging Programs with Multiple 
Threads. When dealing with debugging multi-threaded application, it is 
better not to use standard breakpoints that suspend just the thread 
where the breakpoint is set. Defining a standard breakpoint in your 
application, will only break the related thread. The other threads will 
be still running. For more visit at this link
https://stackoverflow.com/questions/1695268/multi-threaded-debugging-tutorial-for-gdb-and-c

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now