emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building the igc branch on MS-Windows


From: Eli Zaretskii
Subject: Re: Building the igc branch on MS-Windows
Date: Thu, 25 Apr 2024 13:34:45 +0300

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Thu, 25 Apr 2024 09:39:45 +0200
> 
> Helmut Eller <eller.helmut@gmail.com> writes:
> 
>  The to_bytes function looks suspisious.  Here it helps to change it to:
> >
> >  static mps_word_t
> >  to_bytes (mps_word_t nwords)
> >  {
> > -  return nwords << 3;
> > +  return nwords * sizeof (mps_word_t);
> >  }
> 
> Oops 

I installed that, since it unbreaks the build: all the Lisp files are
now compiled successfully, and the build runs to completion.

The resulting Emacs starts up, but then crashes due to some problem
with Lisp strings.  I show below two backtraces from two crashes, they
are different, but in both cases the crash is because the contents of
what is supposed to be a 'struct Lisp string" appears to be garbled.
In both cases, the recipe is simple:

  emacs -Q
  C-x C-f src/xdisp.c RET
  Lean on C-v to scroll through the buffer

Sometimes the crash happens only after I release C-v, wait for a few
seconds, then lean on C-v again; not sure if this is relevant or just
a coincidence.

Here are the two backtraces.  Note that "xbacktrace" also reports a
bad address, which probably means some significant issue with Lisp
strings in general(??).

Could be some alignment problem?  MPS seems to use alignment of 4 on
32-bit platforms, but AFAIR Emacs wants alignment of 8 for Lisp
objects?

Backtrace #1:

  Thread 1 received signal SIGSEGV, Segmentation fault.
  0x00853bc6 in igc_make_string (nchars=74, nbytes=74, unibyte=false,
      clear=false) at igc.c:2683
  2683      s->u.s.data = alloc_string_data (nbytes, clear);
  (gdb) bt
  #0  0x00853bc6 in igc_make_string (nchars=74, nbytes=74, unibyte=false,
      clear=false) at igc.c:2683
  #1  0x00853c0c in igc_make_multibyte_string (nchars=74, nbytes=74, 
