[lldb-dev] PATCH for REVIEW: Implement Host::SetThreadName on Linux

Thirumurthi, Ashok ashok.thirumurthi at intel.com
Mon May 13 12:24:25 PDT 2013


Welcome Mike,

> We're doing a lot of debugging on Linux and I'm hoping to do whatever I can to make lldb a much better debugger than gdb / cgdb - what most of us are currently using.

FYI, the tests decorated with expectedFailureLinux or skipOnLinux are cross-referenced with bugzilla reports.  Here is a query that can provide a summary:
  http://llvm.org/bugs/buglist.cgi?query_format=specific&order=relevance%20desc&bug_status=__open__&product=lldb&content=Linux&list_id=37673

We try to keep the status up to date, and the ones that are likely to change soon are 14600, 14416, 15824, and 14541 which are on our plate currently.  We've investigated most of issues a little, such as 14637 that Greg mentioned below.  We've also been trying to improve test coverage when running:
  lldb/test$python dotest.py --executable=/path/to/lldb

Note also that many tests fail with 32-bit inferiors that aren't captured in the bugzilla reports yet:
  lldb/test$python dotest.py --executable=/path/to/lldb -A i386

FreeBSD support and 32-bit lldb are also in need of a friend!  Cheers,

- Ashok

-----Original Message-----
From: lldb-dev-bounces at cs.uiuc.edu [mailto:lldb-dev-bounces at cs.uiuc.edu] On Behalf Of Greg Clayton
Sent: Monday, May 13, 2013 12:44 PM
To: Mike Sartain
Cc: lldb-dev at cs.uiuc.edu
Subject: Re: [lldb-dev] PATCH for REVIEW: Implement Host::SetThreadName on Linux


On May 10, 2013, at 5:30 PM, Mike Sartain <mikesart at valvesoftware.com> wrote:

> On Fri, May 10, 2013 at 1:41 PM, Kopec, Matt <matt.kopec at intel.com> wrote:
> 
>> Thanks for contributing the patch! This will help many of us in debugging lldb. Good to know there are other Linux lldb developers out there. :)
> 
> Thanks Matt. We're doing a lot of debugging on Linux and I'm hoping to do whatever I can to make lldb a much better debugger than gdb / cgdb - what most of use are currently using.

We look forward to getting more people working on LLDB in general, I am glad to see more people getting on board!


> I'm just now starting to get in the code and poke around and see what's there. If you have any suggestions on where I could help and not duplicate work, please fire away.

The libedit code in the "lldb" binary seems to be a bit flaky on linux. Sometimes the (lldb) prompt does't show up and other times the newlines after entered commands come out in the command output. Anything that can be done to solidify the libedit based code on linux would be a great help.

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


dlsym() is the right way to go to avoid build issues and distribution issues. We will need to keep this in for at least a few years until we require at least a certain version of glibc on linux.

> 
>>> +        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'll switch this over to using std::string on Monday and resubmit. Would have done it today but I just got back from a Pioneer Farms fieldtrip. Whee! :)
> 
> Thanks for the reply. Have a great weekend.
> -Mike
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

_______________________________________________
lldb-dev mailing list
lldb-dev at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list