My code is getting crashed due to queue
I am getting the thread id so is there any way to get the function name from the thread id in objective-c? i don't know where the code is getting crashed. i have used different kinds of exceptions and breakpoints some lldb command but it doesn't show me the function name or the class which is creating issue. can anyone suggest me thanks for the help.
error
<NSThread: 0x7b1000077880>{number = 17, name = (null)}
Related
I've been trying to write a pool of database connections based on a lockable queue (well, seq in this case) called POOL. I want to have POOL as a global variable and then use initConnectionPool to instantiate it. I've tried to do so with the code below
var POOL: ConnectionPool
proc initConnectionPool*(initialPoolSize: static int) =
POOL = ConnectionPool(connections: #[])
initLock(POOL.lock)
However, this throws a compiler error:
‘pthread_mutex_t {aka union <anonymous>}’ has no member named ‘abi’
I am not quite sure what this is supposed to mean or what to do about this. How can I fix this issue?
Update: As of nim v. 1.6.6 this appears to no longer be an issue and work flawlessly.
For pre nim v.1.6.6:
This appears to be a known issue. Thankfully xflywind helped me out an pointed me to the right answer.
POOL = ConnectionPool(connections: #[]) within the proc is not allowed and causes the compile issue here. What you should be doing here is, instead of instantiating this object, to just assign the individual fields here as if the object already existed, since, in a way, it already does.
So this will compile:
proc initConnectionPool*(initialPoolSize: static int) =
POOL.connections: #[]
initLock(POOL.lock)
in Mopub-SDK for iOS.there is an error in calling "mp_safe_block" method.
Macro definition:
// Macros for dispatching asynchronously to the main queue
#define mp_safe_block(block, ...) block ? block(__VA_ARGS__) : nil
Called as:
mp_safe_block(complete, NSError.sdkInitializationInProgress, nil);
Error message:
Left operand to ? is void, but right operand is of type 'nullptr_t'
maybe this error has nothing to do with the SDK itself. how to fix it ?
PS:
that sdk code run correctly in a new xCode project created by myself. but there is an error in a Xcode-project builded by MMF2(clickTeam fusion)
and this xCode-project version is too old. I updateded setting of Xcode.but it still an error.
My JNI code consists of calling some java functions (.jar file) from a C++ main.
The code compiles well, but during execution i get :
Segmentation fault (core dumped)
i ran GNU gdb to debug and i found the following during the call of this method :
if(mid != 0) {
doub = env->CallIntMethod(cls,mid,10);
Program received signal SIGSEGV, Segmentation fault.
0x00000000678856ed in jvm!JNI_GetCreatedJavaVMs ()
from /cygdrive/c/Program Files/Java/jdk1.8.0_05/jre/bin/server/jvm.dll
I also checked if the class is found (JNI FindClass function) and if the JVM is created (JNI_CreateJavaVM function) through the return value, and everything seems to be just fine.
At the end of the debugging the threads exit with code 35584 :
[Thread 4632.0x1304 exited with code 35584]
I didn't find anything about this value except that it implies a problem in the path to something required by the executable ... Any ideas about this ?
I specified the path for the .jar file as following :
char op[] = "-Djava.class.path=D:\\path\\tojar/MyJar.jar;D:\\path\\toclass";
options[0].optionString = op;
Thank you StackOverflowers :)
ps : if you think that posting the code can help please notify me in the comments !
CallIntMethod expects the first argument to be the receiver (i.e. this) object.
When the method you call is static, use CallStaticIntMethod.
I've written some code that dumps all ivars of a class into a dictionary in Objective C. This uses valueForKey: to get the data from the class. Sometimes, KVC throws an internal exception that is also captured properly - but this disrupts lldb's feature and all I get is:
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3)..
The process has been returned to the state before expression evaluation.
There are no breakpoints set. I even tried with -itrue -ufalse as expression options, but it doesn't make a difference. This totally defeats for what I want to use lldb for, and it seems like such a tiny issue. How can I bring clang to simply ignore if there are internal, captured ObjC exceptions while calling a method?
I tried this both from within Xcode, and directly via calling clang from the terminal and connecting to a remote debug server - no difference.
I ran into the same issue. My solution was to wrap a try/catch around it (I only use this code for debugging). See: DALIntrospection.m line #848
NSDictionary *DALPropertyNamesAndValuesMemoryAddressesForObject(NSObject *instance)
Or, if you're running on iOS 7, the private instance method _ivarDescription will print all the ivars for you (similar instance methods are _methodDescription and _shortMethodDescription).
I met the same problem.
My solution is simply alloc init the property before assigning it to the value which caused the crash.
Myself and coworkers ran into this today, and we eventually found a workaround using lldb's python API. The manual way is to run script, and enter:
options = lldb.SBExpressionOptions()
options.SetTrapExceptions(False)
print lldb.frame.EvaluateExpression('ThisThrowsAndCatches()', options).value
This could be packaged into its own command via command script add.
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3).. The process has been returned to the state before expression evaluation.
Note that lldb specifically points to the internal breakpoint -3 that caused the interruption.
To see the list of all internal breakpoints, run:
(lldb) breakpoint list --internal
...
Kind: ObjC exception
-3: Exception breakpoint (catch: off throw: on) using: name = 'objc_exception_throw', module = libobjc.A.dylib, locations = 1
-3.1: where = libobjc.A.dylib`objc_exception_throw, address = 0x00007ff81bd27be3, unresolved, hit count = 4
Internal breakpoints can be disabled like regular ones:
(lldb) breakpoint disable -3
1 breakpoints disabled.
In case lldb continues getting interrupted you might also need to disable the conditions of the breakpoint:
(lldb) breakpoint disable -3.*
1 breakpoints disabled.
In my particular case there were multiple exception breakpoints I had to disable before I finally got the expected result:
(lldb) breakpoint disable -4 -4.* -5 -5.*
6 breakpoints disabled.
I wrote a very simple code that reads and writes from a card. I got an error:
An unhandled exception of type
'System.Runtime.InteropServices.MarshalDirectiveException' occured in
ReadandWrite.exe
Additional information: PInvoke restriction: can not return variants.
Code Snippet:
Console.WriteLine("Address = 0x3c3, Value = 0x", MX4.r_1byte(963).ToString)
I am trying to understand the error and how to fix it.
Sounds like you're forgetting to declare an Interop Type for one or more of your Public methods/properties. See this MSDN thread.