clear=false)
      at igc.c:2690
  #2  0x0077f302 in make_clear_multibyte_string (nchars=74, nbytes=74,
      clearit=false) at alloc.c:2633
  #3  0x0077f28c in make_clear_string (length=74, clearit=false) at alloc.c:2610
  #4  0x0077f2da in make_uninit_string (length=74) at alloc.c:2621
  #5  0x007bef43 in Fcopy_sequence (arg=XIL(0xa5d8c44)) at fns.c:791
  #6  0x0076569d in compile_pattern_1 (cp=0xdf8c88 <searchbufs+616>,
      pattern=XIL(0xa5d8c44), translate=XIL(0), posix=false) at search.c:131
  #7  0x00765a26 in compile_pattern (pattern=XIL(0xa5d8c44),
      regp=0xcfbd14 <main_thread+84>, translate=XIL(0), posix=false,
      multibyte=true) at search.c:236
  #8  0x00767754 in search_buffer_re (string=XIL(0xa5d8c44), pos=375685,
      pos_byte=375685, lim=376227, lim_byte=376227, n=1, trt=XIL(0),
      inverse_trt=XIL(0), posix=false) at search.c:1168
  #9  0x00768803 in search_buffer (string=XIL(0xa5d8c44), pos=375685,
      pos_byte=375685, lim=376227, lim_byte=376227, n=1, RE=true, trt=XIL(0),
      inverse_trt=XIL(0), posix=false) at search.c:1531
  #10 0x007674ab in search_command (string=XIL(0xa5d8c44),
      bound=make_fixnum(376227), noerror=XIL(0x18ce0ac8), count=XIL(0),
      direction=1, RE=true, posix=false) at search.c:1070
  #11 0x00769b5b in Fre_search_forward (regexp=XIL(0xa5d8c44),
      bound=make_fixnum(376227), noerror=XIL(0x18ce0ac8), count=XIL(0))
      at search.c:2298
  #12 0x007b6b49 in funcall_subr (subr=0xd02dc0 <Sre_search_forward>, numargs=3,
      args=0x1a2a732c) at eval.c:3106
  #13 0x00808e62 in exec_byte_code (fun=XIL(0xa4f0555), args_template=0,
      nargs=0, args=0x1a2a73c8) at bytecode.c:829
  #14 0x007b7126 in funcall_lambda (fun=XIL(0x12cbe14d), nargs=1,
      arg_vector=0x1a2a7100) at eval.c:3200
  #15 0x007b653c in funcall_general (fun=XIL(0x12cbe14d), numargs=1,
      args=0x1a2a7100) at eval.c:2982
  #16 0x007b681c in Ffuncall (nargs=2, args=0x1a2a70fc) at eval.c:3032
  #17 0x007b5f0b in run_hook_wrapped_funcall (nargs=2, args=0x1a2a70fc)
      at eval.c:2810
  #18 0x007b6173 in run_hook_with_args (nargs=2, args=0x1a2a70fc,
      funcall=0x7b5ed5 <run_hook_wrapped_funcall>) at eval.c:2891
  #19 0x007b5f48 in Frun_hook_wrapped (nargs=2, args=0x1a2a70fc) at eval.c:2825
  #20 0x007b6d16 in funcall_subr (subr=0xd050c0 <Srun_hook_wrapped>, numargs=2,
      args=0x1a2a70fc) at eval.c:3123
  #21 0x00808e62 in exec_byte_code (fun=XIL(0x19b3a5ad), args_template=514,
      nargs=2, args=0x1a2a7094) at bytecode.c:829
  #22 0x007b7126 in funcall_lambda (fun=XIL(0x19b39f85), nargs=1,
      arg_vector=0x66dae1c) at eval.c:3200
  #23 0x007b653c in funcall_general (fun=XIL(0x19b39f85), numargs=1,
      args=0x66dae1c) at eval.c:2982
  #24 0x007b681c in Ffuncall (nargs=2, args=0x66dae18) at eval.c:3032
  #25 0x007b3118 in internal_condition_case_n (bfun=0x7b6698 <Ffuncall>,
      nargs=2, args=0x66dae18, handlers=XIL(0x18),
      hfun=0x606089 <dsafe_eval_handler>) at eval.c:1624
  #26 0x0060617d in dsafe__call (inhibit_quit=false, f=0x7b6698 <Ffuncall>,
      nargs=2, args=0x66dae18) at xdisp.c:3067
  #27 0x00606231 in dsafe_call1 (f=XIL(0x18d07c08), arg=make_fixnum(374707))
      at xdisp.c:3097
  #28 0x00609e95 in handle_fontified_prop (it=0x66dbe3c) at xdisp.c:4616
  #29 0x00608b51 in handle_stop (it=0x66dbe3c) at xdisp.c:4136
  #30 0x00616553 in next_element_from_buffer (it=0x66dbe3c) at xdisp.c:9643
  #31 0x00612cfc in get_next_display_element (it=0x66dbe3c) at xdisp.c:8209
  #32 0x006443c2 in display_line (it=0x66dbe3c, cursor_vpos=0) at xdisp.c:25295
  #33 0x0063736f in try_window (window=XIL(0xa21c62d), pos=..., flags=0)
      at xdisp.c:21136
  #34 0x006338b3 in redisplay_window (window=XIL(0xa21c62d),
      just_this_one_p=true) at xdisp.c:20245
  #35 0x0062c8aa in redisplay_window_1 (window=XIL(0xa21c62d)) at xdisp.c:18023
  #36 0x007b2f9a in internal_condition_case_1 (
      bfun=0x62c865 <redisplay_window_1>, arg=XIL(0xa21c62d),
      handlers=XIL(0x19d2108b), hfun=0x62c6ed <redisplay_window_error>)
      at eval.c:1568
  #37 0x0062b7eb in redisplay_internal () at xdisp.c:17512
  #38 0x0062913c in redisplay () at xdisp.c:16562
  #39 0x006fca1e in read_char (commandflag=1, map=XIL(0x12cbd183),
      prev_event=XIL(0), used_mouse_menu=0x66df657, end_time=0x0)
      at keyboard.c:2678
  #40 0x0070ec99 in read_key_sequence (keybuf=0x66df7b0, prompt=XIL(0),
      dont_downcase_last=false, can_return_switch_frame=true,
      fix_current_buffer=true, prevent_redisplay=false,
      disable_text_conversion_p=false) at keyboard.c:10727
  #41 0x006f9791 in command_loop_1 () at keyboard.c:1429
  #42 0x007b2ee9 in internal_condition_case (bfun=0x6f9377 <command_loop_1>,
      handlers=XIL(0x48), hfun=0x6f8846 <cmd_error>) at eval.c:1544
  #43 0x006f8f91 in command_loop_2 (handlers=XIL(0x48)) at keyboard.c:1168
  #44 0x007b251a in internal_catch (tag=XIL(0x8790),
      func=0x6f8f6f <command_loop_2>, arg=XIL(0x48)) at eval.c:1224
  #45 0x006f8f27 in command_loop () at keyboard.c:1146
  #46 0x006f8394 in recursive_edit_1 () at keyboard.c:754
  #47 0x006f8595 in Frecursive_edit () at keyboard.c:837
  #48 0x006f485b in main (argc=2, argv=0x6752570) at emacs.c:2626

  Lisp Backtrace:
  "re-search-forward" (0x1a2a732c)
  Cannot access memory at address 0xa50535c
  (gdb) l
  2678    igc_make_string (size_t nchars, size_t nbytes, bool unibyte, bool 
clear)
  2679    {
  2680      struct Lisp_String *s = alloc (sizeof *s, IGC_OBJ_STRING, 
PVEC_FREE);
  2681      s->u.s.size = nchars;
  2682      s->u.s.size_byte = unibyte ? -1 : nbytes;
  2683      s->u.s.data = alloc_string_data (nbytes, clear);
  2684      return make_lisp_ptr (s, Lisp_String);
  2685    }
  2686
  2687    Lisp_Object
  (gdb) p s
  $1 = (struct Lisp_String *) 0x12d13ea8
  (gdb) p s->u
  Cannot access memory at address 0x12d13ea8
  (gdb) p *s
  Cannot access memory at address 0x12d13ea8

