summaryrefslogtreecommitdiff
path: root/openvpn/src/openvpn
diff options
context:
space:
mode:
Diffstat (limited to 'openvpn/src/openvpn')
-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
5 files changed, 56 insertions, 5 deletions
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)