Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » problems to debug in threads
problems to debug in threads [message #117768] Fri, 27 August 2004 15:29 Go to next message
Eclipse UserFriend
Originally posted by: ralf.becker.ids.de

I have a problem to debug in threads.
I use eclipse 3.0, CDT 2.0 and SUSE 9.0.
I create a project with "Managed Make c Project".
For example the poject contains 1 file thread1.c.
I have set pthread in the window libraries(-l).



Window Console C-Build[thread1]
--------------------------------
make -k all
Building file: ../thread1.c
gcc -O0 -g3 -Wall -c -fmessage-length=0 -othread1.o ../thread1.c
Finished building: ../thread1.c

Building target: thread1
gcc -othread1 thread1.o -lpthread
Finished building: thread1
Build complete for project thread1



C-Code:
--------------------------------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>

void *thread_function(void *arg);
char message[] = "Hello World";

int main() {
int res;
pthread_t a_thread;
void *thread_result;
res = pthread_create(&a_thread, NULL, thread_function, (void
*)message);
if (res != 0) { exit(EXIT_FAILURE); }
res = pthread_join(a_thread, &thread_result);
if (res != 0) { exit(EXIT_FAILURE); }
exit(EXIT_SUCCESS);
}

void *thread_function(void *arg) {
sleep(3);
printf("\n%s\n", message);
}



When I set a breakpoint in the line "printf("\n%s\n", message);" it works.
When I start the debugger with a breakpoint in the line "sleep(3);" the
following failure happens:

Window Debug:
--------------------------------
<terminated>GDB Debugger (...) (Suspended) <Couldn't get registers. Kein
passender Prozess gefunden>



In my greater project with many threads I have this failure all the time
and I think the failur occurs whereever I set the breakpoint in the thread.
What is the failure ?


Thanks for help
Re: problems to debug in threads [message #118114 is a reply to message #117768] Mon, 30 August 2004 14:55 Go to previous message
Eclipse UserFriend
Originally posted by: mikhailk.qnx.com

The message you're getting comes from gdb. To find out what is happening try
to get the gdb trace (see CDT debugger FAQ #5).

"Ralf Becker" <ralf.becker@ids.de> wrote in message
news:cgnjvt$7mb$1@eclipse.org...
> I have a problem to debug in threads.
> I use eclipse 3.0, CDT 2.0 and SUSE 9.0.
> I create a project with "Managed Make c Project".
> For example the poject contains 1 file thread1.c.
> I have set pthread in the window libraries(-l).
>
>
>
> Window Console C-Build[thread1]
> --------------------------------
> make -k all
> Building file: ../thread1.c
> gcc -O0 -g3 -Wall -c -fmessage-length=0 -othread1.o ../thread1.c
> Finished building: ../thread1.c
>
> Building target: thread1
> gcc -othread1 thread1.o -lpthread
> Finished building: thread1
> Build complete for project thread1
>
>
>
> C-Code:
> --------------------------------
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <pthread.h>
>
> void *thread_function(void *arg);
> char message[] = "Hello World";
>
> int main() {
> int res;
> pthread_t a_thread;
> void *thread_result;
> res = pthread_create(&a_thread, NULL, thread_function, (void
> *)message);
> if (res != 0) { exit(EXIT_FAILURE); }
> res = pthread_join(a_thread, &thread_result);
> if (res != 0) { exit(EXIT_FAILURE); }
> exit(EXIT_SUCCESS);
> }
>
> void *thread_function(void *arg) {
> sleep(3);
> printf("\n%s\n", message);
> }
>
>
>
> When I set a breakpoint in the line "printf("\n%s\n", message);" it works.
> When I start the debugger with a breakpoint in the line "sleep(3);" the
> following failure happens:
>
> Window Debug:
> --------------------------------
> <terminated>GDB Debugger (...) (Suspended) <Couldn't get registers. Kein
> passender Prozess gefunden>
>
>
>
> In my greater project with many threads I have this failure all the time
> and I think the failur occurs whereever I set the breakpoint in the
thread.
> What is the failure ?
>
>
> Thanks for help
>
>
Previous Topic:Build fails
Next Topic:cdt.debug.core preferences not initialized properly
Goto Forum:
  


Current Time: Tue Jul 16 10:13:50 GMT 2024

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

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

Back to the top