Overview
Comment: | runtime: Show fatal errors as requester on AmigaOS |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f2fdb37bec7e72ffa06d7d6a02f9c02c |
User & Date: | js on 2020-12-20 02:48:01 |
Other Links: | manifest | tags |
Context
2020-12-20
| ||
03:06 | Let OF_ENSURE use OBJC_ERROR in runtime check-in: 8f271bed22 user: js tags: trunk | |
02:48 | runtime: Show fatal errors as requester on AmigaOS check-in: f2fdb37bec user: js tags: trunk | |
2020-12-19
| ||
21:52 | ofhttp: Support for non-Unicode console output check-in: 7da1f47ece user: js tags: trunk | |
Changes
Modified configure.ac from [1c00b4af33] to [259fce4552].
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | AS_IF([test x"$OBJCFLAGS" = x""], [ OBJCFLAGS="-O0" ]) OBJCFLAGS="$OBJCFLAGS -noixemul" OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul" CPPFLAGS="$CPPFLAGS -D__NO_NET_API" LDFLAGS="$LDFLAGS -noixemul" enable_files="yes" # Required for reading ENV: enable_shared="no" supports_amiga_lib="yes" AS_IF([test x"$enable_amiga_lib" != x"no"], [ AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt68k.library) AC_SUBST(SFDC_TARGET, m68k-amigaos) AC_SUBST(SFD_FILE, amigaos3.sfd) AC_SUBST(SFDC_INLINE_H, inline.h) dnl For 68000, GCC emits calls to helper functions that dnl do not work properly in a library. t="-mcpu=68020 -fbaserel -noixemul" AC_SUBST(AMIGA_LIB_CFLAGS, "$t -ffreestanding") AC_SUBST(AMIGA_LIB_LDFLAGS, | > | > | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | AS_IF([test x"$OBJCFLAGS" = x""], [ OBJCFLAGS="-O0" ]) OBJCFLAGS="$OBJCFLAGS -noixemul" OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul" CPPFLAGS="$CPPFLAGS -D__NO_NET_API" LDFLAGS="$LDFLAGS -noixemul" LIBS="$LIBS -ldebug" enable_files="yes" # Required for reading ENV: enable_shared="no" supports_amiga_lib="yes" AS_IF([test x"$enable_amiga_lib" != x"no"], [ AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt68k.library) AC_SUBST(SFDC_TARGET, m68k-amigaos) AC_SUBST(SFD_FILE, amigaos3.sfd) AC_SUBST(SFDC_INLINE_H, inline.h) dnl For 68000, GCC emits calls to helper functions that dnl do not work properly in a library. t="-mcpu=68020 -fbaserel -noixemul" AC_SUBST(AMIGA_LIB_CFLAGS, "$t -ffreestanding") AC_SUBST(AMIGA_LIB_LDFLAGS, "$t -resident -nostartfiles -ldebug -lc") ]) AC_SUBST(LIBBASES_M, libbases.m) ;; powerpc-*-amigaos*) CPPFLAGS="$CPPFLAGS -D__USE_INLINE__" enable_files="yes" # Required for reading ENV: enable_shared="no" AC_SUBST(LIBBASES_M, libbases.m) ;; *-morphos*) AS_IF([test x"$OBJCFLAGS" = x""], [ OBJCFLAGS="-O2 -g" ]) OBJCFLAGS="$OBJCFLAGS -noixemul" OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul" LDFLAGS="$LDFLAGS -noixemul" LIBS="$LIBS -ldebug" enable_files="yes" # Required for reading ENV: enable_shared="no" supports_amiga_lib="yes" check_pedantic="no" # Breaks generated inlines AS_IF([test x"$enable_amiga_lib" != x"no"], [ AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt.library) AC_SUBST(CVINCLUDE_INLINE_H, inline.h) t="-mresident32 -ffreestanding -noixemul" AC_SUBST(AMIGA_LIB_CFLAGS, $t) t="-mresident32 -nostartfiles -nodefaultlibs" t="$t -noixemul -ldebug -lc" AC_SUBST(AMIGA_LIB_LDFLAGS, $t) ]) AC_SUBST(LIBBASES_M, libbases.m) ;; *-msdosdjgpp*) enable_shared="no" |
︙ | ︙ |
Modified src/runtime/amiga-library.m from [aa8e67d72d] to [8dd763a2ab].
︙ | ︙ | |||
501 502 503 504 505 506 507 508 509 510 511 512 513 514 | } int fflush(FILE *restrict stream) { return libc.fflush(stream); } void abort(void) { libc.abort(); OF_UNREACHABLE | > > > > > > > > > > > > > > > > > > > > > > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | } int fflush(FILE *restrict stream) { return libc.fflush(stream); } #ifdef OF_AMIGAOS_M68K int snprintf(char *restrict str, size_t size, const char *restrict fmt, ...) { va_list args; int ret; va_start(args, fmt); ret = vsnprintf(str, size, fmt, args); va_end(args); return ret; } int vsnprintf(char *restrict str, size_t size, const char *restrict fmt, va_list args) { return libc.vsnprintf(str, size, fmt, args); } #endif void abort(void) { libc.abort(); OF_UNREACHABLE |
︙ | ︙ |
Modified src/runtime/linklib/linklib.m from [99c78c6a65] to [452f883c82].
︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | struct objc_libc libc = { .malloc = malloc, .calloc = calloc, .realloc = realloc, .free = free, .vfprintf = vfprintf, .fflush = fflush, .abort = abort, #ifdef HAVE_SJLJ_EXCEPTIONS ._Unwind_SjLj_RaiseException = _Unwind_SjLj_RaiseException, #else ._Unwind_RaiseException = _Unwind_RaiseException, #endif ._Unwind_DeleteException = _Unwind_DeleteException, | > > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | struct objc_libc libc = { .malloc = malloc, .calloc = calloc, .realloc = realloc, .free = free, .vfprintf = vfprintf, .fflush = fflush, #ifdef OF_AMIGAOS_M68K .vsnprintf = vsnprintf, #endif .abort = abort, #ifdef HAVE_SJLJ_EXCEPTIONS ._Unwind_SjLj_RaiseException = _Unwind_SjLj_RaiseException, #else ._Unwind_RaiseException = _Unwind_RaiseException, #endif ._Unwind_DeleteException = _Unwind_DeleteException, |
︙ | ︙ |
Modified src/runtime/misc.m from [a61bf65bf6] to [b6816d93b0].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include "config.h" #include <stdio.h> #include <stdlib.h> #include "ObjFWRT.h" #include "private.h" static objc_enumeration_mutation_handler_t enumerationMutationHandler = NULL; void objc_enumerationMutation(id object) { if (enumerationMutationHandler != NULL) enumerationMutationHandler(object); else OBJC_ERROR("Object was mutated during enumeration!"); } void objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t handler) { enumerationMutationHandler = handler; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #include "config.h" #include <stdio.h> #include <stdlib.h> #include "ObjFWRT.h" #include "private.h" #ifdef OF_AMIGAOS # define USE_INLINE_STDARG # include <proto/exec.h> # include <clib/debug_protos.h> # define __NOLIBBASE__ # include <proto/intuition.h> # undef __NOLIBBASE__ #endif static objc_enumeration_mutation_handler_t enumerationMutationHandler = NULL; void objc_enumerationMutation(id object) { if (enumerationMutationHandler != NULL) enumerationMutationHandler(object); else OBJC_ERROR("Object was mutated during enumeration!"); } void objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t handler) { enumerationMutationHandler = handler; } void objc_error(const char *file, unsigned int line, const char *format, ...) { #ifdef OF_AMIGAOS # define BUF_LEN 256 char title[BUF_LEN]; char message[BUF_LEN]; int status; va_list args; struct Library *IntuitionBase; status = snprintf(title, BUF_LEN, "ObjFWRT @ %s:%u", file, line); if (status <= 0 || status >= BUF_LEN) title[0] = '\0'; va_start(args, format); status = vsnprintf(message, BUF_LEN, format, args); if (status <= 0 || status >= BUF_LEN) message[0] = '\0'; va_end(args); kprintf("[%s] %s\n", title, message); IntuitionBase = OpenLibrary("intuition.library", 0); if (IntuitionBase != NULL) { struct EasyStruct easy = { .es_StructSize = sizeof(easy), .es_Flags = 0, .es_Title = (UBYTE *)title, .es_TextFormat = (UBYTE *)"%s", (UBYTE *)"OK" }; EasyRequest(NULL, &easy, NULL, (ULONG)message); CloseLibrary(IntuitionBase); } # undef BUF_LEN #else va_list args; va_start(args, format); vfprintf(stderr, "[ObjFWRT @ %s:%u] ", file, line); vfprintf(stderr, format, args); vfprintf(stderr, "\n"); fflush(stderr); va_end(args); #endif abort(); OF_UNREACHABLE } |
Modified src/runtime/private.h from [049226b1f0] to [01662866bf].
︙ | ︙ | |||
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | struct objc_libc { void *_Nullable (*_Nonnull malloc)(size_t); void *_Nullable (*_Nonnull calloc)(size_t, size_t); void *_Nullable (*_Nonnull realloc)(void *_Nullable, size_t); void (*_Nonnull free)(void *_Nullable); int (*_Nonnull vfprintf)(FILE *_Nonnull, const char *_Nonnull, va_list); int (*_Nonnull fflush)(FILE *_Nonnull); void (*_Nonnull abort)(void); # ifdef HAVE_SJLJ_EXCEPTIONS int (*_Nonnull _Unwind_SjLj_RaiseException)(void *_Nonnull); # else int (*_Nonnull _Unwind_RaiseException)(void *_Nonnull); # endif void (*_Nonnull _Unwind_DeleteException)(void *_Nonnull); | > > > > | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | struct objc_libc { void *_Nullable (*_Nonnull malloc)(size_t); void *_Nullable (*_Nonnull calloc)(size_t, size_t); void *_Nullable (*_Nonnull realloc)(void *_Nullable, size_t); void (*_Nonnull free)(void *_Nullable); int (*_Nonnull vfprintf)(FILE *_Nonnull, const char *_Nonnull, va_list); int (*_Nonnull fflush)(FILE *_Nonnull); # ifdef OF_AMIGAOS_M68K int (*_Nonnull vsnprintf)(char *restrict _Nonnull str, size_t size, const char *_Nonnull restrict fmt, va_list args); # endif void (*_Nonnull abort)(void); # ifdef HAVE_SJLJ_EXCEPTIONS int (*_Nonnull _Unwind_SjLj_RaiseException)(void *_Nonnull); # else int (*_Nonnull _Unwind_RaiseException)(void *_Nonnull); # endif void (*_Nonnull _Unwind_DeleteException)(void *_Nonnull); |
︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | uint8_t i = idx >> 8; uint8_t j = idx; return dtable->buckets[i]->buckets[j]; #endif } #if defined(OF_ELF) # if defined(OF_X86_64) || defined(OF_X86) || defined(OF_POWERPC) || \ defined(OF_ARM64) || defined(OF_ARM) || \ defined(OF_MIPS64_N64) || defined(OF_MIPS) || \ defined(OF_SPARC64) || defined(OF_SPARC) # define OF_ASM_LOOKUP # endif #elif defined(OF_MACH_O) # if defined(OF_X86_64) # define OF_ASM_LOOKUP # endif #elif defined(OF_WINDOWS) # if defined(OF_X86_64) || defined(OF_X86) # define OF_ASM_LOOKUP # endif #endif | > > > > < < < < < < < < < < | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | uint8_t i = idx >> 8; uint8_t j = idx; return dtable->buckets[i]->buckets[j]; #endif } extern void OF_NO_RETURN_FUNC objc_error(const char *file, unsigned int line, const char *format, ...); #define OBJC_ERROR(...) objc_error(__FILE__, __LINE__, __VA_ARGS__); #if defined(OF_ELF) # if defined(OF_X86_64) || defined(OF_X86) || defined(OF_POWERPC) || \ defined(OF_ARM64) || defined(OF_ARM) || \ defined(OF_MIPS64_N64) || defined(OF_MIPS) || \ defined(OF_SPARC64) || defined(OF_SPARC) # define OF_ASM_LOOKUP # endif #elif defined(OF_MACH_O) # if defined(OF_X86_64) # define OF_ASM_LOOKUP # endif #elif defined(OF_WINDOWS) # if defined(OF_X86_64) || defined(OF_X86) # define OF_ASM_LOOKUP # endif #endif @interface DummyObject { Class _Nonnull isa; } @property (readonly, nonatomic) bool allowsWeakReference; |
︙ | ︙ |