|
|
f9a98e |
From 292f1775606874562026b5e27c3a192694553979 Mon Sep 17 00:00:00 2001
|
|
|
f9a98e |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
f9a98e |
Date: Sat, 11 Jan 2014 00:34:15 +0100
|
|
|
f9a98e |
Subject: [PATCH 20/39] Use the main class URL for 'executable'
|
|
|
f9a98e |
|
|
|
f9a98e |
Closes #28
|
|
|
f9a98e |
Related to rhbz#1054737
|
|
|
f9a98e |
---
|
|
|
f9a98e |
src/abrt-checker.c | 31 +++++++++++++++++++++++++++++--
|
|
|
f9a98e |
test/CMakeLists.txt | 6 ++++--
|
|
|
f9a98e |
2 files changed, 33 insertions(+), 4 deletions(-)
|
|
|
f9a98e |
|
|
|
f9a98e |
diff --git a/src/abrt-checker.c b/src/abrt-checker.c
|
|
|
f9a98e |
index c62d1ef..613a0ec 100644
|
|
|
f9a98e |
--- a/src/abrt-checker.c
|
|
|
f9a98e |
+++ b/src/abrt-checker.c
|
|
|
f9a98e |
@@ -203,6 +203,14 @@ char *outputFileName = DISABLED_LOG_OUTPUT;
|
|
|
f9a98e |
/* Path (not necessary absolute) to output file */
|
|
|
f9a98e |
char **reportedCaughExceptionTypes;
|
|
|
f9a98e |
|
|
|
f9a98e |
+/* Determines which resource is used as executable */
|
|
|
f9a98e |
+enum {
|
|
|
f9a98e |
+ ABRT_EXECUTABLE_MAIN = 0,
|
|
|
f9a98e |
+ ABRT_EXECUTABLE_THREAD = 1,
|
|
|
f9a98e |
+};
|
|
|
f9a98e |
+int executableFlags = 0;
|
|
|
f9a98e |
+
|
|
|
f9a98e |
+
|
|
|
f9a98e |
/* Map of buffer for already reported exceptions to prevent re-reporting */
|
|
|
f9a98e |
T_jthreadMap *threadMap;
|
|
|
f9a98e |
|
|
|
f9a98e |
@@ -2121,7 +2129,8 @@ static void JNICALL callback_on_exception(
|
|
|
f9a98e |
updated_exception_name_ptr, class_name_ptr, method_name_ptr);
|
|
|
f9a98e |
|
|
|
f9a98e |
char *executable = NULL;
|
|
|
f9a98e |
- char *stack_trace_str = generate_thread_stack_trace(jvmti_env, jni_env, tname, exception_object, &executable);
|
|
|
f9a98e |
+ char *stack_trace_str = generate_thread_stack_trace(jvmti_env, jni_env, tname, exception_object,
|
|
|
f9a98e |
+ (executableFlags & ABRT_EXECUTABLE_THREAD) ? &executable : NULL);
|
|
|
f9a98e |
|
|
|
f9a98e |
const char *report_message = message;
|
|
|
f9a98e |
if (NULL == report_message)
|
|
|
f9a98e |
@@ -2757,9 +2766,27 @@ void parse_commandline_options(char *options)
|
|
|
f9a98e |
{
|
|
|
f9a98e |
reportedCaughExceptionTypes = build_string_vector(value, ':');
|
|
|
f9a98e |
}
|
|
|
f9a98e |
+ else if (strcmp("executable", key) == 0)
|
|
|
f9a98e |
+ {
|
|
|
f9a98e |
+ if (strcmp("threadclass", value) == 0)
|
|
|
f9a98e |
+ {
|
|
|
f9a98e |
+ VERBOSE_PRINT("Use a thread class for 'executable'\n");
|
|
|
f9a98e |
+ executableFlags |= ABRT_EXECUTABLE_THREAD;
|
|
|
f9a98e |
+ }
|
|
|
f9a98e |
+ else if (strcmp("mainclass", value) == 0)
|
|
|
f9a98e |
+ {
|
|
|
f9a98e |
+ /* Unset ABRT_EXECUTABLE_THREAD bit */
|
|
|
f9a98e |
+ VERBOSE_PRINT("Use the main class for 'executable'\n");
|
|
|
f9a98e |
+ executableFlags &= ~ABRT_EXECUTABLE_THREAD;
|
|
|
f9a98e |
+ }
|
|
|
f9a98e |
+ else
|
|
|
f9a98e |
+ {
|
|
|
f9a98e |
+ fprintf(stderr, "Unknown 'executable' option's value '%s'\n", key);
|
|
|
f9a98e |
+ }
|
|
|
f9a98e |
+ }
|
|
|
f9a98e |
else
|
|
|
f9a98e |
{
|
|
|
f9a98e |
- fprintf(stderr, "Unknow option '%s'\n", key);
|
|
|
f9a98e |
+ fprintf(stderr, "Unknown option '%s'\n", key);
|
|
|
f9a98e |
}
|
|
|
f9a98e |
}
|
|
|
f9a98e |
}
|
|
|
f9a98e |
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
|
|
|
f9a98e |
index 0a73e2b..5267e7b 100644
|
|
|
f9a98e |
--- a/test/CMakeLists.txt
|
|
|
f9a98e |
+++ b/test/CMakeLists.txt
|
|
|
f9a98e |
@@ -150,7 +150,7 @@ _add_test_target(
|
|
|
f9a98e |
run_threads
|
|
|
f9a98e |
MultiThreadTest
|
|
|
f9a98e |
DEPENDS ${TEST_JAVA_TARGETS}
|
|
|
f9a98e |
- AGENT_OPTIONS caught=java.lang.ArrayIndexOutOfBoundsException:java.lang.NullPointerException
|
|
|
f9a98e |
+ AGENT_OPTIONS caught=java.lang.ArrayIndexOutOfBoundsException:java.lang.NullPointerException,executable=threadclass
|
|
|
f9a98e |
)
|
|
|
f9a98e |
_add_test(run_threads 0)
|
|
|
f9a98e |
|
|
|
f9a98e |
@@ -167,6 +167,7 @@ _add_test_target(
|
|
|
f9a98e |
run_bad_class
|
|
|
f9a98e |
BadClassTest
|
|
|
f9a98e |
DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
|
|
|
f9a98e |
+ AGENT_OPTIONS executable=threadclass
|
|
|
f9a98e |
)
|
|
|
f9a98e |
_add_test(run_bad_class 2)
|
|
|
f9a98e |
|
|
|
f9a98e |
@@ -175,6 +176,7 @@ _add_test_target(
|
|
|
f9a98e |
MissingClassTest
|
|
|
f9a98e |
PRE rm -f MissingClassTest.class
|
|
|
f9a98e |
DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
|
|
|
f9a98e |
+ AGENT_OPTIONS executable=threadclass
|
|
|
f9a98e |
)
|
|
|
f9a98e |
_add_test(run_missing_class_test 2)
|
|
|
f9a98e |
|
|
|
f9a98e |
@@ -294,7 +296,7 @@ _add_test_target(
|
|
|
f9a98e |
RemoteTest ${JAR_TEST_PATH} MultiThreadTest
|
|
|
f9a98e |
PRE rm -f SimpleTest.class ThreadCaughtException.class ThreadUncaughtException.class MultiThreadTest.class
|
|
|
f9a98e |
DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
|
|
|
f9a98e |
- AGENT_OPTIONS caught=java.lang.ArrayIndexOutOfBoundsException:java.lang.NullPointerException
|
|
|
f9a98e |
+ AGENT_OPTIONS caught=java.lang.ArrayIndexOutOfBoundsException:java.lang.NullPointerException,executable=threadclass
|
|
|
f9a98e |
)
|
|
|
f9a98e |
_add_test(run_remote_thread 0)
|
|
|
f9a98e |
|
|
|
f9a98e |
--
|
|
|
f9a98e |
1.8.3.1
|
|
|
f9a98e |
|