Subject: Re: 23.0.60; OSX: Wrong type argument: wholenump, -1

From: Markus Triska <[email-masked]>
Date: Thu, 01 Jan 2009 15:17:50 +0100

Chong Yidong <[email-masked]> writes:

> Could you run Emacs in gdb, set a breakpoint at wrong_type_argument, and
> get a backtrace?  Thanks.

mt-computer:~/emacs/src mt$ gdb ./emacs
GNU gdb 6.3.50-20050815 (Apple version gdb-573) (Fri Oct 20 15:50:43 GMT 2006)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .................................. done

DISPLAY = :0.0
TERM = xterm-color
Breakpoint 1 at 0x9010d3db
Breakpoint 2 at 0xf7c8f: file sysdep.c, line 1144.
(gdb) b wrong_type_argument 
Breakpoint 3 at 0x139743: file data.c, line 108.
(gdb) r -Q -f server-start
Starting program: /Users/mt/emacs/src/emacs -Q -f server-start
Reading symbols for shared libraries ..+++++++.+.++..++................................................+.+.+++.................++....+.+.++...++++++ done

Breakpoint 3, wrong_type_argument (predicate=50372969, value=-8) at data.c:108
108       if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit)
(gdb) bt
#0  wrong_type_argument (predicate=50372969, value=-8) at data.c:108
#1  0x001353b6 in Fmake_vector (length=-8, init=50332681) at alloc.c:3044
#2  0x0018f2c1 in conv_sockaddr_to_lisp (sa=0xbfffe7b0, len=0) at process.c:2305
#3  0x0019040e in Fmake_network_process (nargs=10, args=0xbfffe888) at process.c:3585
#4  0x0014e767 in Ffuncall (nargs=11, args=0xbfffe884) at eval.c:3025
#5  0x00187d3f in Fbyte_code (bytestr=50968379, vector=34144868, maxdepth=14) at bytecode.c:678
#6  0x0014dcaa in Feval (form=46275893) at eval.c:2385
#7  0x00150293 in internal_lisp_condition_case (var=50332681, bodyform=46275893, handlers=46308501) at eval.c:1456
#8  0x00186c75 in Fbyte_code (bytestr=50968459, vector=34145028, maxdepth=3) at bytecode.c:868
#9  0x0014e0df in funcall_lambda (fun=34145156, nargs=1, arg_vector=0xbfffec54) at eval.c:3231
#10 0x0014e5c2 in Ffuncall (nargs=2, args=0xbfffec50) at eval.c:3101
#11 0x00187d3f in Fbyte_code (bytestr=50983723, vector=34143876, maxdepth=23) at bytecode.c:678
#12 0x0014e0df in funcall_lambda (fun=34144372, nargs=1, arg_vector=0xbfffee74) at eval.c:3231
#13 0x0014e5c2 in Ffuncall (nargs=2, args=0xbfffee70) at eval.c:3101
#14 0x0014abc6 in Fcall_interactively (function=50770073, record_flag=50332681, keys=47194236) at callint.c:870
#15 0x0014e7d5 in Ffuncall (nargs=4, args=0xbffff060) at eval.c:3050
#16 0x0014e971 in call3 (fn=50444857, arg1=50770073, arg2=50332681, arg3=50332681) at eval.c:2874
#17 0x0014e7fc in Ffuncall (nargs=2, args=0xbffff100) at eval.c:3054
#18 0x00187d3f in Fbyte_code (bytestr=2187355, vector=2187372, maxdepth=10) at bytecode.c:678
#19 0x0014e0df in funcall_lambda (fun=2187324, nargs=1, arg_vector=0xbffff2a4) at eval.c:3231
#20 0x0014e5c2 in Ffuncall (nargs=2, args=0xbffff2a0) at eval.c:3101
#21 0x00187d3f in Fbyte_code (bytestr=2173707, vector=2173724, maxdepth=7) at bytecode.c:678
#22 0x0014e0df in funcall_lambda (fun=2173684, nargs=0, arg_vector=0xbffff434) at eval.c:3231
#23 0x0014e5c2 in Ffuncall (nargs=1, args=0xbffff430) at eval.c:3101
#24 0x00187d3f in Fbyte_code (bytestr=2170363, vector=2170380, maxdepth=6) at bytecode.c:678
#25 0x0014e0df in funcall_lambda (fun=2170340, nargs=0, arg_vector=0xbffff550) at eval.c:3231
#26 0x0014e34a in apply_lambda (fun=2170340, args=50332681, eval_flag=1) at eval.c:3155
#27 0x0014da94 in Feval (form=32583253) at eval.c:2435
#28 0x000dedac in top_level_2 () at keyboard.c:1358
#29 0x0014c94c in internal_condition_case (bfun=0xded90 <top_level_2>, handlers=50372345, hfun=0xe59a8 <cmd_error>) at eval.c:1511
#30 0x000dedf4 in top_level_1 () at keyboard.c:1366
#31 0x0014c59e in internal_catch (tag=50368417, func=0xdedb2 <top_level_1>, arg=50332681) at eval.c:1247
#32 0x000deb0f in command_loop () at keyboard.c:1321
#33 0x000debdf in recursive_edit_1 () at keyboard.c:942
#34 0x000ded27 in Frecursive_edit () at keyboard.c:1004
#35 0x000ddb3c in main (argc=4, argv=0xbffff9cc) at emacs.c:1786

