Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>cd1f1d55a2488657ec2253774b3a414621f81b24</string>
<string>9bcafdd7e1df6b92096fa850627d4f3437630d4a</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-1.1.1-9599607655-darwin64-9599607655.tar.zst</string>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-1.2.6-19430122611-darwin64-19430122611.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
Expand All @@ -180,11 +180,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>9fb0615d17988bd89a2e5ae6d4d19e150afb54a9</string>
<string>4e9f0c1cdbc1cebf6185ecc45228ced7f9af1532</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.1.5-71fc41e/bugsplat-5.0.1.0-9599607655-windows64-9599607655.tar.zst</string>
<string>https://github.com/secondlife/3p-bugsplat/releases/download/v1.2.6-a475cbb/bugsplat-6.1.1.0-19430122611-windows64-19430122611.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
Expand Down
6 changes: 6 additions & 0 deletions indra/cmake/bugsplat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ if (USE_BUGSPLAT)
elseif (DARWIN)
find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
find_library(CRASHREPORTED_LIBRARIES CrashReporter REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
find_library(HOCKEYSDK_LIBRARIES HockeySDK REQUIRED
NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}")
target_link_libraries( ll::bugsplat INTERFACE
${BUGSPLAT_LIBRARIES}
${CRASHREPORTED_LIBRARIES}
${HOCKEYSDK_LIBRARIES}
)
else (WINDOWS)
message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF")
Expand Down
11 changes: 6 additions & 5 deletions indra/llwindow/llappdelegate-objc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@
std::string secondLogPath;
}

@property (assign) IBOutlet LLNSWindow *window;
@property (assign) IBOutlet NSWindow *inputWindow;
@property (assign) IBOutlet LLNonInlineTextView *inputView;
@property (assign) IBOutlet LLNSWindow * _Nullable window;
@property (assign) IBOutlet NSWindow * _Nullable inputWindow;
@property (assign) IBOutlet LLNonInlineTextView * _Nullable inputView;

@property (retain) NSString *currentInputLanguage;
@property (retain) NSString * _Nullable currentInputLanguage;

- (void) oneFrame;
- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent;
- (void) showInputWindow:(bool)show withEvent:(nullable NSEvent *)textEvent;
- (void) languageUpdated;
- (bool) romanScript;
- (void) setBugsplatValue:(nullable NSString *)value forAttribute:(nullable NSString *)attribute;
@end

@interface LLApplication : NSApplication
Expand Down
130 changes: 76 additions & 54 deletions indra/newview/llappdelegate-objc.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
#if defined(LL_BUGSPLAT)
#include <boost/filesystem.hpp>
#include <vector>
@import BugsplatMac;
@import CrashReporter;
@import HockeySDK;
@import BugSplatMac;
// derived from BugsplatMac's BugsplatTester/AppDelegate.m
@interface LLAppDelegate () <BugsplatStartupManagerDelegate>
@interface LLAppDelegate () <BugSplatDelegate>
@end
#endif
#include "llwindowmacosx-objc.h"
Expand Down Expand Up @@ -68,13 +70,22 @@ - (void) applicationDidFinishLaunching:(NSNotification *)notification

#if defined(LL_BUGSPLAT)
infos("bugsplat setup");
// Engage BugsplatStartupManager *before* calling initViewer() to handle
// Engage BugSplat *before* calling initViewer() to handle
// any crashes during initialization.
// https://www.bugsplat.com/docs/platforms/os-x#initialization
[BugsplatStartupManager sharedManager].autoSubmitCrashReport = YES;
[BugsplatStartupManager sharedManager].askUserDetails = NO;
[BugsplatStartupManager sharedManager].delegate = self;
[[BugsplatStartupManager sharedManager] start];

// Initialize BugSplat
[[BugSplat shared] setDelegate:self];
[[BugSplat shared] setAutoSubmitCrashReport:YES];
[[BugSplat shared] setPersistUserDetails:NO];
[[BugSplat shared] setAskUserDetails:NO];
[BugSplat shared].expirationTimeInterval = 0;
[[BugSplat shared] start];

// Optionally, add some attributes to your crash reports.
// Attributes are artibrary key/value pairs that are searchable in the BugSplat dashboard.
// [[BugSplat shared] setValue:@"Value of Plain Attribute" forAttribute:@"PlainAttribute"];

#endif
infos("post-bugsplat setup");

Expand Down Expand Up @@ -213,9 +224,52 @@ - (bool) romanScript
return true;
}

- (void) setBugsplatValue:(nullable NSString *)value forAttribute:(NSString *)attribute
{
//[[BugSplat shared] setValue:@"Value of not so plain <value> Attribute" forAttribute:@"NotSoPlainAttribute"];
[[BugSplat shared] setValue:value forAttribute:attribute];
}

#if defined(LL_BUGSPLAT)

