Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode internal debug logs

I’m reverse engineering Xcode and I wonder if there is a way to enable debug logs. I guess Xcode probably has some hidden preferences for that, does it?

like image 898
0xced Avatar asked Sep 07 '15 12:09

0xced


People also ask

How do I see logs in Xcode?

In the Xcode menu hit Run - Console. This is where NSLog / print / printf etc statements output. The key command is Command + Shift + R.

Does Xcode have a debugger?

The Xcode debugger provides several methods to step through your code and inspect variables. You can precisely control execution of your code from a breakpoint, stepping into and out of called functions as necessary to determine where your bug occurs.


1 Answers

Yes, you can enable a lot of hidden logs in Xcode. Here is a list of all aspects where you can tweak the log level. Get this list with

(lldb) po [[[DVTLogAspect allAspects] valueForKey:@"name"] sortedArrayUsingSelector:@selector(compare:)]
AutomaticTermination
AuxiliaryFilesWriting
BlockQueue
Build
BuildConfigurations
BuildContext
BuildInfo
BuildMessages
BuildPlanCreation
BuildRuleLoading
BuildSettingExpansion
BuildSettings
BuildTaskCreation
Building
Cache
CachePruning
Caching
Capabilities
ClangCodeCompletion
CodeSign
CodeSignUI
CommandInvocation
CommandLineBuildTiming
ConfigInspectionContext
Container
DBGDebugSessionPerformance
DBGFormattedSummaryPerformance
DBGNonPrimaryPCPerformance
DBGStackFrameFetchPerformance
DBGSteppingPerformance
DBGVariablesViewPerformance
DBGViewDebugger
DBGXPCDebugging
DSMDocSetLoading
DSMDocSetSearch
DVTActivityOptions
DVTAnnotationManager
DVTArchitecture
DVTAssertionEnvironment
DVTAssertions
DVTBindingHelper
DVTCodesigningAllTheThings
DVTCollectionChecking
DVTCommandLineTool
DVTDevice
DVTDeviceSearch
DVTDownloadable
DVTFilePath
DVTFilePathFSEvents
DVTFilePathLogMetrics
DVTFileType
DVTFindBar
DVTFirstLaunchPackageInstallationHelper
DVTFontAndColorTheme
DVTInvalidExtension
DVTMacroExpansionParsing
DVTMacroNamepsace
DVTMixIn
DVTNSImageAdditions
DVTNSImage_ImageDeallocations
DVTNSRunLoopAdditions
DVTPlatform
DVTPlugInExtensionFaulting
DVTPlugInLoading
DVTPlugInLocator
DVTPlugInManager
DVTPlugInQuery
DVTPreferenceSetManager
DVTRegularExpression
DVTReplacementView
DVTSDK
DVTSigningCertificate
DVTSigningCertificateManager
DVTSigningCertificateSource
DVTSourceEditorDrawing
DVTSourceEditorFolding
DVTSourceEditorLayout
DVTSourceEditorPerformance
DVTSourceLandmarks
DVTSourceModel
DVTSourceScanner
DVTSourceSpecificationLoading
DVTStateSaving
DVTSystemActivity
DVTTextAnnotation
DVTTextCompletionPerformance
DVTTextCompletionUI
DVTTextResponsivenessPerformance
DVTToolchain
DepCommandTraversal
DepNodeTraversal
Dependencies
DependencyAnalysis
DependencyGraph
DependencyGraphCreation
DependencyGraphCreationMetric
DependencyGraphLock
DependencyIssue
DerivedInfo
DerivedTargetAttributes
DocumentFileTypes
Executable
FSWatcher
FileInfoCaching
FileRefCaching
FileSuffixMapping
FileTypeDetection
GenericOutputParsing
GroupEnumerator
HdrScanning
HeaderScanning
Headermap
HeadermapCreation
Headermaps
IBAutoAttach
IBICPerformanceMetric
IBMessageChannel
IDEActivityLogSection
IDEActivityReportFileIOCoordinator
IDEActivityView
IDEActivityViewIssues
IDEActivityViewStructure
IDEApplicationLaunchPerformance
IDEBatchFindMetric
IDEBatchFindNavigator
IDEBuildAlertMonitor
IDEBuildArbitratorDebug
IDEBuildDebugMetric
IDEBuildIssueProviderLogLoadingPerformance
IDEBuildOnlyMetric
IDEBuildOperationDebug
IDEBuildOperationDependencies
IDEBuildOperationMemorySnapshot
IDEBuildOperationQueueSetResourceManagement
IDEBuildOperationTiming
IDEBuildTaskDebug
IDEBuilderDebug
IDECallHierarchy
IDECallerGenius
IDEClangDiagnostic
IDECodeModule
IDECommandManagerPerformance
IDEContainerDebug
IDEContainerFSEventsDebug
IDEContainerItemSCMDebug
IDEContextAutocreation
IDECounterpartsGeniusResultsFinderPerformance
IDEDeclarativeInspectorGeneratorLoadingPerformanceAspect
IDEDiagnosticController
IDEEditorContextDocumentForNavBarStructureChanged
IDEEditorContextFluidSwipeDebug
IDEEditorContextNavigation
IDEEditorContextObjectGraphCoalescing
IDEEditorCoordinator
IDEEditorDocument
IDEEditorDocumentDebug
IDEEditorDocumentModificationAspect
IDEEditorOpenPerformance
IDEExecutionEnvironmentExecuteOperation
IDEFileReferenceDebug
IDEFileReference_CallingDocumentEditedStateChangedTooOften
IDEFolderDebug
IDEGeniusResults
IDEGeniusResultsPerformance
IDEImplicitDependenciesDebug
IDEIndexDataSourcePerformanceAspect
IDEIndexDatabase
IDEIndexImporterDebug
IDEIndexQP
IDEIndexQuery
IDEIndexSwiftDataSource
IDEIndexing
IDEIndexingASTSize
IDEIndexingClangInvocation
IDEIndexingMetrics
IDEIndexingScheduling
IDEInitialization
IDEIssueManager
IDEKVO
IDEKeyBindings
IDELicenseAgreementViewController
IDELogStore
IDENavigableItem
IDENavigableItemArchivableRepresentation
IDENavigableItemCoordinator
IDENavigatorOutlineViewPerformance
IDENotifications
IDEOpenQuickly
IDEOpenQuicklyMetrics
IDEPackageInstallerHelper
IDEPlaygroundExecutionCoordinator
IDEReadOnlyItemsManager
IDERunContextManager
IDERunContextManagerPerformance
IDERunDestination
IDERunDestinationPerformance
IDESchemeSheetOpening
IDESourceCodeCallersCalleesGeniusResultsFinder
IDESourceCodeIndexGeniusResultsFinder
IDESourceCodeNavigation
IDESourceCodeNavigationPerformance
IDESourceCodeSymbolsColoring
IDESourceCodeSymbolsColoringPerformance
IDESourceControl
IDESourceControlFileScanning
IDESourceControlProfiling
IDESourceControlTaskOperation
IDESourceEditorDropRecomputableState
IDESourceEditorTopLevelStructure
IDESourceKitService
IDESourceLanguageServiceSwift
IDESourceSyntaxColoringPrefetch
IDESyntaxColoringPerformance
IDETestManager
IDETestingHelperDebug
IDETextEncoding
IDETextIndex
IDEUpgradeTaskPerformanceMetric
IDEUtilityAreaPerformanceAspect
IDEVersionedFileManager
IDEWelcomeWindowPerformance
IDEWorkspaceClosing
IDEWorkspaceLoading
IDEWorkspaceUILoading
IndexingInfo
InstantOff
IntegrityChecking
LaunchRunPhase
MessageQueues
Modules
NativeBuilding
OperationStatus
Operations
OptionCategories
PersistedBuildResults
PlatformLoading
Plist
PlugInCompilers
PlugInTools
PluginLoading
PrecompiledHeader
ProfileScheme
ProjectLoading
ProjectLocalization
ProjectReference
ProjectSaving
ProjectTiming
PropertyValue
QuickHelp
RecursiveSearchPaths
RelevantToolSpecs
RunAlerts
SDKLoading
SimplePreprocessor
SourceFileFiltering
SpecificationLoading
SpecificationLoadingTiming
SpecificationsDebug
SupportedBuildTools
TSRegularExpression
Target
TargetCache
TargetCaches
ThreadedOperations
Unarchiving
WorkQueueProcessing
XBS
XCClangResultsPostprocessor
XCGccMakefileDependencies
XCPropertyValue
iPhoneSimulator

There are three log levels

  1. critical (default)
  2. standard
  3. verbose

To change a log level, append LogLevel to the aspect name and write it to Xcode’s preferences. For example, to get verbose logs about SDK loading, type the following command:

defaults write com.apple.dt.xcode DVTSDKLogLevel -int 3 && killall -u $USER cfprefsd

To change all log levels at once, use the DVTDefaultLogLevel preference. But you probably don’t want to do that because it will quickly get way too verbose.

If you don’t want the user defaults stored permanently, you can run Xcode from a Terminal and pass the user default as parameter instead:

/Applications/Xcode.app/Contents/MacOS/Xcode -DVTSDKLogLevel 3
like image 173
0xced Avatar answered Nov 01 '22 13:11

0xced