Lisp Backtrace:
"make-network-process" (0xbfffe888)
"byte-code" (0xbfffe9a4)
"server-running-p" (0xbfffec54)
"server-start" (0xbfffee74)
"call-interactively" (0xbffff064)
"command-execute" (0xbffff104)
"command-line-1" (0xbffff2a4)
"command-line" (0xbffff434)
"normal-top-level" (0xbffff550)
(gdb) bt full
#0  wrong_type_argument (predicate=50372969, value=-8) at data.c:108
No locals.
#1  0x001353b6 in Fmake_vector (length=-8, init=50332681) at alloc.c:3044
        index = -1073748500
        p = (struct Lisp_Vector *) 0x300a169
        length = 50372969
        init = 50332681
#2  0x0018f2c1 in conv_sockaddr_to_lisp (sa=0xbfffe7b0, len=0) at process.c:2305
        address = 0
        i = -1073748048
        cp = (unsigned char *) 0xbfffe5ec "\016\004\031"
        p = (struct Lisp_Vector *) 0x0
#3  0x0019040e in Fmake_network_process (nargs=10, args=0xbfffe888) at process.c:3585
        sa1 = {
  sin_len = 9 '\t', 
  sin_family = 4 '\004', 
  sin_port = 768, 
  sin_addr = {
    s_addr = 46327880
  }, 
  sin_zero = "0\027\016\004t\347\377\277"
}
        len1 = 0
        proc = 20
        contact = 46327989
        p = (struct Lisp_Process *) 0xbfffe7b0
        ai = {
  ai_flags = 1919252082, 
  ai_family = 1, 
  ai_socktype = 1, 
  ai_protocol = 0, 
  ai_addrlen = 106, 
  ai_canonname = 0x40e1730 "server", 
  ai_addr = 0xbfffe706, 
  ai_next = 0x0
}
        res = (struct addrinfo *) 0xbfffe770
        lres = (struct addrinfo *) 0xbfffe770
        hints = {
  ai_flags = 1987208563, 
  ai_family = 29285, 
  ai_socktype = -1073747976, 
  ai_protocol = 1101290, 
  ai_addrlen = 51051643, 
  ai_canonname = 0x300da79 "", 
  ai_addr = 0x1000, 
  ai_next = 0x16f732
}
        portstring = 0x349740 "x\2304"
        portbuf = "\000\000\000\000\000\000\360\221\016\004\024", '\0' <repeats 15 times>, "\024\000\000\000\001\000\000\000\330\346\377\277\240\006\022\000{\232\001\003x\232\001\003\370\346\377\277!\a\022\000P\2274\000\360\221\016\004\024\000\000\000\000\000\000\000\024", '\0' <repeats 11 times>, "_a\025\000x\232\001\003\024\000\000\000\002a\025\000\333\303\020\000\210F\337\001\t\004\000\003H\347\377\277\337\304\020\000k\244\a\003{\232"
        address_in = {
  sin_len = 48 '0', 
  sin_family = 24 '\030', 
  sin_port = 1038, 
  sin_addr = {
    s_addr = 0
  }, 
  sin_zero = "\243H\023\000\230\375\n\003"
}
        address_un = {
  sun_len = 0 '\0', 
  sun_family = 1 '\001', 
  sun_path = "/tmp/emacs502/server", '\0' <repeats 83 times>
}
        ret = -1073748048
        xerrno = 22
        s = 9
        QCaddress = 50473473
        tem = -1073748112
        name = 50967963
        buffer = 50332681
        host = 50332681
        service = 50436731
        address = -1073748112
        filter = 50332681
        sentinel = 50332681
        is_non_blocking_client = 0
        is_server = 0
        backlog = 5
        socktype = 1
        family = 1
