diff --git a/buildbot/PackageScript b/buildbot/PackageScript
index 51a511a..9df9552 100644
--- a/buildbot/PackageScript
+++ b/buildbot/PackageScript
@@ -68,6 +68,7 @@ class CopyFile(Command):
folders = [
+ ['addons', 'sourcemod', 'configs'],
['addons', 'sourcemod', 'gamedata'],
['addons', 'sourcemod', 'extensions'],
]
@@ -93,6 +94,18 @@ def AddNormalLibrary(name, dest):
elif AMBuild.target['platform'] == 'windows':
debug_info.append(name + '\\' + name + '.pdb')
+def AddExecutable(name, dest):
+ dest = os.path.join('addons', 'sourcemod', dest)
+ bincopies.append(CopyFile(os.path.join('..', name, name + osutil.ExecutableSuffix()), dest))
+
+ # Each platform's version of dump_syms needs the path in a different format.
+ if AMBuild.target['platform'] == 'linux':
+ debug_info.append(name + '/' + name)
+ elif AMBuild.target['platform'] == 'darwin':
+ debug_info.append(name + '/' + name + '.dSYM')
+ elif AMBuild.target['platform'] == 'windows':
+ debug_info.append(name + '\\' + name + '.pdb')
+
def AddHL2Library(name, dest):
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
@@ -104,6 +117,10 @@ debug_info = []
AddNormalLibrary('accelerator.ext', 'extensions')
+
+if AMBuild.target['platform'] == 'linux':
+ AddExecutable('test-crash-dump-generation', 'configs')
+
job.AddCommandGroup(bincopies)
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt')
diff --git a/test/AMBuilder b/test/AMBuilder
index 3d45319..836d49c 100644
--- a/test/AMBuilder
+++ b/test/AMBuilder
@@ -17,7 +17,7 @@ def BuildEverything():
compiler['POSTLINKFLAGS'].append('-lstdc++')
compiler['POSTLINKFLAGS'].append('-pthread')
- name = 'test'
+ name = 'test-crash-dump-generation'
extension = AMBuild.AddJob(name)
binary = Cpp.ExecutableBuilder(name, AMBuild, extension, compiler)
diff --git a/test/test.cpp b/test/test.cpp
index b31e8a7..cff6310 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -1,23 +1,3 @@
-/*
- * =============================================================================
- * Accelerator Extension
- * Copyright (C) 2011 Asher Baker (asherkin). All rights reserved.
- * =============================================================================
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 3.0, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- */
-
-#if defined _LINUX
#include "client/linux/handler/exception_handler.h"
#include "common/linux/linux_libc_support.h"
#include "third_party/lss/linux_syscall_support.h"
@@ -25,19 +5,8 @@
#include
#include
#include
-#elif defined _WINDOWS
-#define _STDINT // ~.~
-#include "client/windows/handler/exception_handler.h"
-#else
-#error Bad platform.
-#endif
-char dumpStoragePath[512] = ".";
-
-google_breakpad::ExceptionHandler *handler = NULL;
-
-#if defined _LINUX
-static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
+static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded)
{
if (succeeded) {
sys_write(STDOUT_FILENO, "Wrote minidump to: ", 19);
@@ -50,50 +19,16 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
return succeeded;
}
-#elif defined _WINDOWS
-static bool dumpCallback(const wchar_t* dump_path,
- const wchar_t* minidump_id,
- void* context,
- EXCEPTION_POINTERS* exinfo,
- MDRawAssertionInfo* assertion,
- bool succeeded)
-{
- if (!succeeded) {
- printf("Failed to write minidump to: %ls\\%ls.dmp\n", dump_path, minidump_id);
- return succeeded;
- }
-
- printf("Wrote minidump to: %ls\\%ls.dmp\n", dump_path, minidump_id);
-
- return succeeded;
-}
-#else
-#error Bad platform.
-#endif
int main(int argc, char *argv[])
{
-#if defined _LINUX
- google_breakpad::MinidumpDescriptor descriptor(dumpStoragePath);
- handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1);
-#elif defined _WINDOWS
- wchar_t *buf = new wchar_t[sizeof(dumpStoragePath)];
- size_t num_chars = mbstowcs(buf, dumpStoragePath, sizeof(dumpStoragePath));
-
- handler = new google_breakpad::ExceptionHandler(std::wstring(buf, num_chars), NULL, dumpCallback, NULL, google_breakpad::ExceptionHandler::HANDLER_ALL);
-
- delete buf;
-#else
-#error Bad platform.
-#endif
+ google_breakpad::MinidumpDescriptor descriptor(".");
+ google_breakpad::ExceptionHandler *handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1);
// Test shit here.
-
- volatile int *a = nullptr;
- *a = 0xDEADBEEF;
+ __builtin_trap();
delete handler;
-
return 0;
}