summaryrefslogtreecommitdiff
path: root/openvpn
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-24 07:47:50 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-24 07:47:50 +0100
commit3dbb55fe35b12e5fcbf38e7ecf8de043b16327de (patch)
tree31606652e4f498a74912edc9727635fb13a9b035 /openvpn
parent174a0c8a3807df22ebd5731e139c0f0bb511f85b (diff)
Make send mini dump work with non Gmail Mail app, make google sending better placed
Diffstat (limited to 'openvpn')
-rw-r--r--openvpn/Android.mk2
-rw-r--r--openvpn/src/openvpn/breakpad.cpp29
-rw-r--r--openvpn/src/openvpn/breakpad.h13
-rw-r--r--openvpn/src/openvpn/error.c7
-rw-r--r--openvpn/src/openvpn/openvpn.c10
-rw-r--r--openvpn/src/openvpn/socket.c2
6 files changed, 57 insertions, 6 deletions
diff --git a/openvpn/Android.mk b/openvpn/Android.mk
index 6307e5e0..c68bcccf 100644
--- a/openvpn/Android.mk
+++ b/openvpn/Android.mk
@@ -91,7 +91,7 @@ LOCAL_SRC_FILES:= \
src/openvpn/status.c \
src/openvpn/tun.c
ifneq ($(TARGET_ARCH),mips)
-LOCAL_SRC_FILES+=../jni/icsandroid.cpp
+LOCAL_SRC_FILES+=src/openvpn/breakpad.cpp
endif
diff --git a/openvpn/src/openvpn/breakpad.cpp b/openvpn/src/openvpn/breakpad.cpp
new file mode 100644
index 00000000..cfcc10a8
--- /dev/null
+++ b/openvpn/src/openvpn/breakpad.cpp
@@ -0,0 +1,29 @@
+
+#include "breakpad.h"
+#include "client/linux/handler/exception_handler.h"
+
+
+static
+bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
+ void* context,
+ bool succeeded) {
+ printf("Dump path: %s\n", descriptor.path());
+ fflush(stdout);
+ fflush(stderr);
+ return succeeded;
+}
+
+static google_breakpad::MinidumpDescriptor* desc;
+static google_breakpad::ExceptionHandler* eh;
+
+void breakpad_setup(void)
+{
+ printf("Initializing Google Breakpad!\n");
+ desc = new google_breakpad::MinidumpDescriptor("/data/data/de.blinkt.openvpn/cache");
+ eh = new google_breakpad::ExceptionHandler(*desc, NULL, DumpCallback, NULL, true,-1);
+}
+
+void breakpad_dodump(void)
+{
+ eh->WriteMinidump();
+}
diff --git a/openvpn/src/openvpn/breakpad.h b/openvpn/src/openvpn/breakpad.h
new file mode 100644
index 00000000..84df62ab
--- /dev/null
+++ b/openvpn/src/openvpn/breakpad.h
@@ -0,0 +1,13 @@
+#ifndef BUFFER_H
+#define BUFFER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void breakpad_setup(void);
+ void breakpad_dodump(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/openvpn/src/openvpn/error.c b/openvpn/src/openvpn/error.c
index ebe9a52d..98611a1b 100644
--- a/openvpn/src/openvpn/error.c
+++ b/openvpn/src/openvpn/error.c
@@ -57,6 +57,10 @@
#endif
#endif
+#ifdef GOOGLE_BREAKPAD
+#include "breakpad.h"
+#endif
+
/* Globals */
unsigned int x_debug_level; /* GLOBAL */
@@ -399,6 +403,9 @@ dont_mute (unsigned int flags)
void
assert_failed (const char *filename, int line)
{
+#ifdef GOOGLE_BREAKPAD
+ breakpad_dodump();
+#endif
msg (M_FATAL, "Assertion failed at %s:%d", filename, line);
}
diff --git a/openvpn/src/openvpn/openvpn.c b/openvpn/src/openvpn/openvpn.c
index 4bae5274..a177d9e8 100644
--- a/openvpn/src/openvpn/openvpn.c
+++ b/openvpn/src/openvpn/openvpn.c
@@ -41,6 +41,10 @@
#define P2P_CHECK_SIG() EVENT_LOOP_CHECK_SIGNAL (c, process_signal_p2p, c);
+#ifdef GOOGLE_BREAKPAD
+#include "breakpad.h"
+#endif
+
static bool
process_signal_p2p (struct context *c)
{
@@ -321,12 +325,10 @@ wmain (int argc, wchar_t *wargv[]) {
#else
int
main (int argc, char *argv[]) {
-#ifdef TARGET_ANDROID
#ifdef GOOGLE_BREAKPAD
-#include "../jni/icsandroid.h"
- setup_breakpad();
-#endif
+ breakpad_setup();
#endif
+
return openvpn_main(argc, argv);
}
#endif
diff --git a/openvpn/src/openvpn/socket.c b/openvpn/src/openvpn/socket.c
index 29a15a63..9a33197c 100644
--- a/openvpn/src/openvpn/socket.c
+++ b/openvpn/src/openvpn/socket.c
@@ -1255,7 +1255,7 @@ resolve_remote (struct link_socket *sock,
if (remote_dynamic)
*remote_dynamic = NULL;
}
- else
+ /* else, quick hack to fix persistent-remote ....*/
{
CLEAR (sock->info.lsa->actual);
if(sock->info.lsa->current_remote)