Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / toolkit / crashreporter / mac_utils.mm
blobdfceb1013f8007825155cd13b93b25910e012758
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include <Foundation/Foundation.h>
8 #include "mac_utils.h"
9 #include "nsXPCOM.h"
10 #include "mozilla/MacStringHelpers.h"
11 #include "mozilla/Unused.h"
13 void GetObjCExceptionInfo(void* inException, nsACString& outString) {
14   NSException* e = (NSException*)inException;
16   NSString* name = [e name];
17   NSString* reason = [e reason];
18   NSArray* stackAddresses = [e callStackReturnAddresses];
20   outString.AssignLiteral("\nObj-C Exception data:\n");
21   outString.Append([name UTF8String]);
22   outString.AppendLiteral(": ");
23   outString.Append([reason UTF8String]);
24   outString.AppendLiteral("\n\nThrown at stack:\n");
25   for (NSNumber* address in stackAddresses) {
26     outString.AppendPrintf("0x%lx\n", [address unsignedIntegerValue]);
27   }
28   outString.AppendLiteral("\n");