Breakpoint handled as exception on macOS

13 views
Skip to first unread message

Thibault Ober

unread,
Aug 2, 2023, 10:48:25 AM8/2/23
to Google Breakpad Discuss
Hello,

Currently on macos, breakpad catch breakpoint as an exception even if it sets the exception type correctly.
src/client/mac/handler/exception_handler.cc:
int exception_type = 0;
int exception_code = 0;
if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
    thread = receive.thread.name;
    exception_type = EXC_BREAKPOINT;
#if defined(__i386__) || defined(__x86_64__)
    exception_code = EXC_I386_BPT;
#elif defined(__ppc__) || defined(__ppc64__)
    exception_code = EXC_PPC_BREAKPOINT;
#elif defined(__arm__) || defined(__aarch64__)
    exception_code = EXC_ARM_BREAKPOINT;
}


I don't have the full picture here but is there a way to filter the exception type inside the FilterCallback?
Maybe could the filter callback be changed to receive the different exception type?
typedef bool (*FilterCallback)(void* context);
change to:
typedef bool (*FilterCallback)(void* context, int exception_type,
    int exception_code,
    int exception_subcode,);


There is also this weird comment:
src/client/mac/handler/exception_handler.cc:
// Only catch these three exceptions.  The other ones are nebulously defined
// and may result in treating a non-fatal exception as fatal.
exception_mask_t s_exception_mask = EXC_MASK_BAD_ACCESS |
EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_BREAKPOINT;
Should three exceptions be changed to four exceptions ?


Lastly, it seems I am not the only who struggle with this:
https://groups.google.com/g/google-breakpad-discuss/c/vVzlI095WeM/m/xngAGIxAnk0J

Thank you for your time
Reply all
Reply to author
Forward
0 new messages