- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我不太确定如何正确调试它,但尝试了几种不同的方法,虽然浪费了时间,但没有解决问题。我办公室里至少有 4 个其他人可以在安装了相同版本的 ruby 和 rubygems 的相同机器上执行此代码而没有错误。
这是我正在执行的代码:
status = Open4::popen4( "swfmill simple stdin stdout" ) do | pid, stdin, stdout, stderr |
stdin.write( config )
stdin.close
bytes = stdout.read
errors = stderr.read
end
我在这条线路上收到“总线错误”:
errors = stderr.read
如果我评论该行,我会在该行收到“Segementation Fault”:
bytes = stdout.read
我显然在使用 Open4 库并执行外部进程。当直接从终端执行时,以及当此 Ruby 代码在此特定 Rails 应用程序之外运行时,即使在不同的、更简单的 Rails 应用程序中,这个外部进程也能完美运行。
要重现错误,我只需要像这样执行我的特定测试方法:
ruby test/unit/swf_generator_test.rb --name test_get_bytes
我在配备 Intel Core 2 Duo 2.53 GHz 和 8GB RAM 的 MacBook Pro 上运行 Snow Leopard Mac OS X 10.6.2 (10C540)。
ruby -v && gem -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.2.0]
1.3.5
我在 GDB 中执行了这段代码,发现我的 libxml 和 libxslt 库都没有正确安装。我能够安装这两个库,现在 GDB 不再告诉我任何我认为有用的信息。这是 GDB 的当前输出:
gdb ruby
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
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 "x86_64-apple-darwin"...Reading symbols for shared libraries .... done
(gdb) run test/unit/swf_generator_test.rb --name test_get_bytes
Starting program: /usr/local/bin/ruby test/unit/swf_generator_test.rb --name test_get_bytes
Reading symbols for shared libraries +++... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ... done
Loaded suite test/unit/swf_generator_test
Started
Reading symbols for shared libraries .. done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff81973e90
0x0000000100045bf1 in gc_mark ()
(gdb)
在更新我的 libxml 和 libxslt 库后,我还重建/重新安装了所有的 gem。我通过运行来做到这一点:
sudo gem pristine --all
最后,这是我针对此特定异常的控制台日志条目:
Process: ruby [5059]
Path: /usr/local/bin/ruby
Identifier: ruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [5050]
Date/Time: 2010-01-21 11:31:45.468 -0800
OS Version: Mac OS X 10.6.2 (10C540)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000000000e
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
abort() called
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff819befe6 __kill + 10
1 libSystem.B.dylib 0x00007fff81a5fe32 abort + 83
2 libruby.dylib 0x000000010001b887 rb_check_type + 0
3 libruby.dylib 0x00000001000a5427 sigsegv + 84
4 libSystem.B.dylib 0x00007fff819d0eaa _sigtramp + 26
5 ??? 0x00007fff5fbd7410 0 + 140734799639568
6 libruby.dylib 0x0000000100045a50 mark_tbl + 44
7 libruby.dylib 0x0000000100045a71 rb_mark_tbl + 31
8 libruby.dylib 0x0000000100059286 mark_load_arg + 40
9 libruby.dylib 0x000000010004635f gc_mark_children + 1687
10 libruby.dylib 0x0000000100045c74 gc_mark + 221
11 libruby.dylib 0x0000000100045882 mark_locations_array + 61
12 libruby.dylib 0x00000001000459fc rb_gc_mark_locations + 59
13 libruby.dylib 0x0000000100047620 garbage_collect + 389
14 libruby.dylib 0x0000000100044c2d ruby_xmalloc + 107
15 libruby.dylib 0x0000000100033a76 scope_dup + 100
16 libruby.dylib 0x000000010002ab7d rb_yield_0 + 2646
17 libruby.dylib 0x0000000100034dbd proc_invoke + 1020
18 libruby.dylib 0x0000000100034f73 rb_proc_call + 39
19 libruby.dylib 0x000000010002e061 call_cfunc + 252
20 libruby.dylib 0x000000010002d16a rb_call0 + 1548
21 libruby.dylib 0x000000010002ebca rb_call + 711
22 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
23 libruby.dylib 0x00000001000251d0 rb_eval + 6859
24 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
25 libruby.dylib 0x000000010002ebca rb_call + 711
26 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
27 libruby.dylib 0x00000001000249fc rb_eval + 4855
28 libruby.dylib 0x000000010002716e rb_eval + 14953
29 libruby.dylib 0x000000010002a8f8 rb_yield_0 + 2001
30 libruby.dylib 0x0000000100034dbd proc_invoke + 1020
31 libruby.dylib 0x0000000100034f73 rb_proc_call + 39
32 libruby.dylib 0x000000010002e061 call_cfunc + 252
33 libruby.dylib 0x000000010002d16a rb_call0 + 1548
34 libruby.dylib 0x000000010002ebca rb_call + 711
35 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
36 libruby.dylib 0x00000001000251d0 rb_eval + 6859
37 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
38 libruby.dylib 0x000000010002ebca rb_call + 711
39 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
40 libruby.dylib 0x00000001000249fc rb_eval + 4855
41 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
42 libruby.dylib 0x000000010002ebca rb_call + 711
43 libruby.dylib 0x00000001000260fb rb_eval + 10742
44 libruby.dylib 0x0000000100025617 rb_eval + 7954
45 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
46 libruby.dylib 0x000000010002ebca rb_call + 711
47 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
48 libruby.dylib 0x00000001000270e5 rb_eval + 14816
49 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
50 libruby.dylib 0x000000010002ebca rb_call + 711
51 libruby.dylib 0x000000010002ed88 rb_f_send + 170
52 libruby.dylib 0x000000010002e080 call_cfunc + 283
53 libruby.dylib 0x000000010002d16a rb_call0 + 1548
54 libruby.dylib 0x000000010002ebca rb_call + 711
55 libruby.dylib 0x00000001000260fb rb_eval + 10742
56 libruby.dylib 0x0000000100024f5a rb_eval + 6229
57 libruby.dylib 0x00000001000251d0 rb_eval + 6859
58 libruby.dylib 0x00000001000251d0 rb_eval + 6859
59 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
60 libruby.dylib 0x000000010002ebca rb_call + 711
61 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
62 libruby.dylib 0x0000000100035764 block_pass + 460
63 libruby.dylib 0x000000010002473a rb_eval + 4149
64 libruby.dylib 0x000000010002a8f8 rb_yield_0 + 2001
65 libruby.dylib 0x000000010002ad2f rb_yield + 42
66 libruby.dylib 0x00000001000061e4 rb_ary_each + 100
67 libruby.dylib 0x000000010002e098 call_cfunc + 307
68 libruby.dylib 0x000000010002d16a rb_call0 + 1548
69 libruby.dylib 0x000000010002ebca rb_call + 711
70 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
71 libruby.dylib 0x00000001000249fc rb_eval + 4855
72 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
73 libruby.dylib 0x000000010002ebca rb_call + 711
74 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
75 libruby.dylib 0x0000000100035764 block_pass + 460
76 libruby.dylib 0x000000010002473a rb_eval + 4149
77 libruby.dylib 0x000000010002a8f8 rb_yield_0 + 2001
78 libruby.dylib 0x000000010002ad2f rb_yield + 42
79 libruby.dylib 0x00000001000061e4 rb_ary_each + 100
80 libruby.dylib 0x000000010002e098 call_cfunc + 307
81 libruby.dylib 0x000000010002d16a rb_call0 + 1548
82 libruby.dylib 0x000000010002ebca rb_call + 711
83 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
84 libruby.dylib 0x00000001000249fc rb_eval + 4855
85 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
86 libruby.dylib 0x000000010002ebca rb_call + 711
87 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
88 libruby.dylib 0x00000001000249fc rb_eval + 4855
89 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
90 libruby.dylib 0x000000010002ebca rb_call + 711
91 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
92 libruby.dylib 0x0000000100025617 rb_eval + 7954
93 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
94 libruby.dylib 0x000000010002ebca rb_call + 711
95 libruby.dylib 0x000000010002614c rb_eval + 10823
96 libruby.dylib 0x0000000100025617 rb_eval + 7954
97 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
98 libruby.dylib 0x000000010002ebca rb_call + 711
99 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
100 libruby.dylib 0x0000000100025617 rb_eval + 7954
101 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
102 libruby.dylib 0x000000010002ebca rb_call + 711
103 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
104 libruby.dylib 0x0000000100025b16 rb_eval + 9233
105 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
106 libruby.dylib 0x000000010002ebca rb_call + 711
107 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
108 libruby.dylib 0x000000010002dc1b rb_call0 + 4285
109 libruby.dylib 0x000000010002ebca rb_call + 711
110 libruby.dylib 0x0000000100025dc4 rb_eval + 9919
111 libruby.dylib 0x0000000100025f54 rb_eval + 10319
112 libruby.dylib 0x000000010002a8f8 rb_yield_0 + 2001
113 libruby.dylib 0x0000000100034dbd proc_invoke + 1020
114 libruby.dylib 0x0000000100032ba5 call_end_proc + 230
115 libruby.dylib 0x0000000100032eea rb_exec_end_proc + 559
116 libruby.dylib 0x000000010002051c ruby_finalize_0 + 170
117 libruby.dylib 0x00000001000205ab ruby_cleanup + 57
118 libruby.dylib 0x00000001000208c8 ruby_stop + 19
119 libruby.dylib 0x0000000100020937 compile_error + 0
120 ruby 0x0000000100000ebe dyld_stub_exit + 0
121 ruby 0x0000000100000e74 start + 52
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007fff5fbd7318 rcx: 0x00007fff5fbd6a68 rdx: 0x0000000000000000
rdi: 0x00000000000013c3 rsi: 0x0000000000000006 rbp: 0x00007fff5fbd6a80 rsp: 0x00007fff5fbd6a68
r8: 0x0000000000000002 r9: 0x0000000000000000 r10: 0x00007fff819bb026 r11: 0x0000000000000202
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x00007fff819befe6 rfl: 0x0000000000000202 cr2: 0x00007fff702e71f0
Binary Images:
0x100000000 - 0x100000fff +ruby ??? (???) <C71E7FFC-4129-BB10-8FCE-28CE6753E31E> /usr/local/bin/ruby
0x100003000 - 0x1000fefef +libruby.dylib ??? (???) <A02414BE-9EFE-F690-D8C0-997BC2330549> /usr/local/lib/libruby.dylib
0x1001e1000 - 0x1001e4fff +thread.bundle ??? (???) <CB4AF257-267F-182F-66B6-8A56E01A3843> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/thread.bundle
0x1001e8000 - 0x1001e9ff7 +etc.bundle ??? (???) <356F8541-C0F9-1A34-2C0A-A24035D55960> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/etc.bundle
0x1001ed000 - 0x1001f1ff7 +stringio.bundle ??? (???) <5890BE07-0D66-D7E5-B87B-37A0B06A901D> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/stringio.bundle
0x1001f5000 - 0x1001f9ff7 +strscan.bundle ??? (???) <E6F3DCE7-603E-9472-9C6D-99CD225C494C> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/strscan.bundle
0x1001fd000 - 0x1001fdfff +fcntl.bundle ??? (???) <0F2B8F5B-9F5F-0F82-D1B8-7AB339B5ADA3> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/fcntl.bundle
0x1004b0000 - 0x1004d0fff +syck.bundle ??? (???) <D34A7A9E-C28F-77A5-F95E-5F8A22F19676> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/syck.bundle
0x1004d8000 - 0x1004e5ff7 +bigdecimal.bundle ??? (???) <D9C91EF5-3814-8624-6601-23BF6AD032A3> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/bigdecimal.bundle
0x1004e9000 - 0x1004eaff7 +fast_xs.bundle ??? (???) <7A793C27-7A68-F8E2-DFAB-9F4ABADBBC14> /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.8.2/lib/fast_xs.bundle
0x1004ed000 - 0x1004f5ff7 +zlib.bundle ??? (???) <83CB4E6E-F717-CB1F-D410-BC6F305B4AF4> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/zlib.bundle
0x1004fa000 - 0x1004fafff +md5.bundle ??? (???) <71A83C69-A0CB-3682-18E2-09B644E687D5> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/digest/md5.bundle
0x1004fd000 - 0x1004fdfff +sha1.bundle ??? (???) <049D08F4-BC16-D2E7-04B9-CBB1E89CC01D> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/digest/sha1.bundle
0x10073d000 - 0x10076efff +nkf.bundle ??? (???) <CB4E2B49-D8D7-29B2-9215-67BECCD45AA3> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/nkf.bundle
0x100781000 - 0x10078bfff +socket.bundle ??? (???) <431898C6-794A-BF22-A125-B7D60D554CDA> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/socket.bundle
0x100790000 - 0x100791fff +digest.bundle ??? (???) <955B9322-A593-9926-110F-449CBDA89DF9> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/digest.bundle
0x100795000 - 0x1007a1fff +bluecloth_ext.bundle ??? (???) <875327C8-E817-9F12-0EE4-6A49562C3F8E> /usr/local/lib/ruby/gems/1.8/gems/bluecloth-2.0.5/lib/bluecloth_ext.bundle
0x1007a6000 - 0x1007e2ff7 +openssl.bundle ??? (???) <499510E9-913B-A675-3075-9A0AEC5634B8> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/openssl.bundle
0x10123a000 - 0x1012abfff +redcloth_scan.bundle ??? (???) <96734FEE-7F82-4F10-D8C2-DA1FDC433DAC> /usr/local/lib/ruby/gems/1.8/gems/RedCloth-4.2.2/lib/redcloth_scan.bundle
0x1012af000 - 0x1012b2ff7 +cparse.bundle ??? (???) <EF75611D-1C93-CF58-C128-85D7CF8A061B> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/racc/cparse.bundle
0x1012b5000 - 0x1012b7ff7 +iconv.bundle ??? (???) <BDB48C60-66D8-036F-D6E9-F7669CBDA16C> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/iconv.bundle
0x1012bb000 - 0x1012bffff +parser.bundle ??? (???) <261FDCD0-29C8-8A3B-9B72-D4BC51715B67> /usr/local/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser.bundle
0x1012c3000 - 0x1012c7ff7 +generator.bundle ??? (???) <B354DFF3-AE88-AC13-2D6A-C8827C0033F2> /usr/local/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/generator.bundle
0x1012cb000 - 0x1012dafff +nokogiri.bundle ??? (???) <81F28AEC-FF97-8911-4728-9253F14205F3> /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/nokogiri.bundle
0x1012eb000 - 0x1012f2ff7 +ruby_debug.bundle ??? (???) <2AA2B821-3C45-14A6-9573-38D651556B36> /Users/lbayes/.gem/ruby/1.8/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle
0x1012f7000 - 0x1012f9fff +trace_nums.bundle ??? (???) <70D184EC-461F-D2E6-8094-B56FB2BACE83> /Users/lbayes/.gem/ruby/1.8/gems/linecache-0.43/ext/trace_nums.bundle
0x101802000 - 0x101815fe7 +libexslt.0.dylib ??? (???) <FD064ED5-7CC6-E58E-00DD-06775F1BBE72> /usr/local/lib/libexslt.0.dylib
0x10181b000 - 0x10185bff7 +libxslt.1.dylib ??? (???) <8A989A1C-85AE-2CE9-068A-C6DCDF839566> /usr/local/lib/libxslt.1.dylib
0x101867000 - 0x101869ff7 +readline.bundle ??? (???) <79F5B425-0C27-CF59-2EE6-E05AFE3EF850> /usr/local/lib/ruby/1.8/i686-darwin10.0.0/readline.bundle
0x10186d000 - 0x101889ff7 libedit.2.dylib ??? (???) <F9D005F8-74B8-CC05-2697-24C49E0CC1EF> /usr/lib/libedit.2.dylib
0x101898000 - 0x1018a6fff +sqlite3_api.bundle ??? (???) <50ED247E-9C93-8CA1-8E7E-18F715A60DE9> /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3_api.bundle
0x103900000 - 0x103a83fe7 +libxml2.2.dylib ??? (???) <0B99B8DC-820C-FCE2-B37E-3D4B6BA67EDE> /usr/local/lib/libxml2.2.dylib
0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???) <B633F790-4DDB-53CD-7ACF-2A3682BCEA9F> /usr/lib/dyld
0x7fff808d1000 - 0x7fff808d2ff7 com.apple.TrustEvaluationAgent 1.1 (1) <51867586-1C71-AE37-EAAD-535A58DD3550> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent
0x7fff81877000 - 0x7fff8196ffe7 libiconv.2.dylib ??? (???) <ECEE3D93-B5E3-F0E0-803E-CA3DC3B33D57> /usr/lib/libiconv.2.dylib
0x7fff81970000 - 0x7fff81b2eff7 libSystem.B.dylib ??? (???) <526DD3E5-2A8B-4512-ED97-01B832369959> /usr/lib/libSystem.B.dylib
0x7fff833f5000 - 0x7fff834aefff libsqlite3.dylib ??? (???) <5A15E12A-AE8F-1A36-BBC7-564E7D7AD0FB> /usr/lib/libsqlite3.dylib
0x7fff85363000 - 0x7fff853e0fef libstdc++.6.dylib ??? (???) <35ECA411-2C08-FD7D-11B1-1B7A04921A5C> /usr/lib/libstdc++.6.dylib
0x7fff853e1000 - 0x7fff853f2fef libz.1.dylib ??? (???) <3A7A4C48-A4C8-A78A-8B87-C0DDF6601AC8> /usr/lib/libz.1.dylib
0x7fff85cf9000 - 0x7fff85d38fef libncurses.5.4.dylib ??? (???) <E0A07C12-D912-DF26-9E38-C50484D96EB0> /usr/lib/libncurses.5.4.dylib
0x7fff86662000 - 0x7fff86783fe7 libcrypto.0.9.8.dylib ??? (???) <32F2A87F-B146-BBF2-3AD1-494C686F1EE3> /usr/lib/libcrypto.0.9.8.dylib
0x7fff87f25000 - 0x7fff87f5ffff libssl.0.9.8.dylib ??? (???) <0714FA32-C193-CD96-80D1-6FCF06A0ED2E> /usr/lib/libssl.0.9.8.dylib
0x7fff886ad000 - 0x7fff886f9fff libauto.dylib ??? (???) <072804DF-36AD-2DBE-7EF8-639CFB79077F> /usr/lib/libauto.dylib
0x7fff88894000 - 0x7fff8894afff libobjc.A.dylib ??? (???) <F206BE6D-8777-AE6C-B367-7BEA76C14241> /usr/lib/libobjc.A.dylib
0x7fff88c99000 - 0x7fff88c9dff7 libmathCommon.A.dylib ??? (???) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???) <526DD3E5-2A8B-4512-ED97-01B832369959> /usr/lib/libSystem.B.dylib
最佳答案
好的,我已经在我的机器上修复了这个问题。我不确定具体原因,但是将 ruby-debug gem 降级到版本 0.10.0 可以解决我的问题。
具体修复是运行以下命令:
sudo gem uninstall ruby-debug
sudo gem install ruby-debug --version 0.10.0
关于ruby-on-rails - 为什么 Ruby 只在我的系统上抛出一个段错误,而且只在这个 Rails 应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2112371/
以下是一个非常简单的ruby服务器。 require 'socket' local_socket = Socket.new(:INET, :STREAM) local_addr = Socket.
我正在使用 OS X(使用 bash),并且是 unix 的新手。我想知道是否可以修改一些文件以便运行 ruby 程序,我不需要“ruby file.rb”,而是可以运行“ruby.rb”。 有理
我在用 Ruby 替换字符串时遇到一些问题。 我的原文:人之所为不如兽之所为。 我想替换为:==What== human does is not like ==what== animal does.
我想在一个循环中从 Ruby 脚本做这样的事情: 写一个文件a.rb(每次迭代都会改变) 执行系统(ruby 'a.rb') a.rb 将带有结果的字符串写入文件“results” a.rb 完成并且
我的问题是尝试创建一个本地服务器,以便我可以理解由我的新团队开发的应用程序。我的问题是我使用的是 Ruby 2.3.3,而 Gemfile 需要 2.3.1。我无法编辑 Gemfile,因为我被告知很
我有一个使用 GLI 框架用 Ruby 编写的命令行实用程序。我想在我的主目录中配置我的命令行实用程序,使用 Ruby 本身作为 DSL 来处理它(类似于 Gemfile 或 Rakefile)。 我
我的 Rails 应用 Controller 中有这段代码: def delete object = model.datamapper_class.first(:sourced_id =>
我正在寻找的解析器应该: 对 Ruby 解析友好, 规则设计优雅, 产生用户友好的解析错误, 用户文档的数量应该比计算器示例多, UPD:允许在编写语法时省略可选的空格。 快速解析不是一个重要的特性。
我刚开始使用 Ruby,听说有一种“Ruby 方式”编码。除了 Ruby on Rails 之外,还有哪些项目适合学习并被认可且设计良好? 最佳答案 Prawn被明确地创建为不仅是一个该死的好 PDF
我知道之前有人问过类似的问题,但是我该如何构建一个无需在前面输入“ruby”就可以在终端中运行的 Ruby 文件呢? 这里的最终目标是创建一个命令行工具包类型的东西。现在,为了执行我希望用户能够执行的
例如哈希a是{:name=>'mike',:age=>27,:gender=>'male'}哈希 b 是 {:name=>'mike'} 我想知道是否有更好的方法来判断 b 哈希是否在 a 哈希内,而
我是一名决定学习 Ruby 和 Ruby on Rails 的 ASP.NET MVC 开发人员。我已经有所了解并在 RoR 上创建了一个网站。在 ASP.NET MVC 上开发,我一直使用三层架构:
最近我看到 Gary Bernhardt 展示了他用来在 vim 中执行 Ruby 代码的 vim 快捷方式。捷径是 :map ,t :w\|:!ruby %. 似乎这个方法总是执行系统 Rub
在为 this question about Blue Ruby 选择的答案中,查克说: All of the current Ruby implementations are compiled to
我有一个 Ruby 数组 > list = Request.find_all_by_artist("Metallica").map(&:song) => ["Nothing else Matters"
我在四舍五入时遇到问题。我有一个 float ,我想将其四舍五入到小数点后的百分之一。但是,我只能使用 .round ,它基本上将它变成一个 int,意思是 2.34.round # => 2. 有没
我使用 ruby on rails 编写了一个小型 Web 应用程序,它的主要目的是上传、存储和显示来自 xml(文件最多几 MB)文件的结果。运行大约 2 个月后,我注意到 mongrel 进程
我们如何用 Ruby 转换像这样的字符串: 𝑙𝑎𝑡𝑜𝑟𝑟𝑒 收件人: Latorre 最佳答案 s = "𝑙𝑎𝑡𝑜𝑟𝑟𝑒" => "𝑙𝑎𝑡𝑜𝑟𝑟𝑒" s.u
通过 ruby monk 时,他们偶尔会从左侧字段中抛出一段语法不熟悉的代码: def compute(xyz) return nil unless xyz xyz.map {|a,
不确定我做错了什么,但我似乎弄错了。 问题是,给你一串空格分隔的数字,你必须返回最大和最小的数字。 注意:所有数字都是有效的 Int32,不需要验证它们。输入字符串中始终至少有一个数字。输出字符串必须
我是一名优秀的程序员,十分优秀!