#4  0x0014e767 in Ffuncall (nargs=11, args=0xbfffe884) at eval.c:3025
        fun = 3190596
        original_fun = -1073747832
        funcar = 0
        numargs = 10
        val = -1073748500
        backtrace = {
  next = 0xbfffe9c4, 
  function = 0xbfffe884, 
  args = 0xbfffe888, 
  nargs = 10, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0x30af44
        i = 0
        args = (Lisp_Object *) 0xbfffe888
#5  0x00187d3f in Fbyte_code (bytestr=50968379, vector=34144868, maxdepth=14) at bytecode.c:678
        op = 50372969
        vectorp = (Lisp_Object *) 0x2090268
        stack = {
  pc = 0x40e4b8b "!\210\321\207", 
  top = 0xbfffe8ac, 
  bottom = 0xbfffe880, 
  byte_string = 50968379, 
  byte_string_start = 0x40e4b4c "\b\203.", 
  constants = 34144868, 
  next = 0xbfffeb44
}
        result = -1073748500
        bytestr = 0
#6  0x0014dcaa in Feval (form=46275893) at eval.c:2385
        numargs = 0
        argvals = {50968379, 34144868, 112, 68063700, 20, 0, 0, 20}
        args_left = 50332681
        i = 3
        fun = -1073748500
        val = -1073748500
        original_fun = 50443625
        original_args = 46275885
        funcar = 0
        backtrace = {
  next = 0xbfffec0c, 
  function = 0xbfffe9dc, 
  args = 0xbfffe9a4, 
  nargs = 3, 
  evalargs = 1 '\001', 
  debug_on_exit = 0 '\0'
}
        form = 50332681
#7  0x00150293 in internal_lisp_condition_case (var=50332681, bodyform=46275893, handlers=46308501) at eval.c:1456
        val = 0
        c = {
  tag = 50332681, 
  val = 50332681, 
  next = 0xbffff668, 
  gcpro = 0x0, 
  jmp = {67109759, 1178798, 8096, 1376500, -1073747320, 1181344, 68045586, 50332681, -1073747272, -1073747456, 3407903, 662, 1376666, 68026391, 31, 31, 0, 55}, 
  backlist = 0xbfffec0c, 
  handlerlist = 0xbffff6dc, 
  lisp_eval_depth = 7, 
  pdlcount = 24, 
  poll_suppress_count = 1, 
  interrupt_input_blocked = 0, 
  byte_stack = 0xbfffeb44
}
        h = {
  handler = 46308501, 
  var = 50332681, 
  chosen_clause = 68063700, 
  tag = 0xbfffea18, 
  next = 0xbffff6dc
}
#8  0x00186c75 in Fbyte_code (bytestr=50968459, vector=34145028, maxdepth=3) at bytecode.c:868
        handlers = 50372969
        body = 0
        op = 50372969
        vectorp = (Lisp_Object *) 0x2090308
        stack = {
  pc = 0x40e4b12 "\207", 
  top = 0xbfffead0, 
  bottom = 0xbfffead0, 
  byte_string = 50968459, 
  byte_string_start = 0x40e4b08 "\b\204\006", 
  constants = 34145028, 
  next = 0xbfffed14
}
        result = -1073748500
        bytestr = 0
#9  0x0014e0df in funcall_lambda (fun=34145156, nargs=1, arg_vector=0xbfffec54) at eval.c:3231
        val = 50372969
        syms_left = 34145152
        next = 34145152
        i = 1
        optional = 1
        rest = 0
#10 0x0014e5c2 in Ffuncall (nargs=2, args=0xbfffec50) at eval.c:3101
        fun = 34145156
        original_fun = 68026121
        funcar = 0
        numargs = 1
        val = -1073748500
        backtrace = {
  next = 0xbfffeddc, 
  function = 0xbfffec50, 
  args = 0xbfffec54, 
  nargs = 1, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0x2090384
        i = 0
        args = (Lisp_Object *) 0x40dff09
#11 0x00187d3f in Fbyte_code (bytestr=50983723, vector=34143876, maxdepth=23) at bytecode.c:678
        op = 50372969
        vectorp = (Lisp_Object *) 0x208fe88
        stack = {
  pc = 0x40e3ecf "\315=\2044", 
  top = 0xbfffec54, 
  bottom = 0xbfffec50, 
  byte_string = 50983723, 
  byte_string_start = 0x40e3ea8 "\b\203\n", 
  constants = 34143876, 
  next = 0xbffff194
}
        result = -1073748500
        bytestr = 0
#12 0x0014e0df in funcall_lambda (fun=34144372, nargs=1, arg_vector=0xbfffee74) at eval.c:3231
        val = 50372969
        syms_left = 34144368
        next = 34144368
        i = 1
        optional = 1
        rest = 0
#13 0x0014e5c2 in Ffuncall (nargs=2, args=0xbfffee70) at eval.c:3101
        fun = 34144372
        original_fun = 50770073
        funcar = 0
        numargs = 1
        val = -1073748500
        backtrace = {
  next = 0xbffff00c, 
  function = 0xbfffee70, 
  args = 0xbfffee74, 
  nargs = 1, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0x2090074
        i = 0
        args = (Lisp_Object *) 0x306b099
#14 0x0014abc6 in Fcall_interactively (function=50770073, record_flag=50332681, keys=47194236) at callint.c:870
        val = 50372969
        specs = 12699392
        filter_specs = 50972939
        teml = 50332681
        up_event = 50332681
        enable = 50332681
        next_event = 0
        prefix_arg = 50332681
        string = (unsigned char *) 0x2 <Address 0x2 out of bounds>
        tem = (unsigned char *) 0x0
        i = -1073748500
        j = 1
        foo = 2
        prompt1 = '\0' <repeats 99 times>
        arg_from_tty = 0
        key_count = 0
        record_then_fail = 0
        save_this_command = 50332681
        save_last_command = 50332681
        save_this_original_command = 50332681
        save_real_this_command = 50332681
#15 0x0014e7d5 in Ffuncall (nargs=4, args=0xbffff060) at eval.c:3050
        fun = -1073745820
        original_fun = 50444857
        funcar = 0
        numargs = 3
        val = -1073748500
        backtrace = {
  next = 0xbffff0bc, 
  function = 0xbffff060, 
  args = 0xbffff064, 
  nargs = 3, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0xbffff064
        i = 0
        args = (Lisp_Object *) 0x301ba39
#16 0x0014e971 in call3 (fn=50444857, arg1=50770073, arg2=50332681, arg3=50332681) at eval.c:2874
        ret_ungc_val = 50372969
#17 0x0014e7fc in Ffuncall (nargs=2, args=0xbffff100) at eval.c:3054
        fun = -1073745792
        original_fun = 1905104
        funcar = 0
        numargs = 1
        val = -1073748500
        backtrace = {
  next = 0xbffff25c, 
  function = 0xbffff100, 
  args = 0xbffff104, 
  nargs = 1, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0xbffff080
        i = 0
        args = (Lisp_Object *) 0x1d11d0
#18 0x00187d3f in Fbyte_code (bytestr=2187355, vector=2187372, maxdepth=10) at bytecode.c:678
        op = 50372969
        vectorp = (Lisp_Object *) 0x216070
        stack = {
  pc = 0x2dc25a "\210\202\302\003\016F \210\202\302\003\016L\342\235\203\226\001\331\026Q\343\344\016N\206\220\001\f\211A\024@!!\210\202\302\003\016L\345\235\203\321\001\346\347\016N\206\251\001\f\211A\024@!!\026F\016E\203\304\001\016E\016F\016EAB\241\210\016EA\026E\202\302\003\016F\016RB\211\026R\026E\202\302\003\016L\350\235\203\002\002\347\016N\206\343\001\f\211A\024@!\036S\346\016S!\036T\351\016T!\203\367\001\016T\026S\352\016S\314\331#\210*\202\302\003\016L\353\235\203)\002\347\016N\206\024\002\f\211A\024@!\036S\346\016S!\036T\352\016T\314\331\211$\210*\202\302\003\016L\354\232\203R\002\331\026Q\016N\206="..., 
  top = 0xbffff104, 
  bottom = 0xbffff100, 
  byte_string = 2187355, 
  byte_string_start = 0x2dc0eb "\306 \210\b\203\021", 
  constants = 2187372, 
  next = 0xbffff324
}
        result = -1073748500
        bytestr = 0
#19 0x0014e0df in funcall_lambda (fun=2187324, nargs=1, arg_vector=0xbffff2a4) at eval.c:3231
        val = 50372969
        syms_left = 2187320
        next = 2187320
        i = 1
        optional = 0
        rest = 0
#20 0x0014e5c2 in Ffuncall (nargs=2, args=0xbffff2a0) at eval.c:3101
        fun = 2187324
        original_fun = 50770049
        funcar = 0
        numargs = 1
        val = -1073748500
        backtrace = {
  next = 0xbffff3ec, 
  function = 0xbffff2a0, 
  args = 0xbffff2a4, 
  nargs = 1, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0x21603c
        i = 0
        args = (Lisp_Object *) 0x306b081
#21 0x00187d3f in Fbyte_code (bytestr=2173707, vector=2173724, maxdepth=7) at bytecode.c:678
        op = 50372969
        vectorp = (Lisp_Object *) 0x212b20
        stack = {
  pc = 0x2dea22 "\210\016L\203\031\006\201\334", 
  top = 0xbffff2a4, 
  bottom = 0xbffff2a0, 
  byte_string = 2173707, 
  byte_string_start = 0x2de415 "\306 \020\307\021\n\023\310\311!\210\310\312!\210\310\313!\210\314\315!\211\034\307=\204;", 
  constants = 2173724, 
  next = 0xbffff4b4
}
        result = -1073748500
        bytestr = 0
#22 0x0014e0df in funcall_lambda (fun=2173684, nargs=0, arg_vector=0xbffff434) at eval.c:3231
        val = 50372969
        syms_left = 2173680
        next = 2173680
        i = 0
        optional = 0
        rest = 0
#23 0x0014e5c2 in Ffuncall (nargs=1, args=0xbffff430) at eval.c:3101
        fun = 2173684
        original_fun = 50839257
        funcar = 0
        numargs = 0
        val = -1073748500
        backtrace = {
  next = 0xbffff5f4, 
  function = 0xbffff430, 
  args = 0xbffff434, 
  nargs = 0, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        internal_args = (Lisp_Object *) 0x212af4
        i = 0
        args = (Lisp_Object *) 0x307bed9
#24 0x00187d3f in Fbyte_code (bytestr=2170363, vector=2170380, maxdepth=6) at bytecode.c:678
        op = 50372969
        vectorp = (Lisp_Object *) 0x211e10
        stack = {
  pc = 0x2df2b8 "\210*\340\341\342\"\210\343\321\344\"\211\036$;\203\250", 
  top = 0xbffff430, 
  bottom = 0xbffff430, 
  byte_string = 2170363, 
  byte_string_start = 0x2df22b "\b\203\b", 
  constants = 2170380, 
  next = 0x0
}
        result = -1073748500
        bytestr = 0
#25 0x0014e0df in funcall_lambda (fun=2170340, nargs=0, arg_vector=0xbffff550) at eval.c:3231
        val = 50372969
        syms_left = 2170336
        next = 2170336
        i = 0
        optional = 3
        rest = 1388732
#26 0x0014e34a in apply_lambda (fun=2170340, args=50332681, eval_flag=1) at eval.c:3155
        args_left = 2170336
        i = 0
        tem = 3453520
        args = 3453520
#27 0x0014da94 in Feval (form=32583253) at eval.c:2435
        fun = -1073748500
        val = -1073748500
        original_fun = 50829369
        original_args = 50332681
        funcar = 0
        backtrace = {
  next = 0x0, 
  function = 0xbffff60c, 
  args = 0xbffff550, 
  nargs = 0, 
  evalargs = 0 '\0', 
  debug_on_exit = 0 '\0'
}
        form = 4
#28 0x000dedac in top_level_2 () at keyboard.c:1358
No locals.
#29 0x0014c94c in internal_condition_case (bfun=0xded90 <top_level_2>, handlers=50372345, hfun=0xe59a8 <cmd_error>) at eval.c:1511
        val = 0
        c = {
  tag = 50332681, 
  val = 50332681, 
  next = 0xbffff74c, 
  gcpro = 0x0, 
  jmp = {-1073806465, -1881124082, 8096, 1362011, -1880799136, 1597049, 3430720, 3408400, -1073744120, -1073744304, 31, 662, 1362160, 1310743, 3407903, 3407903, -1073807360, -1881079753}, 
  backlist = 0x0, 
  handlerlist = 0x0, 
  lisp_eval_depth = 0, 
  pdlcount = 2, 
  poll_suppress_count = 1, 
  interrupt_input_blocked = 0, 
  byte_stack = 0x0
}
        h = {
  handler = 50372345, 
  var = 50332681, 
  chosen_clause = 0, 
  tag = 0xbffff668, 
  next = 0x0
}
#30 0x000dedf4 in top_level_1 () at keyboard.c:1366
No locals.
#31 0x0014c59e in internal_catch (tag=50368417, func=0xdedb2 <top_level_1>, arg=50332681) at eval.c:1247
        c = {
  tag = 50368417, 
  val = 50332681, 
  next = 0x0, 
  gcpro = 0x0, 
  jmp = {895, 15, 8096, 1361154, 3, 19307, 3430720, 3408400, -1073743928, -1073744080, 50462751, 662, 1361297, 50462743, 50462751, 50331679, 47185920, 55}, 
  backlist = 0x0, 
  handlerlist = 0x0, 
  lisp_eval_depth = 0, 
  pdlcount = 2, 
  poll_suppress_count = 1, 
  interrupt_input_blocked = 0, 
  byte_stack = 0x0
}
        tag = 50372969
#32 0x000deb0f in command_loop () at keyboard.c:1321
        val = 50372969
#33 0x000debdf in recursive_edit_1 () at keyboard.c:942
        val = 0
#34 0x000ded27 in Frecursive_edit () at keyboard.c:1004
        buffer = 50332681
#35 0x000ddb3c in main (argc=4, argv=0xbffff9cc) at emacs.c:1786
        dummy = 0
        stack_bottom_variable = 0 '\0'
        do_initial_setlocale = 1
        skip_args = 0
        rlim = {
  rlim_cur = 8388608, 
  rlim_max = 67108864
}
        no_loadup = 0
        junk = 0x0
        dname_arg = 0x0

Lisp Backtrace:
"make-network-process" (0xbfffe888)
"byte-code" (0xbfffe9a4)
"server-running-p" (0xbfffec54)
"server-start" (0xbfffee74)
"call-interactively" (0xbffff064)
"command-execute" (0xbffff104)
"command-line-1" (0xbffff2a4)
"command-line" (0xbffff434)
"normal-top-level" (0xbffff550)
(gdb)