tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Call stacks are not collected on MacOS 12.4

Open atticus5 opened this issue 3 years ago • 9 comments

-- The C compiler identification is AppleClang 13.1.6.13160021

Screenshot 2022-06-08 at 16 53 20

I'm also using dsymutil to extract the debug symbols. The lldb debugger is able to retrieve call stack information.

The only way I managed to get it working was to add the following lines in my main function, before everything else:

    while (i < 30)
    {
            TracyCZoneS(Main, 3, TRACY_ENABLE)
            SDL_Delay(200);
            TracyCZoneEnd(Main);
            i++;
            TracyCFrameMark()
    }

For some reason this kicks the call stack collection:

Screenshot 2022-06-08 at 17 04 02

atticus5 avatar Jun 08 '22 14:06 atticus5

The only way I can reproduce this is by having outdated dsymutil symbols. Otherwise can't repro.

wolfpld avatar Jun 13 '22 20:06 wolfpld

Unfortunately, it's not the case on my side, I double checked. I will take some time in the next days to debug on tracy's source code.

atticus5 avatar Jun 15 '22 19:06 atticus5

I tested with the test application, replacing everything in main with a busy loop. Do you have a test case?

wolfpld avatar Jun 15 '22 19:06 wolfpld

I GOT IT! :D

The test works on my side as well!

To reproduce this, replace everything from the main function with a function call from an included file.

The function from the included cpp file should contain this:

#include <chrono>
#include <mutex>
#include <thread>
#include <stdlib.h>
#include "../Tracy.hpp"
#include "../common/TracySystem.hpp"

#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_JPEG
#include "stb_image.h"

void test_call_stack()
{
   int x, y;
    auto image = stbi_load( "image.jpg", &x, &y, nullptr, 4 );

    for(;;)
    {
        TracyMessageL( "Tick" );
        std::this_thread::sleep_for( std::chrono::milliseconds( 2 ) );
        {
            ZoneScoped;
            std::this_thread::sleep_for( std::chrono::milliseconds( 2 ) );
        }
        FrameImage( image, x, y, 0, false );
        FrameMark;
    }
}

Please let me know how it works.

atticus5 avatar Jun 15 '22 20:06 atticus5

I checked the stack from the memory tab on alloc btw

atticus5 avatar Jun 15 '22 20:06 atticus5

The example you have provided is not self-contained.

wolfpld avatar Jul 03 '22 12:07 wolfpld

I can confirm I have the same issue as well, even with the Test app (without any modifications). Memory allocations only show the symbol and not the function line in the stack trace.

Also on 12.4

AntoineConffx avatar Jul 08 '22 00:07 AntoineConffx

Seems like I'm also seeing the same issues on iOS ? image

AntoineConffx avatar Jul 18 '22 19:07 AntoineConffx

Some progress on this. It seems like i had to generate debug symbols with dsym instead of just dwarf. the dsym needs to be next to the actual executable in case of a bundled .app. <Package.app>/Contents/MacOS/
There's still some odd behavior but I believe it's not coming from tracy anymore.

Thanks !

AntoineConffx avatar Jul 19 '22 22:07 AntoineConffx

Same issue. Finally I found the solution in tracy_user_manual.pdf:

On iOS you will have to add a New Run Script Phase to your XCode project, which shall execute the following shell script: cp -rf ${TARGET_BUILD_DIR}/${WRAPPER_NAME}.dSYM/* ${TARGET_BUILD_DIR}/${ UNLOCALIZED_RESOURCES_FOLDER_PATH}/${PRODUCT_NAME}.dSYM

helloellite avatar Mar 08 '24 10:03 helloellite