Backtrace #2:

  Thread 1 received signal SIGSEGV, Segmentation fault.
  SDATA (string=XIL(0xa5d535c)) at lisp.h:1689
  1689      return XSTRING (string)->u.s.data;
  (gdb) bt
  #0  SDATA (string=XIL(0xa5d535c)) at lisp.h:1689
  #1  0x007bef54 in Fcopy_sequence (arg=XIL(0xa5d535c)) at fns.c:792
  #2  0x0076569d in compile_pattern_1 (cp=0xdf8ef0 <searchbufs+1232>,
      pattern=XIL(0xa5d535c), translate=XIL(0), posix=false) at search.c:131
  #3  0x00765a26 in compile_pattern (pattern=XIL(0xa5d535c),
      regp=0xcfbd14 <main_thread+84>, translate=XIL(0), posix=false,
      multibyte=true) at search.c:236
  #4  0x00767754 in search_buffer_re (string=XIL(0xa5d535c), pos=377153,
      pos_byte=377153, lim=377161, lim_byte=377161, n=1, trt=XIL(0),
      inverse_trt=XIL(0), posix=false) at search.c:1168
  #5  0x00768803 in search_buffer (string=XIL(0xa5d535c), pos=377153,
      pos_byte=377153, lim=377161, lim_byte=377161, n=1, RE=true, trt=XIL(0),
      inverse_trt=XIL(0), posix=false) at search.c:1531
  #6  0x007674ab in search_command (string=XIL(0xa5d535c),
      bound=make_fixnum(377161), noerror=XIL(0x96ca4c0), count=XIL(0),
      direction=1, RE=true, posix=false) at search.c:1070
  #7  0x00769b5b in Fre_search_forward (regexp=XIL(0xa5d535c),
      bound=make_fixnum(377161), noerror=XIL(0x96ca4c0), count=XIL(0))
      at search.c:2298
  #8  0x007b6b49 in funcall_subr (subr=0xd02dc0 <Sre_search_forward>, numargs=3,
      args=0x1a2af4c8) at eval.c:3106
  #9  0x00808e62 in exec_byte_code (fun=XIL(0xa4fc955), args_template=1537,
      nargs=3, args=0x1a2af478) at bytecode.c:829
  #10 0x007b7126 in funcall_lambda (fun=XIL(0x12cd385d), nargs=1,
      arg_vector=0x1a2af180) at eval.c:3200
  #11 0x007b653c in funcall_general (fun=XIL(0x12cd385d), numargs=1,
      args=0x1a2af180) at eval.c:2982
  #12 0x007b681c in Ffuncall (nargs=2, args=0x1a2af17c) at eval.c:3032
  #13 0x007b5f0b in run_hook_wrapped_funcall (nargs=2, args=0x1a2af17c)
      at eval.c:2810
  #14 0x007b6173 in run_hook_with_args (nargs=2, args=0x1a2af17c,
      funcall=0x7b5ed5 <run_hook_wrapped_funcall>) at eval.c:2891
  #15 0x007b5f48 in Frun_hook_wrapped (nargs=2, args=0x1a2af17c) at eval.c:2825
  #16 0x007b6d16 in funcall_subr (subr=0xd050c0 <Srun_hook_wrapped>, numargs=2,
      args=0x1a2af17c) at eval.c:3123
  #17 0x00808e62 in exec_byte_code (fun=XIL(0x19b3a5ad), args_template=514,
      nargs=2, args=0x1a2af114) at bytecode.c:829
  #18 0x007b7126 in funcall_lambda (fun=XIL(0x19b39f85), nargs=1,
      arg_vector=0x66d81ec) at eval.c:3200
  #19 0x007b653c in funcall_general (fun=XIL(0x19b39f85), numargs=1,
      args=0x66d81ec) at eval.c:2982
  #20 0x007b681c in Ffuncall (nargs=2, args=0x66d81e8) at eval.c:3032
  #21 0x007b3118 in internal_condition_case_n (bfun=0x7b6698 <Ffuncall>,
      nargs=2, args=0x66d81e8, handlers=XIL(0x18),
      hfun=0x606089 <dsafe_eval_handler>) at eval.c:1624
  #22 0x0060617d in dsafe__call (inhibit_quit=false, f=0x7b6698 <Ffuncall>,
      nargs=2, args=0x66d81e8) at xdisp.c:3067
  #23 0x00606231 in dsafe_call1 (f=XIL(0x18d07c08), arg=make_fixnum(376207))
      at xdisp.c:3097
  #24 0x00609e95 in handle_fontified_prop (it=0x66dde28) at xdisp.c:4616
  #25 0x00608b51 in handle_stop (it=0x66dde28) at xdisp.c:4136
  #26 0x00616553 in next_element_from_buffer (it=0x66dde28) at xdisp.c:9643
  #27 0x00612cfc in get_next_display_element (it=0x66dde28) at xdisp.c:8209
  #28 0x00616fe7 in move_it_in_display_line_to (it=0x66dde28,
      to_charpos=1253211, to_x=-1, op=MOVE_TO_POS) at xdisp.c:10000
  #29 0x00619b08 in move_it_to (it=0x66dde28, to_charpos=1253211, to_x=-1,
      to_y=512, to_vpos=-1, op=10) at xdisp.c:10734
  #30 0x00683b52 in window_scroll_pixel_based (window=XIL(0xa21c62d), n=1,
      whole=true, noerror=false) at window.c:5961
  #31 0x00682bab in window_scroll (window=XIL(0xa21c62d), n=1, whole=true,
      noerror=false) at window.c:5652
  #32 0x00685d51 in scroll_command (window=XIL(0xa21c62d), n=XIL(0), 
