emacs-devel
[Top][All Lists]
Advanced

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

Re: How to debug Error during redisplay


From: Eli Zaretskii
Subject: Re: How to debug Error during redisplay
Date: Sat, 12 Jan 2013 16:31:58 +0200

> From:  Leo Liu <address@hidden>
> Cc: address@hidden
> Date: Sat, 12 Jan 2013 21:58:20 +0800
> 
> On 2013-01-12 21:49 +0800, Eli Zaretskii wrote:
> >  . M-: (animate-string "hello" 0) RET
> >
> > And I don't see any error messages in *Messages*.
> 
> Your frame needs to be a wide as possible so that the inserted string by
> animate-string is visible.

Thanks, that was the missing link.  The backtrace is below, I hope
this will allow to fix adaptive-wrap.

For the record, here's how I got it caught red-handed:

 $ gdb ./emacs
 (gdb) break wrong_type_argument
 (gdb) r -Q

  Now do whatever it takes to reproduce the problem, and the
  breakpoint will break.

Evidently, the bug is here:

  (defun adaptive-wrap-fill-context-prefix (beg en)
    "Like `fill-context-prefix', but with length adjusted by 
`adaptive-wrap-extra-indent'."
    (let* ((fcp (fill-context-prefix beg en))
           (fcp-len (string-width fcp))   <<<<<<<<<<<<<<<<<<<

It looks like this function doesn't expect that fill-context-prefix
could return nil.  But the ELisp manual says:

     Usually, this function returns the fill prefix, a string.  However,
     before doing this, the function makes a final check (not specially
     mentioned in the following) that a line starting with this prefix
     wouldn't look like the start of a paragraph.  Should this happen,
     the function signals the anomaly by returning `nil' instead.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here's the backtrace:

  Breakpoint 3, wrong_type_argument (predicate=56455034, value=56403994)
      at data.c:99
  99        xsignal2 (Qwrong_type_argument, predicate, value);
  (gdb) bt
  #0  wrong_type_argument (predicate=56455034, value=56403994) at data.c:99
  #1  0x01290bd4 in Fstring_width (str=56403994) at character.c:501
  #2  0x010131a1 in eval_sub (form=60154182) at eval.c:2037
  #3  0x0100fdfb in FletX (args=60186150) at eval.c:723
  #4  0x01012d17 in eval_sub (form=60154846) at eval.c:1985
  #5  0x0100f188 in Fprogn (args=60184958) at eval.c:359
  #6  0x01015c8c in funcall_lambda (fun=60184862, nargs=2, arg_vector=0x82a960)
      at eval.c:2897
  #7  0x010155d0 in apply_lambda (fun=60184862, args=60178750) at eval.c:2781
  #8  0x01013748 in eval_sub (form=60178758) at eval.c:2112
  #9  0x0101308e in eval_sub (form=60181702) at eval.c:2022
  #10 0x0100f188 in Fprogn (args=60178630) at eval.c:359
  #11 0x010103ce in Flet (args=60181710) at eval.c:818
  #12 0x01012d17 in eval_sub (form=60181886) at eval.c:1985
  #13 0x0100f188 in Fprogn (args=60178622) at eval.c:359
  #14 0x01010474 in Fwhile (args=60181902) at eval.c:840
  #15 0x01012d17 in eval_sub (form=60181950) at eval.c:1985
  #16 0x0100f188 in Fprogn (args=60178022) at eval.c:359
  #17 0x01015c8c in funcall_lambda (fun=60177702, nargs=2, arg_vector=0x82b23c)
      at eval.c:2897
  #18 0x0101536c in Ffuncall (nargs=3, args=0x82b238) at eval.c:2733
  #19 0x010140cd in funcall_nil (nargs=3, args=0x82b238) at eval.c:2218
  #20 0x01014536 in run_hook_with_args (nargs=3, args=0x82b238,
      funcall=0x10140b5 <funcall_nil>) at eval.c:2403
  #21 0x01014145 in Frun_hook_with_args (nargs=3, args=0x82b238) at eval.c:2264
  #22 0x01014bfd in Ffuncall (nargs=4, args=0x82b234) at eval.c:2653
  #23 0x0112765f in exec_byte_code (bytestr=20387929, vector=20946773,
      maxdepth=16, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898
  #24 0x01126ad2 in Fbyte_code (bytestr=20387929, vector=20946773, maxdepth=16)
      at bytecode.c:473
  #25 0x01013283 in eval_sub (form=20946726) at eval.c:2043
  #26 0x01010caf in internal_lisp_condition_case (var=58254626,
      bodyform=20946726, handlers=20946798) at eval.c:1147
  #27 0x011280de in exec_byte_code (bytestr=20946369, vector=20946525,
      maxdepth=32, args_template=56403994, nargs=0, args=0x0) at bytecode.c:1094
  #28 0x01015dc0 in funcall_lambda (fun=20946349, nargs=2, arg_vector=0x82b818)
      at eval.c:2904
  #29 0x01015298 in Ffuncall (nargs=3, args=0x82b814) at eval.c:2721
  #30 0x0112765f in exec_byte_code (bytestr=20945985, vector=20946101,
      maxdepth=40, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898
  #31 0x01015dc0 in funcall_lambda (fun=20945965, nargs=1, arg_vector=0x82bb64)
      at eval.c:2904
  #32 0x01015298 in Ffuncall (nargs=2, args=0x82bb60) at eval.c:2721
  #33 0x01011105 in internal_condition_case_n (bfun=0x1014852 <Ffuncall>,
      nargs=2, args=0x82bb60, handlers=56404018,
      hfun=0x1167501 <safe_eval_handler>) at eval.c:1317
  #34 0x0116761c in safe_call (nargs=2, func=60505498) at xdisp.c:2454
  #35 0x0116765c in safe_call1 (fn=60505498, arg=768) at xdisp.c:2470
  #36 0x0116ae0a in handle_fontified_prop (it=0x82c8b0) at xdisp.c:3690
  #37 0x01169e55 in handle_stop (it=0x82c8b0) at xdisp.c:3254
  #38 0x01179215 in next_element_from_buffer (it=0x82c8b0) at xdisp.c:7958
  #39 0x01174ca6 in get_next_display_element (it=0x82c8b0) at xdisp.c:6623
  #40 0x011a14e9 in display_line (it=0x82c8b0) at xdisp.c:19437
  #41 0x011962f9 in try_window (window=59219973, pos=..., flags=0)
      at xdisp.c:16301
  #42 0x01192f34 in redisplay_window (window=59219973, just_this_one_p=0)
      at xdisp.c:15632
  #43 0x0118c9e7 in redisplay_window_0 (window=59219973) at xdisp.c:13881
  #44 0x01010ec9 in internal_condition_case_1 (
      bfun=0x118c9b2 <redisplay_window_0>, arg=59219973, handlers=56388574,
      hfun=0x118c98e <redisplay_window_error>) at eval.c:1231
  #45 0x0118c97e in redisplay_windows (window=59219973) at xdisp.c:13861
  #46 0x0118af1d in redisplay_internal () at xdisp.c:13453
  #47 0x0118bf45 in redisplay_preserve_echo_area (from_where=2) at xdisp.c:13706
  #48 0x01080a7c in Fredisplay (force=56403994) at dispnew.c:5936
  #49 0x01014e91 in Ffuncall (nargs=1, args=0x82efa4) at eval.c:2672
  #50 0x0112765f in exec_byte_code (bytestr=20208233, vector=20208325,
      maxdepth=20, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898
  #51 0x01015dc0 in funcall_lambda (fun=20208181, nargs=1, arg_vector=0x82f208)
      at eval.c:2904
  #52 0x01015298 in Ffuncall (nargs=2, args=0x82f204) at eval.c:2721
  #53 0x0112765f in exec_byte_code (bytestr=58311649, vector=56710557,
      maxdepth=28, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898
  #54 0x01015dc0 in funcall_lambda (fun=56710669, nargs=2, arg_vector=0x82f3d0)
      at eval.c:2904
  #55 0x010155d0 in apply_lambda (fun=56710669, args=60243686) at eval.c:2781
  #56 0x010135a5 in eval_sub (form=60243694) at eval.c:2082
  #57 0x01012877 in Feval (form=60243694, lexical=56403994) at eval.c:1902
  #58 0x01014efc in Ffuncall (nargs=3, args=0x82f654) at eval.c:2675
  #59 0x0112765f in exec_byte_code (bytestr=20695897, vector=20695989,
      maxdepth=28, args_template=2052, nargs=2, args=0x82f8ac) at bytecode.c:898
  #60 0x0101597d in funcall_lambda (fun=20695869, nargs=2, arg_vector=0x82f8a4)
      at eval.c:2838
  #61 0x01015298 in Ffuncall (nargs=3, args=0x82f8a0) at eval.c:2721
  #62 0x01014089 in Fapply (nargs=2, args=0x82f940) at eval.c:2206
  #63 0x0101460d in apply1 (fn=58199234, arg=60243158) at eval.c:2440
  #64 0x0112489e in Fcall_interactively (function=58199234,
      record_flag=56403994, keys=56425333) at callint.c:377
  #65 0x01014f71 in Ffuncall (nargs=4, args=0x82fb80) at eval.c:2679
  #66 0x010146e2 in call3 (fn=56521306, arg1=58199234, arg2=56403994,
      arg3=56403994) at eval.c:2497
  #67 0x010aef10 in Fcommand_execute (cmd=58199234, record_flag=56403994,
      keys=56403994, special=56403994) at keyboard.c:10251
  #68 0x010954d5 in command_loop_1 () at keyboard.c:1588
  #69 0x01010db9 in internal_condition_case (bfun=0x109477b <command_loop_1>,
      handlers=56454362, hfun=0x1093fbb <cmd_error>) at eval.c:1193
  #70 0x01094407 in command_loop_2 (ignore=56403994) at keyboard.c:1175
  #71 0x010107c1 in internal_catch (tag=56444218,
      func=0x10943e4 <command_loop_2>, arg=56403994) at eval.c:964
  #72 0x010943bf in command_loop () at keyboard.c:1154
  #73 0x0109398c in recursive_edit_1 () at keyboard.c:787
  #74 0x01093cae in Frecursive_edit () at keyboard.c:851
  #75 0x01002872 in main (argc=2, argv=0xa427c8) at emacs.c:1573

  Lisp Backtrace:
  "string-width" (0x82a670)
  "let*" (0x82a890)
  "adaptive-wrap-fill-context-prefix" (0x82a960)
  "put-text-property" (0x82ac00)
  "let" (0x82ae00)
  "while" (0x82afa0)
  "adaptive-wrap-prefix-function" (0x82b23c)
  "run-hook-with-args" (0x82b238)
  "byte-code" (0x82b410)
  "jit-lock-fontify-now" (0x82b818)
  "jit-lock-function" (0x82bb64)
  "redisplay_internal (C function)" (0x166c7f0)
  "redisplay" (0x82efa8)
  "sit-for" (0x82f208)
  "animate-string" (0x82f3d0)
  "eval" (0x82f658)
  "eval-expression" (0x82f8a4)
  "call-interactively" (0x82fb84)
  (gdb)



reply via email to

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