- (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager
- (void)bugSplatWillSendCrashReport:(BugSplat *)bugSplat
{
infos("bugSplatWillSendCrashReport");
}

- (void)bugSplatWillSendCrashReportsAlways:(BugSplat *)bugSplat
{
infos("bugSplatWillSendCrashReportsAlways");
}

- (void)bugSplatDidFinishSendingCrashReport:(BugSplat *)bugSplat
{
infos("bugSplatDidFinishSendingCrashReport");

if(!secondLogPath.empty())
{
boost::filesystem::remove(secondLogPath);
}
clearDumpLogsDir();
}

- (void)bugSplatWillCancelSendingCrashReport:(BugSplat *)bugSplat
{
infos("bugSplatWillCancelSendingCrashReport");
}

- (void)bugSplatWillShowSubmitCrashReportAlert:(BugSplat *)bugSplat
{
infos("bugSplatWillShowSubmitCrashReportAlert");
}

- (void)bugSplat:(BugSplat *)bugSplat didFailWithError:(NSError *)error
{
std::string error_str([[error localizedDescription] UTF8String]);
infos("bugSplat:didFailWithError: " + error_str);
}

- (NSString *)applicationLogForBugSplat:(BugSplat *)bugSplat;
{
CrashMetadata& meta(CrashMetadata_instance());
// As of BugsplatMac 1.0.6, userName and userEmail properties are now
Expand All @@ -226,24 +280,30 @@ - (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *)
// report we are about to send.
infos("applicationLogForBugsplatStartupManager setting userName = '" +
meta.agentFullname + '"');
bugsplatStartupManager.userName =
bugSplat.userName =
[NSString stringWithCString:meta.agentFullname.c_str()
encoding:NSUTF8StringEncoding];
// Use the email field for OS version, just as we do on Windows, until
// BugSplat provides more metadata fields.
infos("applicationLogForBugsplatStartupManager setting userEmail = '" +
meta.OSInfo + '"');
bugsplatStartupManager.userEmail =
bugSplat.userEmail =
[NSString stringWithCString:meta.OSInfo.c_str()
encoding:NSUTF8StringEncoding];

//bugSplat.userID =
// [NSString stringWithCString:meta.regionName.c_str()
// encoding:NSUTF8StringEncoding];

// This strangely-named override method's return value contributes the
// User Description metadata field.
infos("applicationLogForBugsplatStartupManager -> '" + meta.fatalMessage + "'");
return [NSString stringWithCString:meta.fatalMessage.c_str()
encoding:NSUTF8StringEncoding];
}

- (NSString *)applicationKeyForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager signal:(NSString *)signal exceptionName:(NSString *)exceptionName exceptionReason:(NSString *)exceptionReason {
- (NSString *)applicationKeyForBugSplat:(BugSplat *)bugSplat signal:(NSString *)signal exceptionName:(NSString *)exceptionName exceptionReason:(NSString *)exceptionReason
{
// TODO: exceptionName, exceptionReason

// Windows sends location within region as well, but that's because
Expand All @@ -258,27 +318,6 @@ - (NSString *)applicationKeyForBugsplatStartupManager:(BugsplatStartupManager *)
encoding:NSUTF8StringEncoding];
}

- (NSString *)defaultUserNameForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager {
std::string agentFullname(CrashMetadata_instance().agentFullname);
infos("defaultUserNameForBugsplatStartupManager -> '" + agentFullname + "'");
return [NSString stringWithCString:agentFullname.c_str()
encoding:NSUTF8StringEncoding];
}

- (NSString *)defaultUserEmailForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager {
// Use the email field for OS version, just as we do on Windows, until
// BugSplat provides more metadata fields.
std::string OSInfo(CrashMetadata_instance().OSInfo);
infos("defaultUserEmailForBugsplatStartupManager -> '" + OSInfo + "'");
return [NSString stringWithCString:OSInfo.c_str()
encoding:NSUTF8StringEncoding];
}

- (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugsplatStartupManager
{
infos("bugsplatStartupManagerWillSendCrashReport");
}

struct AttachmentInfo
{
AttachmentInfo(const std::string& path, const std::string& type):
Expand All @@ -290,7 +329,7 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs
std::string pathname, basename, mimetype;
};

- (NSArray<BugsplatAttachment *> *)attachmentsForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager
- (NSArray<BugSplatAttachment *> *)attachmentsForBugSplat:(BugSplat *)bugSplat
{
const CrashMetadata& metadata(CrashMetadata_instance());

Expand All @@ -311,12 +350,12 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs
info.push_back(AttachmentInfo(secondLogPath, "text/xml"));
}

// We "happen to know" that info[0].basename is "SecondLife.old" -- due to
// We "happen to know" that info[0].basename is "SecondLife.crash" -- due to
// the fact that BugsplatMac only notices a crash during the viewer run
// following the crash.
// The Bugsplat service doesn't respect the MIME type above when returning
// the log data to a browser, so take this opportunity to rename the file
// from <base>.old to <base>_log.txt
// from <base>.crash to <base>_log.txt
info[0].basename =
boost::filesystem::path(info[0].pathname).stem().string() + "_log.txt";
infos("attachmentsForBugsplatStartupManager attaching log " + info[0].basename);
Expand All @@ -334,8 +373,8 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs
encoding:NSUTF8StringEncoding];
NSData *nsdata = [NSData dataWithContentsOfFile:nspathname];

BugsplatAttachment *attachment =
[[BugsplatAttachment alloc] initWithFilename:nsbasename
BugSplatAttachment *attachment =
[[BugSplatAttachment alloc] initWithFilename:nsbasename
attachmentData:nsdata
contentType:nsmimetype];

Expand All @@ -346,23 +385,6 @@ - (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugs
return attachments;
}

- (void)bugsplatStartupManagerDidFinishSendingCrashReport:(BugsplatStartupManager *)bugsplatStartupManager
{
infos("Sent crash report to BugSplat");

if(!secondLogPath.empty())
{
boost::filesystem::remove(secondLogPath);
}
clearDumpLogsDir();
}

- (void)bugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager didFailWithError:(NSError *)error
{
// TODO: message string from NSError
infos("Could not send crash report to BugSplat");
}

#endif // LL_BUGSPLAT

@end
Expand Down
25 changes: 23 additions & 2 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3622,10 +3622,15 @@ void LLAppViewer::writeSystemInfo()
if (! gDebugInfo.has("Dynamic") )
gDebugInfo["Dynamic"] = LLSD::emptyMap();

#if LL_WINDOWS && !LL_BUGSPLAT
#if LL_DARWIN
// crash processing in CrashMetadataSingleton reads SLLog
gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.crash");
#elif LL_WINDOWS && !LL_BUGSPLAT
gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log");
#else
//Not ideal but sufficient for good reporting.
// Far from ideal, especially when multiple instances get involved.
// Note that attachmentsForBugSplat expects .old extendion.
// Todo: improve.
gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.old"); //LLError::logFileName();
#endif

Expand Down Expand Up @@ -4032,6 +4037,22 @@ void LLAppViewer::processMarkerFiles()
}
LLAPRFile::remove(error_marker_file);
}

