• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
inline, optimize, and call stack visibility?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inline, optimize, and call stack visibility?


  • Subject: inline, optimize, and call stack visibility?
  • From: "David M. Cotter" <email@hidden>
  • Date: Tue, 25 Jan 2011 15:01:01 -0800

In my app, if it crashes on a user, it generates a crash report which gets sent to me.

i have a class that's created on different threads

i want to differentiate between each thread, so i can READ which thread it is by looking at the call stack

in my debug version, the thread stacks look like this:

thread 3
3   com.kjams.kjams               0x001095d4 CSemaphore::wait(long) + 1288
4   com.kjams.kjams               0x00287835 CMutex_ThreadQue::CB_ActualRunQue() + 471
5   com.kjams.kjams               0x00237d71 CMutex_ThreadQue_PushMeta::CB_RunQue() + 17
6   com.kjams.kjams               0x0028547d CMutex_ThreadQue::CB_S_RunQue(void*, long) + 17
7   com.kjams.kjams               0x00286617 CThreads::CB_Fork(APP_ForkInfo*) + 703
8   com.kjams.kjams               0x00286a71 CB_S_Fork_Preemptive(void*) + 25
9   com.kjams.kjams               0x00289ccd boost::detail::thread_data<CFork_Preemptive>::run() + 23
10  libboost_thread.dylib         0x007bca3a thread_proxy + 138
11  libSystem.B.dylib             0x95a6b85d _pthread_start + 345
12  libSystem.B.dylib             0x95a6b6e2 thread_start + 34

thread 5
3   com.kjams.kjams               0x001095d4 CSemaphore::wait(long) + 1288
4   com.kjams.kjams               0x00287835 CMutex_ThreadQue::CB_ActualRunQue() + 471
5   com.kjams.kjams               0x00237d85 CMutex_ThreadQue_DiscEvent::CB_RunQue() + 17
6   com.kjams.kjams               0x0028547d CMutex_ThreadQue::CB_S_RunQue(void*, long) + 17
7   com.kjams.kjams               0x00286617 CThreads::CB_Fork(APP_ForkInfo*) + 703
8   com.kjams.kjams               0x00286a71 CB_S_Fork_Preemptive(void*) + 25
9   com.kjams.kjams               0x00289ccd boost::detail::thread_data<CFork_Preemptive>::run() + 23
10  libboost_thread.dylib         0x007bca3a thread_proxy + 138
11  libSystem.B.dylib             0x95a6b85d _pthread_start + 345
12  libSystem.B.dylib             0x95a6b6e2 thread_start + 34

see how you can see the difference?

but in the release version, that is optimized out!  looks like this:  

thread 3
4   com.kjams.kjams                0x001095d4 CSemaphore::wait(long) + 1288
5   com.kjams.kjams                0x00287835 CMutex_ThreadQue::CB_ActualRunQue() + 471
6   com.kjams.kjams                0x0028547d CMutex_ThreadQue::CB_S_RunQue(void*, long) + 17
7   com.kjams.kjams                0x00286617 CThreads::CB_Fork(APP_ForkInfo*) + 703
8   com.kjams.kjams                0x00286a71 CB_S_Fork_Preemptive(void*) + 25
9   com.kjams.kjams                0x00289ccd boost::detail::thread_data<CFork_Preemptive>::run() + 23
10  libboost_thread.dylib          0x007bca3a thread_proxy + 138
11  libSystem.B.dylib              0x95a6b85d _pthread_start + 345
12  libSystem.B.dylib              0x95a6b6e2 thread_start + 34

thread 5
4   com.kjams.kjams                0x001095d4 CSemaphore::wait(long) + 1288
5   com.kjams.kjams                0x00287835 CMutex_ThreadQue::CB_ActualRunQue() + 471
6   com.kjams.kjams                0x0028547d CMutex_ThreadQue::CB_S_RunQue(void*, long) + 17
7   com.kjams.kjams                0x00286617 CThreads::CB_Fork(APP_ForkInfo*) + 703
8   com.kjams.kjams                0x00286a71 CB_S_Fork_Preemptive(void*) + 25
9   com.kjams.kjams                0x00289ccd boost::detail::thread_data<CFork_Preemptive>::run() + 23
10  libboost_thread.dylib          0x007bca3a thread_proxy + 138
11  libSystem.B.dylib              0x95a6b85d _pthread_start + 345
12  libSystem.B.dylib              0x95a6b6e2 thread_start + 34

looks the same.  :(  so i tried really hard to force it to NOT inline:

class CMutex_ThreadQue_PushMeta : public CMutex_ThreadQue {
#pragma no_inline
void CB_RunQue() __attribute__ ((noinline)) { CB_ActualRunQue(); }
#pragma inline


public: 
CMutex_ThreadQue_PushMeta() : CMutex_ThreadQue("Push Meta Que", false, true) {}
};

i also tried turning off "inline methods hidden"
all TO NO AVAIL!  so maybe this isn't an inlining issue?

so then i tried turning down the optimizations:
started with:
-Os - fail
-O3 - fail
-O2 - fail
-O1 - WIN!!

so, i have to dial down all the way to -O1? 

this is for my release app, so i'd definitely rather not do that.

is there any way i can keep "-Os" and still see that function name in the call stack of each thread?

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: inline, optimize, and call stack visibility?
      • From: "Sean McBride" <email@hidden>
    • Re: inline, optimize, and call stack visibility?
      • From: Wim Lewis <email@hidden>
  • Prev by Date: Re: no previous prototype for function that is defined in header?
  • Next by Date: Re: Why doesn't NSMakePoint work from XCode/gdb?
  • Previous by thread: Re: Why doesn't NSMakePoint work from XCode/gdb?
  • Next by thread: Re: inline, optimize, and call stack visibility?
  • Index(es):
    • Date
    • Thread