2 * Copyright (c) 2007 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 /***********************************************************************
26 * OS portability layer.
27 **********************************************************************/
29 #include "objc-private.h"
30 #include "objc-loadmethod.h"
34 #include "objc-runtime-old.h"
37 int monitor_init(monitor_t *c)
39 // fixme error checking
40 HANDLE mutex = CreateMutex(NULL, TRUE, NULL);
42 // fixme memory barrier here?
43 if (0 == InterlockedCompareExchangePointer(&c->mutex, mutex, 0)) {
44 // we win - finish construction
45 c->waiters = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
46 c->waitersDone = CreateEvent(NULL, FALSE, FALSE, NULL);
47 InitializeCriticalSection(&c->waitCountLock);
50 ReleaseMutex(c->mutex);
55 // someone else allocated the mutex and constructed the monitor
61 void mutex_init(mutex_t *m)
64 CRITICAL_SECTION *newlock = malloc(sizeof(CRITICAL_SECTION));
65 InitializeCriticalSection(newlock);
66 // fixme memory barrier here?
67 if (0 == InterlockedCompareExchangePointer(&m->lock, newlock, 0)) {
70 // someone else installed their lock first
71 DeleteCriticalSection(newlock);
77 void recursive_mutex_init(recursive_mutex_t *m)
79 // fixme error checking
80 HANDLE newmutex = CreateMutex(NULL, FALSE, NULL);
82 // fixme memory barrier here?
83 if (0 == InterlockedCompareExchangePointer(&m->mutex, newmutex, 0)) {
89 // someone else installed their lock first
90 CloseHandle(newmutex);
94 WINBOOL APIENTRY DllMain( HMODULE hModule,
95 DWORD ul_reason_for_call,
99 switch (ul_reason_for_call) {
100 case DLL_PROCESS_ATTACH:
104 sel_init(NO, 3500); // old selector heuristic
108 case DLL_THREAD_ATTACH:
111 case DLL_THREAD_DETACH:
112 case DLL_PROCESS_DETACH:
118 OBJC_EXPORT void *_objc_init_image(HMODULE image, const objc_sections *sects)
120 header_info *hi = malloc(sizeof(header_info));
123 hi->mhdr = (const headerType *)image;
124 hi->info = sects->iiStart;
125 hi->allClassesRealized = NO;
126 hi->modules = sects->modStart ? (Module *)((void **)sects->modStart+1) : 0;
127 hi->moduleCount = (Module *)sects->modEnd - hi->modules;
128 hi->protocols = sects->protoStart ? (struct old_protocol **)((void **)sects->protoStart+1) : 0;
129 hi->protocolCount = (struct old_protocol **)sects->protoEnd - hi->protocols;
130 hi->imageinfo = NULL;
131 hi->imageinfoBytes = 0;
132 // hi->imageinfo = sects->iiStart ? (uint8_t *)((void **)sects->iiStart+1) : 0;;
133 // hi->imageinfoBytes = (uint8_t *)sects->iiEnd - hi->imageinfo;
134 hi->selrefs = sects->selrefsStart ? (SEL *)((void **)sects->selrefsStart+1) : 0;
135 hi->selrefCount = (SEL *)sects->selrefsEnd - hi->selrefs;
136 hi->clsrefs = sects->clsrefsStart ? (Class *)((void **)sects->clsrefsStart+1) : 0;
137 hi->clsrefCount = (Class *)sects->clsrefsEnd - hi->clsrefs;
140 for (i = 0; i < hi->moduleCount; i++) {
141 if (hi->modules[i]) count++;
146 hi->mod_ptr = malloc(count * sizeof(struct objc_module));
147 for (i = 0; i < hi->moduleCount; i++) {
148 if (hi->modules[i]) memcpy(&hi->mod_ptr[hi->mod_count++], hi->modules[i], sizeof(struct objc_module));
152 hi->moduleName = malloc(MAX_PATH * sizeof(TCHAR));
153 GetModuleFileName((HMODULE)(hi->mhdr), hi->moduleName, MAX_PATH * sizeof(TCHAR));
158 _objc_inform("IMAGES: loading image for %s%s%s\n",
160 headerIsBundle(hi) ? " (bundle)" : "",
161 _objcHeaderIsReplacement(hi) ? " (replacement)":"");
164 _read_images(&hi, 1);
169 OBJC_EXPORT void _objc_load_image(HMODULE image, header_info *hinfo)
171 prepare_load_methods(hinfo);
175 OBJC_EXPORT void _objc_unload_image(HMODULE image, header_info *hinfo)
177 _objc_fatal("image unload not supported");
181 bool crashlog_header_name(header_info *hi)
190 #include "objc-file-old.h"
191 #include "objc-file.h"
194 /***********************************************************************
196 * Return YES if the header has invalid Mach-o magic.
197 **********************************************************************/
198 bool bad_magic(const headerType *mhdr)
200 return (mhdr->magic != MH_MAGIC && mhdr->magic != MH_MAGIC_64 &&
201 mhdr->magic != MH_CIGAM && mhdr->magic != MH_CIGAM_64);
205 static header_info * addHeader(const headerType *mhdr)
209 if (bad_magic(mhdr)) return NULL;
212 // Look for hinfo from the dyld shared cache.
213 hi = preoptimizedHinfoForHeader(mhdr);
215 // Found an hinfo in the dyld shared cache.
217 // Weed out duplicates.
222 // Initialize fields not set by the shared cache
223 // hi->next is set by appendHeader
224 hi->fname = dyld_image_path_containing_address(hi->mhdr);
226 hi->inSharedCache = true;
229 _objc_inform("PREOPTIMIZATION: honoring preoptimized header info at %p for %s", hi, hi->fname);
234 size_t info_size = 0;
235 const objc_image_info *image_info = _getObjcImageInfo(mhdr,&info_size);
236 assert(image_info == hi->info);
242 // Didn't find an hinfo in the dyld shared cache.
244 // Weed out duplicates
245 for (hi = FirstHeader; hi; hi = hi->next) {
246 if (mhdr == hi->mhdr) return NULL;
249 // Locate the __OBJC segment
250 size_t info_size = 0;
251 unsigned long seg_size;
252 const objc_image_info *image_info = _getObjcImageInfo(mhdr,&info_size);
253 const uint8_t *objc_segment = getsegmentdata(mhdr,SEG_OBJC,&seg_size);
254 if (!objc_segment && !image_info) return NULL;
256 // Allocate a header_info entry.
257 hi = (header_info *)calloc(sizeof(header_info), 1);
259 // Set up the new header_info entry.
262 // mhdr must already be set
264 hi->mod_ptr = _getObjcModules(hi, &hi->mod_count);
266 hi->info = image_info;
267 hi->fname = dyld_image_path_containing_address(hi->mhdr);
269 hi->inSharedCache = false;
270 hi->allClassesRealized = NO;
273 // dylibs are not allowed to unload
274 // ...except those with image_info and nothing else (5359412)
275 if (hi->mhdr->filetype == MH_DYLIB && _hasObjcContents(hi)) {
276 dlopen(hi->fname, RTLD_NOLOAD);
287 const char *_gcForHInfo(const header_info *hinfo)
291 const char *_gcForHInfo2(const header_info *hinfo)
298 /***********************************************************************
300 **********************************************************************/
301 const char *_gcForHInfo(const header_info *hinfo)
303 if (_objcHeaderRequiresGC(hinfo)) {
304 return "requires GC";
305 } else if (_objcHeaderSupportsGC(hinfo)) {
306 return "supports GC";
308 return "does not support GC";
311 const char *_gcForHInfo2(const header_info *hinfo)
313 if (_objcHeaderRequiresGC(hinfo)) {
314 return "(requires GC)";
315 } else if (_objcHeaderSupportsGC(hinfo)) {
316 return "(supports GC)";
322 /***********************************************************************
324 * Returns true if the image links directly to a dylib whose install name
325 * is exactly the given name.
326 **********************************************************************/
328 linksToLibrary(const header_info *hi, const char *name)
330 const struct dylib_command *cmd;
333 cmd = (const struct dylib_command *) (hi->mhdr + 1);
334 for (i = 0; i < hi->mhdr->ncmds; i++) {
335 if (cmd->cmd == LC_LOAD_DYLIB || cmd->cmd == LC_LOAD_UPWARD_DYLIB ||
336 cmd->cmd == LC_LOAD_WEAK_DYLIB || cmd->cmd == LC_REEXPORT_DYLIB)
338 const char *dylib = cmd->dylib.name.offset + (const char *)cmd;
339 if (0 == strcmp(dylib, name)) return true;
341 cmd = (const struct dylib_command *)((char *)cmd + cmd->cmdsize);
348 /***********************************************************************
350 * Check whether the executable supports or requires GC, and make sure
351 * all already-loaded libraries support the executable's GC mode.
352 * Returns TRUE if the executable wants GC on.
353 **********************************************************************/
354 static void check_wants_gc(bool *appWantsGC)
356 const header_info *hi;
358 // Environment variables can override the following.
360 _objc_inform_on_crash("GC: forcing GC OFF because OBJC_DISABLE_GC is set");
364 // Find the executable and check its GC bits.
365 // If the executable cannot be found, default to NO.
366 // (The executable will not be found if the executable contains
367 // no Objective-C code.)
369 for (hi = FirstHeader; hi != NULL; hi = hi->next) {
370 if (hi->mhdr->filetype == MH_EXECUTE) {
371 *appWantsGC = _objcHeaderSupportsGC(hi);
374 _objc_inform("GC: executable '%s' %s",
375 hi->fname, _gcForHInfo(hi));
379 // Exception: AppleScriptObjC apps run without GC in 10.9+
380 // 1. executable defines no classes
381 // 2. executable references NSBundle only
382 // 3. executable links to AppleScriptObjC.framework
383 size_t classcount = 0;
386 _getObjc2ClassList(hi, &classcount);
387 _getObjc2ClassRefs(hi, &refcount);
389 if (hi->mod_count == 0 || (hi->mod_count == 1 && !hi->mod_ptr[0].symtab)) classcount = 0;
391 _getObjcClassRefs(hi, &refcount);
393 if (classcount == 0 && refcount == 1 &&
394 linksToLibrary(hi, "/System/Library/Frameworks"
395 "/AppleScriptObjC.framework/Versions/A"
400 _objc_inform("GC: forcing GC OFF because this is "
401 "a trivial AppleScriptObjC app");
411 /***********************************************************************
412 * verify_gc_readiness
413 * if we want gc, verify that every header describes files compiled
414 * and presumably ready for gc.
415 ************************************************************************/
416 static void verify_gc_readiness(bool wantsGC,
417 header_info **hList, uint32_t hCount)
422 // Find the libraries and check their GC bits against the app's request
423 for (i = 0; i < hCount; i++) {
424 header_info *hi = hList[i];
425 if (hi->mhdr->filetype == MH_EXECUTE) {
428 else if (hi->mhdr == &_mh_dylib_header) {
429 // libobjc itself works with anything even though it is not
430 // compiled with -fobjc-gc (fixme should it be?)
432 else if (wantsGC && ! _objcHeaderSupportsGC(hi)) {
433 // App wants GC but library does not support it - bad
434 _objc_inform_now_and_on_crash
435 ("'%s' was not compiled with -fobjc-gc or -fobjc-gc-only, "
436 "but the application requires GC",
440 else if (!wantsGC && _objcHeaderRequiresGC(hi)) {
441 // App doesn't want GC but library requires it - bad
442 _objc_inform_now_and_on_crash
443 ("'%s' was compiled with -fobjc-gc-only, "
444 "but the application does not support GC",
450 _objc_inform("GC: library '%s' %s",
451 hi->fname, _gcForHInfo(hi));
456 // GC state is not consistent.
457 // Kill the process unless one of the forcing flags is set.
459 _objc_fatal("*** GC capability of application and some libraries did not match");
465 /***********************************************************************
467 * Make sure that images about to be loaded by dyld are GC-acceptable.
468 * Images linked to the executable are always permitted; they are
469 * enforced inside map_images() itself.
470 **********************************************************************/
471 static bool InitialDyldRegistration = NO;
472 static const char *gc_enforcer(enum dyld_image_states state,
474 const struct dyld_image_info info[])
478 // Linked images get a free pass
479 if (InitialDyldRegistration) return NULL;
482 _objc_inform("IMAGES: checking %d images for compatibility...",
486 for (i = 0; i < infoCount; i++) {
487 crashlog_header_name_string(info[i].imageFilePath);
489 const headerType *mhdr = (const headerType *)info[i].imageLoadAddress;
490 if (bad_magic(mhdr)) continue;
492 objc_image_info *image_info;
495 if (mhdr == &_mh_dylib_header) {
496 // libobjc itself - OK
501 unsigned long seg_size;
502 // 32-bit: __OBJC seg but no image_info means no GC support
503 if (!getsegmentdata(mhdr, "__OBJC", &seg_size)) {
504 // not objc - assume OK
507 image_info = _getObjcImageInfo(mhdr, &size);
509 // No image_info - assume GC unsupported
515 if (PrintImages || PrintGC) {
516 _objc_inform("IMAGES: rejecting %d images because %s doesn't support GC (no image_info)", infoCount, info[i].imageFilePath);
522 // 64-bit: no image_info means no objc at all
523 image_info = _getObjcImageInfo(mhdr, &size);
525 // not objc - assume OK
530 if (UseGC && !_objcInfoSupportsGC(image_info)) {
531 // GC is ON, but image does not support GC
532 if (PrintImages || PrintGC) {
533 _objc_inform("IMAGES: rejecting %d images because %s doesn't support GC", infoCount, info[i].imageFilePath);
537 if (!UseGC && _objcInfoRequiresGC(image_info)) {
538 // GC is OFF, but image requires GC
539 if (PrintImages || PrintGC) {
540 _objc_inform("IMAGES: rejecting %d images because %s requires GC", infoCount, info[i].imageFilePath);
546 crashlog_header_name_string(NULL);
550 crashlog_header_name_string(NULL);
551 return "GC capability mismatch";
558 /***********************************************************************
560 * Process the given images which are being mapped in by dyld.
561 * All class registration and fixups are performed (or deferred pending
562 * discovery of missing superclasses etc), and +load methods are called.
564 * info[] is in bottom-up order i.e. libobjc will be earlier in the
565 * array than any library that links to libobjc.
567 * Locking: loadMethodLock(old) or runtimeLock(new) acquired by map_images.
568 **********************************************************************/
570 #include "objc-file.h"
572 #include "objc-file-old.h"
576 map_images_nolock(enum dyld_image_states state, uint32_t infoCount,
577 const struct dyld_image_info infoList[])
579 static bool firstTime = YES;
580 static bool wantsGC = NO;
583 header_info *hList[infoCount];
585 size_t selrefCount = 0;
587 // Perform first-time initialization if necessary.
588 // This function is called before ordinary library initializers.
589 // fixme defer initialization until an objc-using image is found?
593 InitialDyldRegistration = YES;
594 dyld_register_image_state_change_handler(dyld_image_state_mapped, 0 /* batch */, &gc_enforcer);
595 InitialDyldRegistration = NO;
600 _objc_inform("IMAGES: processing %u newly-mapped images...\n", infoCount);
604 // Find all images with Objective-C metadata.
608 const headerType *mhdr = (headerType *)infoList[i].imageLoadAddress;
610 hi = addHeader(mhdr);
612 // no objc data in this entry
616 if (mhdr->filetype == MH_EXECUTE) {
617 // Size some data structures based on main executable's size
620 _getObjc2SelectorRefs(hi, &count);
621 selrefCount += count;
622 _getObjc2MessageRefs(hi, &count);
623 selrefCount += count;
625 _getObjcSelectorRefs(hi, &selrefCount);
629 hList[hCount++] = hi;
633 _objc_inform("IMAGES: loading image for %s%s%s%s%s\n",
635 mhdr->filetype == MH_BUNDLE ? " (bundle)" : "",
636 _objcHeaderIsReplacement(hi) ? " (replacement)" : "",
637 _objcHeaderOptimizedByDyld(hi)?" (preoptimized)" : "",
642 // Perform one-time runtime initialization that must be deferred until
643 // the executable itself is found. This needs to be done before
644 // further initialization.
645 // (The executable may not be present in this infoList if the
646 // executable does not contain Objective-C code but Objective-C
647 // is dynamically loaded later. In that case, check_wants_gc()
648 // will do the right thing.)
651 check_wants_gc(&wantsGC);
653 verify_gc_readiness(wantsGC, hList, hCount);
655 gc_init(wantsGC); // needs executable for GC decision
657 verify_gc_readiness(wantsGC, hList, hCount);
661 // tell the collector about the data segment ranges.
662 for (i = 0; i < hCount; ++i) {
664 unsigned long seg_size;
667 seg = getsegmentdata(hi->mhdr, "__DATA", &seg_size);
668 if (seg) gc_register_datasegment((uintptr_t)seg, seg_size);
670 seg = getsegmentdata(hi->mhdr, "__DATA_CONST", &seg_size);
671 if (seg) gc_register_datasegment((uintptr_t)seg, seg_size);
673 seg = getsegmentdata(hi->mhdr, "__DATA_DIRTY", &seg_size);
674 if (seg) gc_register_datasegment((uintptr_t)seg, seg_size);
676 seg = getsegmentdata(hi->mhdr, "__OBJC", &seg_size);
677 if (seg) gc_register_datasegment((uintptr_t)seg, seg_size);
678 // __OBJC contains no GC data, but pointers to it are
679 // used as associated reference values (rdar://6953570)
685 sel_init(wantsGC, selrefCount);
689 _read_images(hList, hCount);
697 /***********************************************************************
699 * Prepares +load in the given images which are being mapped in by dyld.
700 * Returns YES if there are now +load methods to be called by call_load_methods.
702 * Locking: loadMethodLock(both) and runtimeLock(new) acquired by load_images
703 **********************************************************************/
705 load_images_nolock(enum dyld_image_states state,uint32_t infoCount,
706 const struct dyld_image_info infoList[])
713 const headerType *mhdr = (headerType*)infoList[i].imageLoadAddress;
714 if (!hasLoadMethods(mhdr)) continue;
716 prepare_load_methods(mhdr);
724 /***********************************************************************
726 * Process the given image which is about to be unmapped by dyld.
727 * mh is mach_header instead of headerType because that's what
728 * dyld_priv.h says even for 64-bit.
730 * Locking: loadMethodLock(both) and runtimeLock(new) acquired by unmap_image.
731 **********************************************************************/
733 unmap_image_nolock(const struct mach_header *mh)
736 _objc_inform("IMAGES: processing 1 newly-unmapped image...\n");
741 // Find the runtime's header_info struct for the image
742 for (hi = FirstHeader; hi != NULL; hi = hi->next) {
743 if (hi->mhdr == (const headerType *)mh) {
751 _objc_inform("IMAGES: unloading image for %s%s%s%s\n",
753 hi->mhdr->filetype == MH_BUNDLE ? " (bundle)" : "",
754 _objcHeaderIsReplacement(hi) ? " (replacement)" : "",
761 unsigned long seg_size;
763 seg = getsegmentdata(hi->mhdr, "__DATA", &seg_size);
764 if (seg) gc_unregister_datasegment((uintptr_t)seg, seg_size);
766 seg = getsegmentdata(hi->mhdr, "__DATA_CONST", &seg_size);
767 if (seg) gc_unregister_datasegment((uintptr_t)seg, seg_size);
769 seg = getsegmentdata(hi->mhdr, "__DATA_DIRTY", &seg_size);
770 if (seg) gc_unregister_datasegment((uintptr_t)seg, seg_size);
772 seg = getsegmentdata(hi->mhdr, "__OBJC", &seg_size);
773 if (seg) gc_unregister_datasegment((uintptr_t)seg, seg_size);
779 // Remove header_info from header list
785 /***********************************************************************
787 * Run C++ static constructor functions.
788 * libc calls _objc_init() before dyld would call our static constructors,
789 * so we have to do it ourselves.
790 **********************************************************************/
791 static void static_init()
795 Initializer *inits = getLibobjcInitializers(&_mh_dylib_header, &count);
796 for (size_t i = 0; i < count; i++) {
803 /***********************************************************************
805 * Bootstrap initialization. Registers our image notifier with dyld.
806 * Old ABI: called by dyld as a library initializer
807 * New ABI: called by libSystem BEFORE library initialization time
808 **********************************************************************/
811 static __attribute__((constructor))
813 void _objc_init(void)
815 static bool initialized = false;
816 if (initialized) return;
819 // fixme defer initialization until an objc-using image is found?
826 // Register for unmap first, in case some +load unmaps something
827 _dyld_register_func_for_remove_image(&unmap_image);
828 dyld_register_image_state_change_handler(dyld_image_state_bound,
829 1/*batch*/, &map_2_images);
830 dyld_register_image_state_change_handler(dyld_image_state_dependents_initialized, 0/*not batch*/, &load_images);
834 /***********************************************************************
836 * addr can be a class or a category
837 **********************************************************************/
838 static const header_info *_headerForAddress(void *addr)
841 const char *segnames[] = { "__DATA", "__DATA_CONST", "__DATA_DIRTY" };
843 const char *segnames[] = { "__OBJC" };
847 for (hi = FirstHeader; hi != NULL; hi = hi->next) {
848 for (size_t i = 0; i < sizeof(segnames)/sizeof(segnames[0]); i++) {
849 unsigned long seg_size;
850 uint8_t *seg = getsegmentdata(hi->mhdr, segnames[i], &seg_size);
853 // Is the class in this header?
854 if ((uint8_t *)addr >= seg && (uint8_t *)addr < seg + seg_size) {
865 /***********************************************************************
867 * Return the image header containing this class, or NULL.
868 * Returns NULL on runtime-constructed classes, and the NSCF classes.
869 **********************************************************************/
870 const header_info *_headerForClass(Class cls)
872 return _headerForAddress(cls);
876 /**********************************************************************
878 * Securely open a file from a world-writable directory (like /tmp)
879 * If the file does not exist, it will be atomically created with mode 0600
880 * If the file exists, it must be, and remain after opening:
881 * 1. a regular file (in particular, not a symlink)
883 * 3. permissions 0600
885 * Returns a file descriptor or -1. Errno may or may not be set on error.
886 **********************************************************************/
887 int secure_open(const char *filename, int flags, uid_t euid)
894 if (flags & O_TRUNC) {
895 // Don't truncate the file until after it is open and verified.
899 if (flags & O_CREAT) {
900 // Don't create except when we're ready for it
906 if (lstat(filename, &ls) < 0) {
907 if (errno == ENOENT && create) {
908 // No such file - create it
909 fd = open(filename, flags | O_CREAT | O_EXCL, 0600);
911 // File was created successfully.
912 // New file does not need to be truncated.
915 // File creation failed.
919 // lstat failed, or user doesn't want to create the file
923 // lstat succeeded - verify attributes and open
924 if (S_ISREG(ls.st_mode) && // regular file?
925 ls.st_nlink == 1 && // link count == 1?
926 ls.st_uid == euid && // owned by euid?
927 (ls.st_mode & ALLPERMS) == (S_IRUSR | S_IWUSR)) // mode 0600?
929 // Attributes look ok - open it and check attributes again
930 fd = open(filename, flags, 0000);
932 // File is open - double-check attributes
933 if (0 == fstat(fd, &fs) &&
934 fs.st_nlink == ls.st_nlink && // link count == 1?
935 fs.st_uid == ls.st_uid && // owned by euid?
936 fs.st_mode == ls.st_mode && // regular file, 0600?
937 fs.st_ino == ls.st_ino && // same inode as before?
938 fs.st_dev == ls.st_dev) // same device as before?
940 // File is open and OK
941 if (truncate) ftruncate(fd, 0);
944 // Opened file looks funny - close it
953 // Unopened file looks funny - don't open it
960 bool crashlog_header_name(header_info *hi)
962 return crashlog_header_name_string(hi ? hi->fname : NULL);
965 bool crashlog_header_name_string(const char *name)
967 CRSetCrashLogMessage2(name);
974 const char *__crashreporter_info__ = NULL;
976 const char *CRSetCrashLogMessage(const char *msg)
978 __crashreporter_info__ = msg;
981 const char *CRGetCrashLogMessage(void)
983 return __crashreporter_info__;
986 const char *CRSetCrashLogMessage2(const char *msg)