Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Error in remote debugging multi-thread program
Error in remote debugging multi-thread program [message #201948] Thu, 20 September 2007 05:29 Go to next message
Eclipse UserFriend
Originally posted by: samsheng.trident.com.cn

Hello,

I got an error message during remote debugging a multi-thread process using
cdt.
It says:
An internal error occurred during: "child count update".
-1

The detail scenario is:
Eclipse version: 3.3RC1 for Linux
CDT version: 4.0.0 M7
GDB version: 6.5 (cross platfrom client + server)

The process on target has two threads.

I set break points in both thread functions.

After process running, the first thread got caught, and I do operation
"Step Over".
If the focus stays in first thread, everything is OK;
If the the first thread lost focus, Eclipse will show error message box with
message:
An internal error occurred during: "child count update".
-1

Any help is appreciated.

Following is the source files:
makefile
############################################################ ###
all:threads install

threads: thread-func.c multi-thread.c
mips_lexra_fp_be-gcc -g -Wall $^ -o $@ -lpthread

install:
cp threads /opt/rootfs/debug/

clean:
rm -f threads
############################################################ ###

multi-thread.c
/*********************************************************** **/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>

#include "multi-thread.h"

extern void * thread_func0(void *arg);
extern void * thread_func1(void *arg);

int
main(int argc, char **argv)
{
int retVal = 0, index = 0;
int numThreads;
pthread_t thid[100];

numThreads = 2;

/*create all the threads*/
index = 0;
printf("Creating thread num %d\n", index);
retVal = pthread_create(&thid[index], NULL, thread_func0, (void *)&index);
if (retVal < 0) {
printf("Error in creating thread id %ld\n", thid[index]);
}
sleep(1);
index++;
printf("Creating thread num %d\n", index);
retVal = pthread_create(&thid[index], NULL, thread_func1, (void *)&index);
if (retVal < 0) {
printf("Error in creating thread id %ld\n", thid[index]);
}
sleep(1);

for (index = 0; index < numThreads; index++) {
pthread_join(thid[index],NULL);
}
while(1)
sleep(1);
}
/*********************************************************** **/

multi-thread.h
/*********************************************************** **/
#ifndef MULTITHREAD2_H_
#define MULTITHREAD2_H_

#define MAXTRIES 2000
typedef struct struct_share{
unsigned int p0;
unsigned int p1;
}share_struct;

#endif /*MULTITHREAD2_H_*/
/*********************************************************** **/

thread-func.c
/*********************************************************** **/
#include <stdio.h>
#include <unistd.h>

#include "multi-thread.h"

static share_struct ss;

void *
thread_func0(void *arg)
{
unsigned int *p;
int i=0;

p = &(ss.p0);

for (;i < MAXTRIES;i++) {
if( ss.p0 > 1 + ss.p1 ) /* break point here*/
printf("P0:P0 loops times is %d more than P1\n",ss.p0-ss.p1);

(*p)++;
sleep(2);
}

return NULL;
}

void *
thread_func1(void *arg)
{
unsigned int *p;
int i=0;

p = &(ss.p1);

for (;i < MAXTRIES;i++) {
if(ss.p1> 1 + ss.p0) /* break point here*/
printf("P1:P1 loops times is %d more than P0\n",ss.p1-ss.p0);

(*p)++;
sleep(2);
}

return NULL;
}
/*********************************************************** **/

Any comments are welcome!

Thanks!
Sam
Re: Error in remote debugging multi-thread program [message #202377 is a reply to message #201948] Mon, 01 October 2007 04:45 Go to previous message
Eclipse UserFriend
Originally posted by: samsheng.trident.com.cn

This problem is solved by version:
http://www.eclipse.org/downloads/download.php?file=/technolo gy/epp/downloads/release/20070927/eclipse-cpp-europa-fall-li nux-gtk.tar.gz&r=1&protocol=http

Thanks for your attention!
Sam

"Sam Sheng" <samsheng@trident.com.cn>
Wrote:fcteh1$3pg$1@build.eclipse.org...
> Hello,
>
> I got an error message during remote debugging a multi-thread process
> using
> cdt.
> It says:
> An internal error occurred during: "child count update".
> -1
>
> The detail scenario is:
> Eclipse version: 3.3RC1 for Linux
> CDT version: 4.0.0 M7
> GDB version: 6.5 (cross platfrom client + server)
>
> The process on target has two threads.
>
> I set break points in both thread functions.
>
> After process running, the first thread got caught, and I do operation
> "Step Over".
> If the focus stays in first thread, everything is OK;
> If the the first thread lost focus, Eclipse will show error message box
> with
> message:
> An internal error occurred during: "child count update".
> -1
>
> Any help is appreciated.
>
> Following is the source files:
> makefile
> ############################################################ ###
> all:threads install
>
> threads: thread-func.c multi-thread.c
> mips_lexra_fp_be-gcc -g -Wall $^ -o $@ -lpthread
>
> install:
> cp threads /opt/rootfs/debug/
>
> clean:
> rm -f threads
> ############################################################ ###
>
> multi-thread.c
> /*********************************************************** **/
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <pthread.h>
>
> #include "multi-thread.h"
>
> extern void * thread_func0(void *arg);
> extern void * thread_func1(void *arg);
>
> int
> main(int argc, char **argv)
> {
> int retVal = 0, index = 0;
> int numThreads;
> pthread_t thid[100];
>
> numThreads = 2;
>
> /*create all the threads*/
> index = 0;
> printf("Creating thread num %d\n", index);
> retVal = pthread_create(&thid[index], NULL, thread_func0, (void *)&index);
> if (retVal < 0) {
> printf("Error in creating thread id %ld\n", thid[index]);
> }
> sleep(1);
> index++;
> printf("Creating thread num %d\n", index);
> retVal = pthread_create(&thid[index], NULL, thread_func1, (void *)&index);
> if (retVal < 0) {
> printf("Error in creating thread id %ld\n", thid[index]);
> }
> sleep(1);
>
> for (index = 0; index < numThreads; index++) {
> pthread_join(thid[index],NULL);
> }
> while(1)
> sleep(1);
> }
> /*********************************************************** **/
>
> multi-thread.h
> /*********************************************************** **/
> #ifndef MULTITHREAD2_H_
> #define MULTITHREAD2_H_
>
> #define MAXTRIES 2000
> typedef struct struct_share{
> unsigned int p0;
> unsigned int p1;
> }share_struct;
>
> #endif /*MULTITHREAD2_H_*/
> /*********************************************************** **/
>
> thread-func.c
> /*********************************************************** **/
> #include <stdio.h>
> #include <unistd.h>
>
> #include "multi-thread.h"
>
> static share_struct ss;
>
> void *
> thread_func0(void *arg)
> {
> unsigned int *p;
> int i=0;
>
> p = &(ss.p0);
>
> for (;i < MAXTRIES;i++) {
> if( ss.p0 > 1 + ss.p1 ) /* break point here*/
> printf("P0:P0 loops times is %d more than P1\n",ss.p0-ss.p1);
>
> (*p)++;
> sleep(2);
> }
>
> return NULL;
> }
>
> void *
> thread_func1(void *arg)
> {
> unsigned int *p;
> int i=0;
>
> p = &(ss.p1);
>
> for (;i < MAXTRIES;i++) {
> if(ss.p1> 1 + ss.p0) /* break point here*/
> printf("P1:P1 loops times is %d more than P0\n",ss.p1-ss.p0);
>
> (*p)++;
> sleep(2);
> }
>
> return NULL;
> }
> /*********************************************************** **/
>
> Any comments are welcome!
>
> Thanks!
> Sam
>
>
>
Previous Topic:Changing the new class wizard
Next Topic:Code completion not effect the #inlcude<> files
Goto Forum:
  


Current Time: Tue Jun 10 20:46:29 EDT 2025

Powered by FUDForum. Page generated in 0.04055 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top