direction=1)
      at window.c:6464
  #33 0x00685eaa in Fscroll_up (arg=XIL(0)) at window.c:6491
  #34 0x007b6ac2 in funcall_subr (subr=0xcff860 <Sscroll_up>, numargs=1,
      args=0x1a2af098) at eval.c:3100
  #35 0x00808e62 in exec_byte_code (fun=XIL(0x19b404bd), args_template=256,
      nargs=1, args=0x66df14c) at bytecode.c:829
  #36 0x007b7126 in funcall_lambda (fun=XIL(0x19b404bd), nargs=1,
      arg_vector=0x66df148) at eval.c:3200
  #37 0x007b653c in funcall_general (fun=XIL(0x19b404bd), numargs=1,
      args=0x66df148) at eval.c:2982
  #38 0x007b681c in Ffuncall (nargs=2, args=0x66df144) at eval.c:3032
  #39 0x007ac581 in Ffuncall_interactively (nargs=2, args=0x66df144)
      at callint.c:250
  #40 0x007b6d16 in funcall_subr (subr=0xd04ba0 <Sfuncall_interactively>,
      numargs=2, args=0x66df144) at eval.c:3123
  #41 0x007b64f1 in funcall_general (fun=XIL(0xd04ba5), numargs=2,
      args=0x66df144) at eval.c:2978
  #42 0x007b681c in Ffuncall (nargs=3, args=0x66df140) at eval.c:3032
  #43 0x007ae7f5 in Fcall_interactively (function=XIL(0x18d0e030),
      record_flag=XIL(0), keys=XIL(0xa424aa5)) at callint.c:789
  #44 0x007b6b10 in funcall_subr (subr=0xd04bc0 <Scall_interactively>,
      numargs=3, args=0x1a2af050) at eval.c:3104
  #45 0x00808e62 in exec_byte_code (fun=XIL(0x19eef345), args_template=1025,
      nargs=1, args=0x66df884) at bytecode.c:829
  #46 0x007b7126 in funcall_lambda (fun=XIL(0x19eef345), nargs=1,
      arg_vector=0x66df880) at eval.c:3200
  #47 0x007b653c in funcall_general (fun=XIL(0x19eef345), numargs=1,
      args=0x66df880) at eval.c:2982
  #48 0x007b681c in Ffuncall (nargs=2, args=0x66df87c) at eval.c:3032
  #49 0x006f9b74 in command_loop_1 () at keyboard.c:1550
  #50 0x007b2ee9 in internal_condition_case (bfun=0x6f9377 <command_loop_1>,
      handlers=XIL(0x48), hfun=0x6f8846 <cmd_error>) at eval.c:1544
  #51 0x006f8f91 in command_loop_2 (handlers=XIL(0x48)) at keyboard.c:1168
  #52 0x007b251a in internal_catch (tag=XIL(0x8790),
      func=0x6f8f6f <command_loop_2>, arg=XIL(0x48)) at eval.c:1224
  #53 0x006f8f27 in command_loop () at keyboard.c:1146
  #54 0x006f8394 in recursive_edit_1 () at keyboard.c:754
  #55 0x006f8595 in Frecursive_edit () at keyboard.c:837
  #56 0x006f485b in main (argc=2, argv=0x84d2570) at emacs.c:2626

  Lisp Backtrace:
  "re-search-forward" (0x1a2af4c8)
  Cannot access memory at address 0xa4fc35c
  (gdb) p string
  $1 = XIL(0xa5d535c)
  (gdb) xstring
  $2 = (struct Lisp_String *) 0xa5d5358
  Cannot access memory at address 0xa5d5364
  (gdb) ptype struct Lisp_String
  type = struct Lisp_String {
      union {
          struct {...} s;
          struct Lisp_String *next;
          char gcaligned;
      } u;
  }
  (gdb) l
  1684       potentially GC.  */
  1685
  1686    INLINE unsigned char *
  1687    SDATA (Lisp_Object string)
  1688    {
  1689      return XSTRING (string)->u.s.data;
  1690    }
  1691    INLINE char *
  1692    SSDATA (Lisp_Object string)
  1693    {
  (gdb) p $2->u
  Cannot access memory at address 0xa5d5358



reply via email to

[Prev in Thread] Current Thread [Next in Thread]