#if LL_DARWIN
if (!mSecondInstance && gLastExecEvent != LAST_EXEC_NORMAL)
{
// While windows reports crashes immediately, mac reports next run and
// may take a while to trigger crash report so it has a special file.
// Remove .crash file if exists
std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
"SecondLife.old");
std::string crash_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
"SecondLife.crash");
LLFile::remove(crash_log_file);
// Rename ".old" log file to ".crash"
LLFile::rename(old_log_file, crash_log_file);
}
#endif
}

void LLAppViewer::removeMarkerFiles()
Expand Down
25 changes: 22 additions & 3 deletions indra/newview/viewer_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,12 @@ def construct(self):
with self.prefix(src="", dst="Contents"): # everything goes in Contents
bugsplat_db = self.args.get('bugsplat')
if bugsplat_db:
# Inject BugsplatServerURL into Info.plist if provided.
# Inject Bugsplat's db into Info.plist if provided.
Info_plist = self.dst_path_of("Info.plist")
with open(Info_plist, 'rb') as f:
Info = plistlib.load(f)
# https://www.bugsplat.com/docs/platforms/os-x#configuration
Info["BugsplatServerURL"] = \
"https://{}.bugsplat.com/".format(bugsplat_db)
Info["BugSplatDatabase"] = bugsplat_db
self.put_in_file(
plistlib.dumps(Info),
os.path.basename(Info_plist),
Expand All @@ -881,6 +880,8 @@ def construct(self):

if self.args.get('bugsplat'):
self.path2basename(relpkgdir, "BugsplatMac.framework")
self.path2basename(relpkgdir, "CrashReporter.framework")
self.path2basename(relpkgdir, "HockeySDK.framework")

# OpenAL dylibs
if self.args['openal'] == 'ON':
Expand Down Expand Up @@ -918,6 +919,24 @@ def construct(self):
# stamped into the framework.
# Let exception, if any, propagate -- if this doesn't
# work, we need the build to noisily fail!
oldpath = subprocess.check_output(
['objdump', '--macho', '--dylib-id', '--non-verbose',
os.path.join(relpkgdir, "HockeySDK.framework", "HockeySDK")],
text=True
).splitlines()[-1] # take the last line of output
self.run_command(
['install_name_tool', '-change', oldpath,
'@executable_path/../Frameworks/HockeySDK.framework/HockeySDK',
executable])
oldpath = subprocess.check_output(
['objdump', '--macho', '--dylib-id', '--non-verbose',
os.path.join(relpkgdir, "CrashReporter.framework", "CrashReporter")],
text=True
).splitlines()[-1] # take the last line of output
self.run_command(
['install_name_tool', '-change', oldpath,
'@executable_path/../Frameworks/CrashReporter.framework/CrashReporter',
executable])
oldpath = subprocess.check_output(
['objdump', '--macho', '--dylib-id', '--non-verbose',
os.path.join(relpkgdir, "BugsplatMac.framework", "BugsplatMac")],
Expand Down
Loading