Skip to content

Commit

Permalink
[Matter.framework] Backtrace logging for MTRDeviceControllerFactory::… (
Browse files Browse the repository at this point in the history
#36113)

* [Matter.framework] Backtrace logging for MTRDeviceControllerFactory::startControllerFactory/stopControllerFactory

* Update src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm

---------

Co-authored-by: Justin Wood <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Dec 2, 2024
1 parent 3156f2d commit 6825413
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam
error:(NSError * __autoreleasing *)error
{
[self _assertCurrentQueueIsNotMatterQueue];
[self _maybeLogBacktrace:@"Controller Factory Start"];

__block CHIP_ERROR err = CHIP_ERROR_INTERNAL;
dispatch_sync(_chipWorkQueue, ^{
Expand Down Expand Up @@ -418,6 +419,7 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam
- (void)stopControllerFactory
{
[self _assertCurrentQueueIsNotMatterQueue];
[self _maybeLogBacktrace:@"Controller Factory Stop"];

for (MTRDeviceController * controller in [_controllers copy]) {
[controller shutdown];
Expand Down Expand Up @@ -1245,6 +1247,13 @@ - (FabricTable * _Nullable)fabricTable
return systemState->Fabrics();
}

- (void)_maybeLogBacktrace:(NSString *)message
{
@autoreleasepool {
MTR_LOG("[%@]: %@", message, [NSThread callStackSymbols]);
}
}

@end

@interface MTRDummyStorage : NSObject <MTRStorage>
Expand Down

0 comments on commit 6825413

Please sign in to comment.