Subject: Re: bug#9671: 24.0.50; Two bidi crashes

From: David Reitter <[email-masked]>
Date: Wed, 5 Oct 2011 16:49:47 -0400

On Oct 4, 2011, at 5:42 PM, Eli Zaretskii wrote:
>  Is it
> possible to have backtraces with source line numbers? how about the
> equivalent of "bt full" in GDB?
> 
> And a test case starting from "emacs -Q" is a must in most bugs.  Only
> a few can be debugged by just staring at the sources.

First of all, this may have to do with GDB and passing Emacs environment variables to another Emacs instance.

This may explain why we're seeing this abort in bidi:

I am reproducing at least some type of crash in bidi_initialize() when I debug Emacs (24) from gdb session inside an Emacs 23 - this occurs all the time, but not when I start it outside of Emacs/GDB:

The abort in question happens here:

  bidi_mirror_table = uniprop_table (intern ("mirroring"));
  if (NILP (bidi_mirror_table))
    abort ();

uniprop_table returns Qnil in this situation (chartab.c:1340):

  if (! CHAR_TABLE_P (table)
      || ! UNIPROP_TABLE_P (table))
    return Qnil;

And the reason for the return here is that (! CHAR_TABLE_P (table)).

I can't show all of Vchar_code_property_alist (symbol not defined?!),
but tracing uniprop_table() shows that we're correctly looking for  prop="mirroring", and we find val:

(gdb) xprintsym val
"uni-mirrored.el"(gdb) 

At this point, table = XCDR (val) yields:

(gdb) print table
$4 = 3484193
(gdb) xprintsym table
Cannot access memory at address 0x100000004
(gdb) xprintstr table
Attempt to extract a component of a value that is not a structure pointer.

STRINGP (table) evaluates to true, so we seem to load a file, but fail because  (! CHAR_TABLE_P (table)).

Is it possible that it's loading the wrong file?

I've watched file system activity and found indeed an access to the uni-mirrored.el file coming from my Emacs 23 installation!

Is it the environment?

Within Emacs GDB, the following possibly variables are set:

EMACSDATA=/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/Resources/etc
EMACSPATH=/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/MacOS/bin
EMACS=t
EMACSLOADPATH=/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/Resources/lisp:/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/Resources/leim
INSIDE_EMACS=23.3.50.39,comint
EMACSDOC=/Users/dr/ae.git/nextstep/Aquamacs.app/Contents/Resources/etc

Does this explain what's going on?

=====

