Last Comment Bug 734685 - Support IPC Thread::SetName on Mac
: Support IPC Thread::SetName on Mac
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: IPC (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla14
Assigned To: Benoit Girard (:BenWa)
:
:
Mentors:
Depends on:
Blocks: omtc 720778
  Show dependency treegraph
 
Reported: 2012-03-10 15:09 PST by Benoit Girard (:BenWa)
Modified: 2012-05-19 09:00 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (3.06 KB, patch)
2012-03-10 15:09 PST, Benoit Girard (:BenWa)
cjones.bugs: review+
Details | Diff | Splinter Review
Screenshot (IPC thread 5+21 fixed by this patch) (29.56 KB, image/png)
2012-03-10 15:10 PST, Benoit Girard (:BenWa)
no flags Details

Description Benoit Girard (:BenWa) 2012-03-10 15:09:02 PST
Created attachment 604687 [details] [diff] [review]
patch

Useful for gdb, this code is an adaption from chromium/src/base/threading/platform_thread_posix.cc.
Comment 1 Benoit Girard (:BenWa) 2012-03-10 15:10:48 PST
Created attachment 604688 [details]
Screenshot (IPC thread 5+21 fixed by this patch)
Comment 2 Josh Matthews [:jdm] 2012-03-10 18:59:19 PST
Is this related to bug 720778 at all?
Comment 3 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-03-13 11:08:51 PDT
Comment on attachment 604687 [details] [diff] [review]
patch

Did you check if this was fixed in upstream chromium?  I'd be happy to pull a change from there, too.

>+  std::string shortened_name = std::string(name).substr(0, kMaxNameLength);
>+  // pthread_setname() fails (harmlessly) in the sandbox, ignore when it does.
>+  // See http://crbug.com/47058
>+  dynamic_pthread_setname_np(shortened_name.c_str());

What's the ownership model for the pointer here?  Please doc.

r=me with ownership clarified (/ proven correct ;) ).
Comment 4 Benoit Girard (:BenWa) 2012-03-13 11:20:59 PDT
I got the code from 'chromium/src/base/threading/platform_thread_posix.cc', wouldn't that be upstream? The change doesn't apply cleanly so I had to make a patch manually.
Comment 5 Benoit Girard (:BenWa) 2012-03-13 11:29:11 PDT
I looked in bionic and it's implemented by copying name:
bionic/libc/bionic/pthread.c

So it must certainly be the same elsewhere. I'll add a comment when checking in.
Comment 7 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-03-13 11:35:35 PDT
Pulling from upstream is good.  Would prefer you check the darwin docs, but r+ from upstream (hopefully) means someone else already checked docs.
Comment 8 Ed Morley [:emorley] 2012-03-14 14:39:29 PDT
https://hg.mozilla.org/mozilla-central/rev/192785313581

Note You need to log in before you can comment on or make changes to this bug.