threadname support in KDevelop 4

Vladimir Prus ghost at cs.msu.su
Mon Dec 21 11:00:10 UTC 2009


On Monday 21 December 2009 12:30:58 Niko Sams wrote:

> >> >        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.

That sounds fine -- provided we can actually get at the thread name. E.g. QThread
might have an objectName, but I don't know how to map from pthread_t to QThread.
Is is possible?

- Volodya




More information about the KDevelop-devel mailing list