(jni_env: *mut JNIEnv, this: jobject, thread: jthread)
| 274 | } |
| 275 | |
| 276 | unsafe fn populate_stack_params(jni_env: *mut JNIEnv, this: jobject, thread: jthread) -> Result<(), String> { |
| 277 | // Grab the depth we want |
| 278 | let mut depth = get_stack_trace_depth(jni_env, this)?; |
| 279 | if depth == 0 { |
| 280 | debug!("Unable to get stack trace depth, using {}", DEFAULT_MAX_STACK_DEPTH); |
| 281 | depth = DEFAULT_MAX_STACK_DEPTH; |
| 282 | } |
| 283 | |
| 284 | // Load the stack params, skipping the first 2 by default which we know are not the caller |
| 285 | let mut params = get_params(jni_env, thread, depth + 10, 2)?; |
| 286 | // Only take the last so many to match the existing frame |
| 287 | if (depth as usize) < params.len() { |
| 288 | let to_remove_from_head = params.len() - (depth as usize); |
| 289 | params.drain(0..to_remove_from_head); |
| 290 | } |
| 291 | |
| 292 | // Convert to object array |
| 293 | let params_arr = params_to_object_array(jni_env, params)?; |
| 294 | // Store in local field... |
| 295 | (**jni_env).SetObjectField.unwrap()(jni_env, this, get_stack_params_field(jni_env)?, params_arr); |
| 296 | return util::result_or_jni_ex((), jni_env); |
| 297 | } |
| 298 | |
| 299 | unsafe fn get_throwable_class(jni_env: *mut JNIEnv) -> Result<jclass, String> { |
| 300 | let class_name_str = CString::new("java/lang/Throwable").unwrap(); |
no test coverage detected