On Fri, May 10, 2013 at 5:30 PM, Mike Sartain <[email protected]>wrote:
> On Fri, May 10, 2013 at 1:41 PM, Kopec, Matt <[email protected]> wrote: > > > Some comments about the patch... > > > > > +#elif defined (__linux__) > > > + void *fn = dlsym (RTLD_DEFAULT, "pthread_setname_np"); > > > + if (fn) > > > + { > > > > I believe this pthread function can be added by including pthread.h for > Linux. That way you don't need dlsym and can just re-use most of the code > that is already there for apple. > > pthread_setname_np was added in glibc v2.12, so anything running less than > that would run into issues if we called it directly. As an example on the > Ubuntu side, I believe 10.04 LTS shipped with 2.11.1. What are your > thoughts / requirements for minspecs like this? > ... > > > + const char *lastdot = ::strrchr( thread_name, '.' ); > > > + > > > + if (lastdot && lastdot != thread_name) > > > + thread_name = lastdot + 1; > > > + ::strncpy (namebuf, thread_name, sizeof(namebuf)); > > > + namebuf[ sizeof(namebuf) - 1 ] = 0; > > > + > > > + int namebuflen = strlen(namebuf); > > > > It would have been nice to use std::string and its' facilities. It would > make this easier to write and understand but what you have is fine. > I just wrote this up with std::string, but since Host::ThreadCreated() takes a regular C string, converting that to a std::string does a memory allocation. I personally would prefer the above code to it being more optimal, but that may also just be me not finding it more difficult to understand than the std::string. I'll code to whatever the project guidelines are though, so when you get a chance, let me know what folks on this project prefer and how to proceed with the glibc v2.12 issue and I'll resubmit all this. Thanks much. -Mike
_______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
