First vversion of uploader. Only do so when user selected "always" send, as of now there is

no way to ask the user for consent in case they selected "ask before sending".
master
Nicky 2022-02-20 22:34:00 +01:00
parent d4ce6b5ba6
commit 9146e4b8b8
4 changed files with 70 additions and 64 deletions

View File

@ -24,67 +24,66 @@
* $/LicenseInfo$
*/
#include <iostream>
#include <string>
#include <curl/curl.h>
/* Called via
execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), nullptr );
*/
int main(int argc, char **argv)
{
curl_global_init(CURL_GLOBAL_ALL);
std::cerr << "linux crash logger called: ";
for( int i = 1; i < argc; ++i )
std::cerr << argv[i] << " ";
auto curl = curl_easy_init();
if( curl)
{
auto form = curl_mime_init(curl);
auto field = curl_mime_addpart(form);
curl_mime_name(field, "upload_file_minidump");
curl_mime_filedata(field, "minidump.dmp");
std::cerr << std::endl;
field = curl_mime_addpart(form);
curl_mime_name(field, "product");
curl_mime_data(field, "Firestorm-Releasex64", CURL_ZERO_TERMINATED);
field = curl_mime_addpart(form);
curl_mime_name(field, "version");
curl_mime_data(field, "6.4.21.64531", CURL_ZERO_TERMINATED);
curl_easy_setopt(curl, CURLOPT_URL, "https://fs_test.bugsplat.com/post/bp/crash/crashpad.php");
curl_easy_setopt(curl, CURLOPT_MIMEPOST, form);
auto res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
curl_mime_free(form);
}
/*
LL_INFOS() << "Starting crash reporter." << LL_ENDL;
LLCrashLoggerLinux app;
app.parseCommandOptions(argc, argv);
LLSD options = LLApp::instance()->getOptionData(
LLApp::PRIORITY_COMMAND_LINE);
//LLApp::PRIORITY_RUNTIME_OVERRIDE);
if (!(options.has("pid") && options.has("dumpdir")))
if( argc < 4 )
{
LL_WARNS() << "Insufficient parameters to crash report." << LL_ENDL;
std::cerr << argv[0] << "Not enough arguments" << std::endl;
return 1;
}
if (! app.init())
{
LL_WARNS() << "Unable to initialize application." << LL_ENDL;
return 1;
}
std::string dmpFile{ argv[1] };
std::string version{ argv[2] };
std::string strDb{ argv[3] };
app.frame();
app.cleanup();
LL_INFOS() << "Crash reporter finished normally." << LL_ENDL;
*/
return 0;
std::string url{ "https://" };
url += strDb;
url += ".bugsplat.com/post/bp/crash/crashpad.php";
curl_global_init(CURL_GLOBAL_ALL);
auto curl = curl_easy_init();
if( curl)
{
auto form = curl_mime_init(curl);
auto field = curl_mime_addpart(form);
curl_mime_name(field, "upload_file_minidump");
curl_mime_filedata(field, dmpFile.c_str() );
field = curl_mime_addpart(form);
curl_mime_name(field, "product");
curl_mime_data(field, "Firestorm-Releasex64", CURL_ZERO_TERMINATED);
field = curl_mime_addpart(form);
curl_mime_name(field, "version");
curl_mime_data(field, version.c_str(), CURL_ZERO_TERMINATED);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str() );
curl_easy_setopt(curl, CURLOPT_MIMEPOST, form);
auto res = curl_easy_perform(curl);
if(res != CURLE_OK)
std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
curl_easy_cleanup(curl);
curl_mime_free(form);
}
return 0;
}

View File

@ -2573,6 +2573,7 @@ if (NOT ENABLE_MEDIA_PLUGINS)
#media_plugin_gstreamer010
media_plugin_libvlc
llcommon
linux-crash-logger
)
else (NOT ENABLE_MEDIA_PLUGINS)
set(COPY_INPUT_DEPENDENCIES
@ -2582,6 +2583,7 @@ else (NOT ENABLE_MEDIA_PLUGINS)
media_plugin_cef
#media_plugin_gstreamer010
llcommon
linux-crash-logger
)
endif (NOT ENABLE_MEDIA_PLUGINS)

View File

@ -49,6 +49,7 @@
#include "breakpad/client/linux/handler/exception_handler.h"
#include "breakpad/common/linux/http_upload.h"
#include "lldir.h"
#include "../llcrashlogger/llcrashlogger.h"
#endif
#include "fsversionvalues.h"
@ -140,20 +141,21 @@ LLAppViewerLinux::~LLAppViewerLinux()
}
#if LL_SEND_CRASH_REPORTS
std::string gCrashLogger;
std::string gVersion;
std::string gBugsplatDB;
static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
{
printf("Dump path: %s\n", descriptor.path() );
if( fork() == 0 )
execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), nullptr );
return succeeded;
}
#endif
#if LL_SEND_CRASH_REPORTS
void setupBreadpad()
{
std::string build_data_fname(gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json"));
std::string strVersion;
std::string strDB;
gCrashLogger = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "linux-crash-logger.bin");
llifstream inf(build_data_fname.c_str());
if(!inf.is_open())
@ -178,12 +180,13 @@ void setupBreadpad()
<< "'" << LL_ENDL;
return;
}
strVersion = STRINGIZE(
gVersion = STRINGIZE(
LL_VIEWER_VERSION_MAJOR << '.' << LL_VIEWER_VERSION_MINOR << '.' << LL_VIEWER_VERSION_PATCH
<< '.' << LL_VIEWER_VERSION_BUILD);
strDB = BugSplat_DB.asString();
gBugsplatDB = BugSplat_DB.asString();
LL_INFOS("BUGSPLAT") << "Initializing with crash logger: " << gCrashLogger << " database: " << gBugsplatDB << " version: " << gVersion << LL_ENDL;
google_breakpad::MinidumpDescriptor *descriptor = new google_breakpad::MinidumpDescriptor(
gDirUtilp->getExpandedFilename(LL_PATH_DUMP, ""));
google_breakpad::ExceptionHandler *eh = new google_breakpad::ExceptionHandler(*descriptor, NULL, dumpCallback, NULL,
@ -203,8 +206,9 @@ bool LLAppViewerLinux::init()
#if LL_SEND_CRASH_REPORTS
S32 nCrashSubmitBehavior = gCrashSettings.getS32("CrashSubmitBehavior");
// Don't ever send? bail out!
if (success && nCrashSubmitBehavior != 2 /*CRASH_BEHAVIOR_NEVER_SEND*/)
// For the first version we just consider always send and create a nice dialog for CRASH_BEHAVIOR_ASK later.
if (success && nCrashSubmitBehavior == CRASH_BEHAVIOR_ALWAYS_SEND)
setupBreadpad();
#endif

View File

@ -1837,6 +1837,7 @@ class LinuxManifest(ViewerManifest):
self.path("install.sh")
with self.prefix(dst="bin"):
self.path( os.path.join(os.pardir,'build_data.json'), "build_data.json" )
self.path("firestorm-bin","do-not-directly-run-firestorm-bin")
self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin")
self.path2basename("../llplugin/slplugin", "SLPlugin")