A way to combine signpost with backtrace data?

What would be the way to add backtrace data to events I report to my custom instrument via signposts? I'd love to be able to select a point of interest on the instrument lane and drill down to the frame in the stack where the event is reported and then double click to go to that place in the source in Xcode. Is that something doable?

Accepted Reply

Thanks. That's a bug and I started tracking it. This is a problem in the auto-generation of modelers code.


For now, you can always create your own modeler (instead of letting os-signpost-interval-schema generate one) and use os-signpost events directly to capture backtraces from them.

You can see how direct capture of data from os-signpost table can be done by watching Modeling in Custom Instruments WWDC session and following associated sample code. In case of any questions you might have — please free to ask them here.


Really sorry for your inconvenience.


Kacper

Replies

Hey!


There's a special Dynamic Stack Tracing category.

If you create your OS Log handle with this category: https://developer.apple.com/documentation/os/oslog/category/3242665-dynamicstacktracing


os-signpost table will then contain implicit backtrace column. To bind to the backtraces in your os-signpost-interval-schema — bind the new variable in the (start|end)-pattern/user-backtrace field.


Please let me know if you have any troubles with getting this working.

Exciting! Will look into it when I find time in the next couple of days - thanks for the tip

So, migrated successfully to using the "DynamicStackTracing" category and I can still see my intervals plotted.


However I haven't been successful at capturing the backtrace:


<os-signpost-interval-schema>
...
  
 <start-pattern>
     <message>"subscribe:" ?subscription-name</message>
     <user-backtrace>?backtrace</user-backtrace>
   </start-pattern>

Fails to compile with:


[TMPLTDEF1] Invalid slot 'user-backtrace' not defined in corresponding deftemplate 'os-signpost'.

Thanks. That's a bug and I started tracking it. This is a problem in the auto-generation of modelers code.


For now, you can always create your own modeler (instead of letting os-signpost-interval-schema generate one) and use os-signpost events directly to capture backtraces from them.

You can see how direct capture of data from os-signpost table can be done by watching Modeling in Custom Instruments WWDC session and following associated sample code. In case of any questions you might have — please free to ask them here.


Really sorry for your inconvenience.


Kacper

Thanks so much for your help, I'll wait to see if that gets fixed