threadname support in KDevelop 4

Niko Sams niko.sams at
Mon Dec 21 09:30:58 UTC 2009

>> >        std::map<pthread_t, const char*> names;
>> >        void set_thread_name(const char *name)
>> >        { names[pthread_self()] = strdup (name); };
>> >    void thread_name(pthread_t t) { return names[t]; }
>> Imho this should be implemented on gdb side.
>> Vladimir, do you think this would be realistic?
>> Perhaps using python that finds out the names without the need for
>> this special function to the application?
> IIUC, the problem is that in a typical pthread program, there are *no* names
> of the threads, and pthreads do not provide an interface to set the name,
> even.
It could be done similar to pretty printers. Usually a thread stores *somewhere*
the information what it does, and library or application specific
"pretty thread name"-scripts
could determine that.
It would be trivial to implement that for the set_thread_name function
you wrote.

This solution wouldn't require that hackish signal.


More information about the KDevelop-devel mailing list