There are two SO questions I found that address debugging this:
Here and here
(1) One question recommends doing "otool -tv | grep CFUserNotification to the binary". Of course I changed out CFUserNotification for _deviceInfoForKey. I get this:
Binary file Lexly.app/Lexly matches
(2) The other question recommends doing otool -L Lexly.app/Lexly on the binary. I get a list of all the frameworks I added, repeated for each architecture.
How does this help me find the external libraries that are using the 3 offending selectors?
I found this blog post which explains, among other things, how to create a shell script in your project's root to find the offending selector.
Here's the script:
#!/bin/bash
for match in $(grep -lR uniqueIdentifier *); do
printf "File: %s\n****************************************\n\n" "$match"
strings $match | grep --context=15 uniqueIdentifier
printf "\n\n\n"
done
Just replace uniqueIdentifier with whatever selector you need to find.
Turns out all three of those selectors were from a beta analytics library I included months ago and wasn't even using. This was an old project I resurrected.
Related
I'm playing with LLDB with a simple app that has PhotosUI linked. Here's the command I'm running: image lookup -rn '\+\[\w+' PhotosUI. This is not giving me anything.
However, when I use image lookup -rn '\+\[[a-zA-Z0-9_]+' PhotosUI, I got many matches, one of which is
Summary: PhotosUI`__59+[UIViewController(PhotosUI) pu_currentViewControllerStack]_block_invoke
This is just one example that I totally expect '\+\[\w+' to also match. Did I miss something? This is the LLDB version I'm on:
lldb-1103.0.22.10
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
I'm trying to use the TensorFlow audio recognition model (my_frozen_graph.pb, generated here: https://www.tensorflow.org/tutorials/audio_recognition) on iOS.
But the iOS code NSString* network_path = FilePathForResourceName(#"my_frozen_graph", #"pb"); in the TensorFlow Mobile's tf_simple_example project outputs this error message: Could not create TensorFlow Graph: Not found: Op type not registered 'DecodeWav'.
Anyone knows how I can fix this? Thanks!
I believe you are using the pre-build Tensorflow from Cocapods? It probably does not have that op type, so you should build it yourself from latest source.
From documentation:
While Cocapods is the quickest and easiest way of getting started, you
sometimes need more flexibility to determine which parts of TensorFlow
your app should be shipped with. For such cases, you can build the iOS
libraries from the sources. This guide contains detailed instructions
on how to do that.
This might also be helpful: [iOS] Add optional Selective Registration of Ops #14421
Optimization
The build_all_ios.sh script can take optional
command-line arguments to selectively register only for the operators
used in your graph.
tensorflow/contrib/makefile/build_all_ios.sh -a arm64 -g $HOME/graphs/inception/tensorflow_inception_graph.pb
Please note this
is an aggresive optimization of the operators and the resulting
library may not work with other graphs but will reduce the size of the
final library.
After the build is done you can check /tensorflow/tensorflow/core/framework/ops_to_register.h for operations that were registered. (autogenerated during build with -g flag)
Some progress: having realized the unregistered DecodeWav error is similar to the old familiar DecodeJpeg issue (#2883), I ran strip_unused on the pb as follows:
bazel-bin/tensorflow/python/tools/strip_unused \
--input_graph=/tf_files/speech_commands_graph.pb \
--output_graph=/tf_files/stripped_speech_commands_graph.pb \
--input_node_names=wav_data,decoded_sample_data \
--output_node_names=labels_softmax \
--input_binary=true
It does get rid of the DecodeWav op in the resulting graph. But running the new stripped graph on iOS now gives me an Op type not registered 'AudioSpectrogram' error.
Also there's no object file audio*.o generated after build_all_ios.sh is done, although AudioSpectrogramOp is specified in tensorflow/core/framework/ops_to_register.h:
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$ find . -name decode*.o
./tensorflow/contrib/makefile/gen/obj/ios_ARM64/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARM64/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7S/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7S/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_I386/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_I386/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_X86_64/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_X86_64/tensorflow/core/kernels/decode_wav_op.o
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$ find . -name audio*_op.o
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$
Just verified that Pete's fix (https://github.com/tensorflow/tensorflow/issues/15921) is good:
add this line tensorflow/core/ops/audio_ops.cc to the file tensorflow/contrib/makefile/tf_op_files.txt and run tensorflow/contrib/makefile/build_all_ios.sh again (compile_ios_tensorflow.sh "-O3" itself used to work for me after adding a line to the tf_op_files.txt, but not anymore with TF 1.4).
Also, use the original model file, don't use the stripped version. Some note was added in the link above.
I just installed ClangOnWin,and I'm trying to get clang-tidy's "modernize" checks to work. Unfortunately, clang-tidy doesn't seem to know about them: clang-tidy -list-checks foo.cpp -- | grep modernize produces no output.
The "modernize" checks are listed here, but that page seems to document Clang 3.8, and the version I have installed is 3.7. However, version 3.7 is the current one listed at the LLVM Download Page.
clang-tidy knows about a variety of security checks, so I think I have it installed correctly. For example, clang-tidy -list-checks foo.cpp -- | grep security yields this:
clang-analyzer-security.FloatLoopCounter
clang-analyzer-security.insecureAPI.UncheckedReturn
clang-analyzer-security.insecureAPI.getpw
clang-analyzer-security.insecureAPI.gets
clang-analyzer-security.insecureAPI.mkstemp
clang-analyzer-security.insecureAPI.mktemp
clang-analyzer-security.insecureAPI.rand
clang-analyzer-security.insecureAPI.strcpy
clang-analyzer-security.insecureAPI.vfork
Is there something special I need to do to enable checks such as modernize-use-override and modernize-use-nullptr?
The modernize checks were added after 3.7 (ported from clang-modernize), but try adding -checks="*" to see the whole list of available checks.
clang-tidy -list-checks -checks="*" foo.cpp --
Have you tried with the official binaries from LLVM: http://llvm.org/releases/download.html ? Maybe the ClangOnWin binaries are not compiled with all options, or something of that kind.
We have a error log directory structure wherein we store all errors log files for a particular day in datewise directories -
errorbackup/20150629/errorlogFile3453123.log.xml
errorbackup/20150629/errorlogFile5676934.log.xml
errorbackup/20150629/errorlogFile9812387.log.xml
errorbackup/20150628/errorlogFile1097172.log.xml
errorbackup/20150628/errorlogFile1908071_log.xml
errorbackup/20150627/errorlogFile5675733.log.xml
errorbackup/20150627/errorlogFile9452344.log.xml
errorbackup/20150626/errorlogFile6363446.log.xml
I want to search for a particular string in the error log file and get the output such that I will get directory wise search result of a count of that string's occurrence. For example grep "blahblahSQLError" should output something like-
20150629:0
20150628:0
20150627:1
20150626:1
This is needed because we fixed some errors in one of the release and I want to make sure that there are no occurrences of that error since the day it was deployed to Prod. Also note that there are thousands of error log files created every day. Each error log file is created with a random number in its name to ensure uniqueness.
If you are sure the filenames of the log files will not contain any "odd" characters or newlines then something like the following should work.
for dir in errorbackup/*; do
printf '%s:%s\n' "${dir#*/}" "$(grep -l blahblahSQLError "$dir/"*.xml | wc -l)"
done
If they can have unexpected names then you would need to use multiple calls to grep and count the matching files manually I believe. Something like this.
for dir in errorbackup/*; do
_dcount=0;
for log in "$dir"/*.xml; do
grep -l blahblahSQLError "$log" && _dcount=$((_dcount + 1));
done
done
Something like this should do it:
for dir in errorbackup/*
do
awk -v dir="${dir##*/}" -v OFS=':' '/blahblahSQLError/{c++} END{print dir, c+0}' "$dir"/*
done
There's probably a cuter way to do it with find and xargs to avoid the loop and you could certainly do it all within one awk command but life's too short....
This question already has answers here:
How do you convert an iPhone OSStatus code to something useful?
(19 answers)
Closed 9 years ago.
I can easily find noErr = 0 in the OS X library source code. But it's pretty hard to find a full list of error code for OSStatus on iOS.
On Mac OS X, it's not that hard to find stuff like
kAudioHardwareUnsupportedOperationError
But I can't seem to find useful info for iOS OSStatus codes. It would be nice to have a full list of them or any pointers to the header files that define them.
Thanks!
UPDATE:
I don't think my question is a duplicate of the above question. The op of that "possible duplicate" question wanted to convert the 4-char codes he already knew into human-readable strings. Instead, here is my further spec:
I don't even know what 4-char or typedefed integers to use for iOS.
I'd like to see something like a full list of codes, like you would normally see in many C++ framework/library design, e.g., an enum list, or standard exceptions, or even the OSX k-something codes, which at least can be found in the Xcode docs alone.
My usecases of these codes include:
In my custom functions, e.g., some CoreAudio callbacks that have to return OSStatus, I'd like to return these built-in human-readable codes to indicate the types of runtime errors. Without the list, I don't know what to return, other than noErr.
Apparently, many OSX k-codes are undefined under iOS environment so they can't be used transparently.
UPDATE (CONCLUSION):
I finally found a clue: Search for keyword "Result Codes" in Xcode documentation (Organizer) and we get more or less categorized return codes documentation sections in the "System Guides" result. This is good enough for my original question. –
The best I can do to help is provide the results of using find from the command line:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
$ find . -name \*.h -exec fgrep -l OSStatus {} \;
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioConverter.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFile.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFileStream.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFormat.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioServices.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioSession.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h
./System/Library/Frameworks/AudioToolbox.framework/Headers/MusicPlayer.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioComponent.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioOutputUnit.h
./System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnitProperties.h
./System/Library/Frameworks/AudioUnit.framework/Headers/MusicDevice.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h
./System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMAudioClock.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBase.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBlockBuffer.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMBufferQueue.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSampleBuffer.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSimpleQueue.h
./System/Library/Frameworks/CoreMedia.framework/Headers/CMSync.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIDriver.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIServices.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDISetup.h
./System/Library/Frameworks/CoreMIDI.framework/Headers/MIDIThruConnection.h
./System/Library/Frameworks/Foundation.framework/Headers/NSError.h
./System/Library/Frameworks/MediaToolbox.framework/Headers/MTAudioProcessingTap.h
./System/Library/Frameworks/Security.framework/Headers/SecBase.h
./System/Library/Frameworks/Security.framework/Headers/SecIdentity.h
./System/Library/Frameworks/Security.framework/Headers/SecImportExport.h
./System/Library/Frameworks/Security.framework/Headers/SecItem.h
./System/Library/Frameworks/Security.framework/Headers/SecKey.h
./System/Library/Frameworks/Security.framework/Headers/SecTrust.h
./System/Library/Frameworks/Security.framework/Headers/SecureTransport.h
./usr/include/AssertMacros.h
./usr/include/Endian.h
./usr/include/MacTypes.h