diff options
| author | Po Lu | 2022-07-04 11:32:05 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-04 11:32:05 +0800 |
| commit | c96cd5e2b71f1de8c5b84c290ec8c9a01ec75bdd (patch) | |
| tree | ee54404e2089831d772d83b57eb9e737fdd26316 /src | |
| parent | bbca04fd9d10ec2a5e849c48eab42faad0de0a32 (diff) | |
| download | emacs-c96cd5e2b71f1de8c5b84c290ec8c9a01ec75bdd.tar.gz emacs-c96cd5e2b71f1de8c5b84c290ec8c9a01ec75bdd.zip | |
Display list of traps and handlers when crashing due to an X error
* src/xterm.c (x_connection_closed): Print list of installed
error handlers if not crashing due to an IO error.
(NO_INLINE): Include error serial in error message.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/xterm.c b/src/xterm.c index 02ea968031e..c5acb450837 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -23342,6 +23342,8 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror) | |||
| 23342 | xm_drop_start_message dmsg; | 23342 | xm_drop_start_message dmsg; |
| 23343 | struct frame *f; | 23343 | struct frame *f; |
| 23344 | Lisp_Object minibuf_frame, tmp; | 23344 | Lisp_Object minibuf_frame, tmp; |
| 23345 | struct x_failable_request *failable; | ||
| 23346 | struct x_error_message_stack *stack; | ||
| 23345 | 23347 | ||
| 23346 | dpyinfo = x_display_info_for_display (dpy); | 23348 | dpyinfo = x_display_info_for_display (dpy); |
| 23347 | error_msg = alloca (strlen (error_message) + 1); | 23349 | error_msg = alloca (strlen (error_message) + 1); |
| @@ -23508,6 +23510,31 @@ For details, see etc/PROBLEMS.\n", | |||
| 23508 | if (terminal_list == 0) | 23510 | if (terminal_list == 0) |
| 23509 | { | 23511 | { |
| 23510 | fprintf (stderr, "%s\n", error_msg); | 23512 | fprintf (stderr, "%s\n", error_msg); |
| 23513 | |||
| 23514 | if (!ioerror) | ||
| 23515 | { | ||
| 23516 | /* Dump the list of error handlers for debugging | ||
| 23517 | purposes. */ | ||
| 23518 | |||
| 23519 | fprintf (stderr, "X error handlers currently installed:\n"); | ||
| 23520 | |||
| 23521 | for (failable = dpyinfo->failable_requests; | ||
| 23522 | failable < dpyinfo->next_failable_request; | ||
| 23523 | ++failable) | ||
| 23524 | { | ||
| 23525 | if (failable->end) | ||
| 23526 | fprintf (stderr, "Ignoring errors between %lu to %lu\n", | ||
| 23527 | failable->start, failable->end); | ||
| 23528 | else | ||
| 23529 | fprintf (stderr, "Ignoring errors from %lu onwards\n", | ||
| 23530 | failable->start); | ||
| 23531 | } | ||
| 23532 | |||
| 23533 | for (stack = x_error_message; stack; stack = stack->prev) | ||
| 23534 | fprintf (stderr, "Trapping errors from %lu\n", | ||
| 23535 | stack->first_request); | ||
| 23536 | } | ||
| 23537 | |||
| 23511 | Fkill_emacs (make_fixnum (70), Qnil); | 23538 | Fkill_emacs (make_fixnum (70), Qnil); |
| 23512 | } | 23539 | } |
| 23513 | 23540 | ||
| @@ -23599,7 +23626,8 @@ x_error_handler (Display *display, XErrorEvent *event) | |||
| 23599 | static void NO_INLINE | 23626 | static void NO_INLINE |
| 23600 | x_error_quitter (Display *display, XErrorEvent *event) | 23627 | x_error_quitter (Display *display, XErrorEvent *event) |
| 23601 | { | 23628 | { |
| 23602 | char buf[256], buf1[356]; | 23629 | char buf[256], buf1[400 + INT_STRLEN_BOUND (int) |
| 23630 | + INT_STRLEN_BOUND (unsigned long)]; | ||
| 23603 | 23631 | ||
| 23604 | /* Ignore BadName errors. They can happen because of fonts | 23632 | /* Ignore BadName errors. They can happen because of fonts |
| 23605 | or colors that are not defined. */ | 23633 | or colors that are not defined. */ |
| @@ -23611,8 +23639,9 @@ x_error_quitter (Display *display, XErrorEvent *event) | |||
| 23611 | original error handler. */ | 23639 | original error handler. */ |
| 23612 | 23640 | ||
| 23613 | XGetErrorText (display, event->error_code, buf, sizeof (buf)); | 23641 | XGetErrorText (display, event->error_code, buf, sizeof (buf)); |
| 23614 | sprintf (buf1, "X protocol error: %s on protocol request %d", | 23642 | sprintf (buf1, "X protocol error: %s on protocol request %d\n" |
| 23615 | buf, event->request_code); | 23643 | "Serial no: %lu\n", buf, event->request_code, |
| 23644 | event->serial); | ||
| 23616 | x_connection_closed (display, buf1, false); | 23645 | x_connection_closed (display, buf1, false); |
| 23617 | } | 23646 | } |
| 23618 | 23647 | ||