Right, i fixed the errors by installing glibc source code, but the **debugger** still wants to debug the **thread_start** in **clone.S**. Don't know how to disable this "feature". I am on **Geany 1.38** built on 2021-02-08 (git code).
Anyway, I came up with a better example and tested it with **gdb** to check if it is a bug in **gdb**. It worked as expected. Trying to debug with Geany hangs, there seems to be a race condition or it is waiting for some gdb info. Try to do reproduce this inside Geany and it hangs: ``` gdb ./thread GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./thread...done. (gdb) break 26 Breakpoint 1 at 0x916: file thread.c, line 26. (gdb) break 38 Breakpoint 2 at 0x9b8: file thread.c, line 38. (gdb) break 62 Breakpoint 3 at 0xac8: file thread.c, line 62. (gdb) break 65 Breakpoint 4 at 0xb22: file thread.c, line 65. (gdb) run Starting program: /home/alex/Download/apps/appsgw/thread/thread [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff77c2700 (LWP 20962)] Thread 0 created successfully Thread 0 starting... [New Thread 0x7ffff6fc1700 (LWP 20963)] Thread 1 starting... Thread 1 created successfully [Switching to Thread 0x7ffff77c2700 (LWP 20962)] Thread 2 "thread" hit Breakpoint 1, doSomeThing (arg=0x0) at thread.c:26 26 if(pthread_equal(id,tid[0])) { (gdb) n [Switching to Thread 0x7ffff6fc1700 (LWP 20963)] Thread 3 "thread" hit Breakpoint 1, doSomeThing (arg=0x1) at thread.c:26 26 if(pthread_equal(id,tid[0])) { (gdb) n Inside First thread Thread 0 processing... 29 printf("Inside Second thread\n"); (gdb) n Inside Second thread 32 printf("Thread %d processing...\n", i); (gdb) n Thread 1 processing... 33 for(x=0; x<(0xFFFFFFFF);x++) { (gdb) c Continuing. Thread 0: 0x7ffff77c2700 [ x = 0xFFFFFFFF ] [Switching to Thread 0x7ffff77c2700 (LWP 20962)] Thread 2 "thread" hit Breakpoint 2, doSomeThing (arg=0x0) at thread.c:38 38 printf("Thread %d: 0x%lx exit\n",i, id); (gdb) c Continuing. Thread 0: 0x7ffff77c2700 exit [Thread 0x7ffff77c2700 (LWP 20962) exited] [Switching to Thread 0x7ffff7fd6740 (LWP 20958)] Thread 1 "thread" hit Breakpoint 3, main () at thread.c:62 62 printf("Thread %d returned: %d\n", i, *ptr[i]); (gdb) n Thread 0 returned: 1 63 i++; (gdb) n 64 pthread_join(tid[i], (void**)&(ptr[i])); (gdb) n Thread 1: 0x7ffff6fc1700 [ x = 0xFFFFFFFF ] [Switching to Thread 0x7ffff6fc1700 (LWP 20963)] Thread 3 "thread" hit Breakpoint 2, doSomeThing (arg=0x1) at thread.c:38 38 printf("Thread %d: 0x%lx exit\n",i, id); (gdb) c Continuing. Thread 1: 0x7ffff6fc1700 exit [Thread 0x7ffff6fc1700 (LWP 20963) exited] [Switching to Thread 0x7ffff7fd6740 (LWP 20958)] Thread 1 "thread" hit Breakpoint 4, main () at thread.c:65 65 printf("Thread %d returned: %d\n", i, *ptr[i]); (gdb) n Thread 1 returned: 2 66 i++; // just to show on gdb next command (gdb) n 67 return 0; (gdb) c Continuing. [Inferior 1 (process 20958) exited normally] (gdb) ``` **breakpoints at lines: 26,38,62 and 65** Sample program: ``` #include<stdio.h> #include<string.h> #include<pthread.h> #include<stdlib.h> #include<unistd.h> /* * Build with: * * gcc -g -O0 -o thread thread.c -lpthread * */ pthread_t tid[2]; int ret[2]; void* doSomeThing(void *arg) { unsigned long x = 0; int j = 0; int i = (int)arg; printf("Thread %d starting...\n", i); pthread_t id = pthread_self(); if(pthread_equal(id,tid[0])) { printf("Inside First thread\n"); } else { printf("Inside Second thread\n"); } printf("Thread %d processing...\n", i); for(x=0; x<(0xFFFFFFFF);x++) { j++; } ret[i] = i + 1; printf("Thread %d: 0x%lx [ x = 0x%X ]\n",i, id, j); printf("Thread %d: 0x%lx exit\n",i, id); pthread_exit(&ret[i]); return NULL; } int main(void) { int i = 0; int err; int *ptr[2]; while (i < 2) { err = pthread_create(&(tid[i]), NULL, &doSomeThing, (void*)i); if (err != 0) printf("can't create thread :[%s]", strerror(err)); else printf("Thread %d created successfully\n", i); i++; } i = 0; pthread_join(tid[i], (void**)&(ptr[i])); printf("Thread %d returned: %d\n", i, *ptr[i]); i++; pthread_join(tid[i], (void**)&(ptr[i])); printf("Thread %d returned: %d\n", i, *ptr[i]); i++; // just to show on gdb next command return 0; } ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany-plugins/issues/1069#issuecomment-790177596