Process:         Aquamacs [1855]
Path:            /Users/USER/*/Aquamacs.app/Contents/MacOS/Aquamacs
Identifier:      org.gnu.Aquamacs
Version:         3.xdev (3.x.1317698234)
Code Type:       X86 (Native)
Parent Process:  gdb-i386-apple-darwin [1834]

Date/Time:       2011-10-05 15:54:31.404 -0400
OS Version:      Mac OS X 10.7.1 (11B26)
Report Version:  9

Interval Since Last Report:          118216 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  22500 sec
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      91FCF483-3023-4F2A-952D-036B2116B80B

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

External Modification Warnings:
Debugger attached to process.

Application Specific Information:
objc[1855]: garbage collection is OFF
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x922629c6 __pthread_kill + 10
1   libsystem_c.dylib             	0x95d46f78 pthread_kill + 106
2   libsystem_c.dylib             	0x95d37bdd abort + 167
3   org.gnu.Aquamacs              	0x0026795d ns_term_shutdown + 189 (nsterm.m:4446)
4   org.gnu.Aquamacs              	0x000f1b83 shut_down_emacs + 307 (emacs.c:2116)
5   org.gnu.Aquamacs              	0x000ef115 fatal_error_signal + 389 (emacs.c:352)
6   libsystem_c.dylib             	0x95d9c59b _sigtramp + 43
7   ???                           	0xffffffff 0 + 4294967295
8   libsystem_c.dylib             	0x95d37bdd abort + 167
9   org.gnu.Aquamacs              	0x000d08cf bidi_initialize + 143 (bidi.c:764)
10  org.gnu.Aquamacs              	0x000d0a39 bidi_init_it + 57 (bidi.c:803)
11  org.gnu.Aquamacs              	0x000254d1 init_iterator + 4017 (xdisp.c:2791)
12  org.gnu.Aquamacs              	0x000393c8 resize_mini_window + 680 (xdisp.c:10024)
13  org.gnu.Aquamacs              	0x00012a5e do_switch_frame + 654 (frame.c:831)
14  org.gnu.Aquamacs              	0x00012d14 Fselect_frame + 52 (frame.c:881)
15  org.gnu.Aquamacs              	0x0007c630 select_frame_norecord + 64 (window.c:2923)
16  org.gnu.Aquamacs              	0x0007c7bc run_window_configuration_change_hook + 348 (window.c:2953)
17  org.gnu.Aquamacs              	0x0000ef26 change_frame_size_1 + 1174 (dispnew.c:5746)
18  org.gnu.Aquamacs              	0x0000ea7a change_frame_size + 234 (dispnew.c:5646)
19  org.gnu.Aquamacs              	0x0000e938 do_pending_window_change + 152 (dispnew.c:5606)
20  org.gnu.Aquamacs              	0x0001987f x_set_scroll_bar_width + 143 (frame.c:3507)
21  org.gnu.Aquamacs              	0x00017aa9 x_set_frame_parameters + 1561 (frame.c:2939)
22  org.gnu.Aquamacs              	0x0001afa9 x_default_parameter + 201 (frame.c:3950)
23  org.gnu.Aquamacs              	0x0027d784 Fx_create_frame + 5364 (nsfns.m:1280)
24  org.gnu.Aquamacs              	0x001af2ca Ffuncall + 1226 (eval.c:2974)
25  org.gnu.Aquamacs              	0x0020e1e1 exec_byte_code + 3329 (bytecode.c:785)
26  org.gnu.Aquamacs              	0x001aff0f funcall_lambda + 1295 (eval.c:3205)
27  org.gnu.Aquamacs              	0x001af53a Ffuncall + 1850 (eval.c:3023)
28  org.gnu.Aquamacs              	0x0020e1e1 exec_byte_code + 3329 (bytecode.c:785)
29  org.gnu.Aquamacs              	0x001aff0f funcall_lambda + 1295 (eval.c:3205)
30  org.gnu.Aquamacs              	0x001af53a Ffuncall + 1850 (eval.c:3023)
31  org.gnu.Aquamacs              	0x0020e1e1 exec_byte_code + 3329 (bytecode.c:785)
32  org.gnu.Aquamacs              	0x001aff0f funcall_lambda + 1295 (eval.c:3205)
33  org.gnu.Aquamacs              	0x001af53a Ffuncall + 1850 (eval.c:3023)
34  org.gnu.Aquamacs              	0x0020e1e1 exec_byte_code + 3329 (bytecode.c:785)
35  org.gnu.Aquamacs              	0x001afb94 funcall_lambda + 404 (eval.c:3139)
36  org.gnu.Aquamacs              	0x001af53a Ffuncall + 1850 (eval.c:3023)
37  org.gnu.Aquamacs              	0x0020e1e1 exec_byte_code + 3329 (bytecode.c:785)
38  org.gnu.Aquamacs              	0x001afb94 funcall_lambda + 404 (eval.c:3139)
39  org.gnu.Aquamacs              	0x001af915 apply_lambda + 453 (eval.c:3082)
40  org.gnu.Aquamacs              	0x001ad98d eval_sub + 2717 (eval.c:2367)
41  org.gnu.Aquamacs              	0x001acec4 Feval + 164 (eval.c:2176)
42  org.gnu.Aquamacs              	0x000f3e2c top_level_2 + 44 (keyboard.c:1166)
43  org.gnu.Aquamacs              	0x001ab5f6 internal_condition_case + 294 (eval.c:1499)
44  org.gnu.Aquamacs              	0x000f3e95 top_level_1 + 85 (keyboard.c:1174)
45  org.gnu.Aquamacs              	0x001aaedf internal_catch + 223 (eval.c:1256)
46  org.gnu.Aquamacs              	0x000f3d2b command_loop + 171 (keyboard.c:1136)
47  org.gnu.Aquamacs              	0x000f3295 recursive_edit_1 + 181 (keyboard.c:756)
48  org.gnu.Aquamacs              	0x000f3486 Frecursive_edit + 326 (keyboard.c:821)
49  org.gnu.Aquamacs              	0x000f12a5 main + 6437 (emacs.c:1708)
50  org.gnu.Aquamacs              	0x00002a65 start + 53

----