Guest User

Untitled

a guest
Jun 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. x=1
  4. while x<10
  5. puts "It Work!"
  6. x+=1
  7. end
  8.  
  9. #include <ruby-2.0.0/ruby.h>
  10.  
  11. int main(int argc, char **argv){
  12. ruby_init();
  13.  
  14. ruby_script("file.rb");
  15. void *node = rb_load_file("file.rb");
  16. ruby_run_node(node); // O erro se origina nessa linha
  17.  
  18. ruby_finalize();
  19.  
  20. return 0;
  21. }
  22.  
  23. file.rb: [BUG] Segmentation fault
  24. ruby 2.0.0p647 (2015-08-18 revision 51631) [x86_64-linux]
  25.  
  26. -- Control frame information -----------------------------------------------
  27. c:0001 p:0000 s:0002 E:0009b8 TOP [FINISH]
  28.  
  29.  
  30. -- C level backtrace information -------------------------------------------
  31. /usr/lib64/libruby20.so.2.0(+0x1786cb) [0x7fcb381966cb]
  32. /usr/lib64/libruby20.so.2.0(+0x64a6a) [0x7fcb38082a6a]
  33. /usr/lib64/libruby20.so.2.0(rb_bug+0xb3) [0x7fcb38083173]
  34. /usr/lib64/libruby20.so.2.0(+0x111954) [0x7fcb3812f954]
  35. /lib64/libpthread.so.0(+0x10740) [0x7fcb37e12740]
  36. /usr/lib64/libruby20.so.2.0(+0x1618dc) [0x7fcb3817f8dc]
  37. /usr/lib64/libruby20.so.2.0(rb_iseq_eval_main+0x57) [0x7fcb38192357]
  38. /usr/lib64/libruby20.so.2.0(+0x67ff6) [0x7fcb38085ff6]
  39. /usr/lib64/libruby20.so.2.0(ruby_exec_node+0x1d) [0x7fcb380876ed]
  40. /usr/lib64/libruby20.so.2.0(ruby_run_node+0x1e) [0x7fcb380891fe]
  41. ./a.out() [0x40086e]
  42. /lib64/libc.so.6(__libc_start_main+0xf0) [0x7fcb371417b0]
  43. ./a.out() [0x400769]
  44.  
  45. -- Other runtime information -----------------------------------------------
  46.  
  47. * Loaded script: file.rb
  48.  
  49. * Loaded features:
  50.  
  51. 0 enumerator.so
  52.  
  53. * Process memory map:
  54.  
  55. 00400000-00401000 r-xp 00000000 08:06 32636932 /mnt/hd_6/user_files/Projects/C_C++/Exemplos/Ruby/run_file/a.out
  56. 00600000-00601000 r--p 00000000 08:06 32636932 /mnt/hd_6/user_files/Projects/C_C++/Exemplos/Ruby/run_file/a.out
  57. 00601000-00602000 rw-p 00001000 08:06 32636932 /mnt/hd_6/user_files/Projects/C_C++/Exemplos/Ruby/run_file/a.out
  58. 014ae000-01614000 rw-p 00000000 00:00 0 [heap]
  59. 7fcb36f0a000-7fcb36f20000 r-xp 00000000 08:01 1451507 /usr/lib64/gcc/x86_64-pc-linux-gnu/5.3.0/libgcc_s.so.1
  60. 7fcb36f20000-7fcb3711f000 ---p 00016000 08:01 1451507 /usr/lib64/gcc/x86_64-pc-linux-gnu/5.3.0/libgcc_s.so.1
  61. 7fcb3711f000-7fcb37120000 r--p 00015000 08:01 1451507 /usr/lib64/gcc/x86_64-pc-linux-gnu/5.3.0/libgcc_s.so.1
  62. 7fcb37120000-7fcb37121000 rw-p 00016000 08:01 1451507 /usr/lib64/gcc/x86_64-pc-linux-gnu/5.3.0/libgcc_s.so.1
  63. 7fcb37121000-7fcb372b2000 r-xp 00000000 08:01 9437453 /lib64/libc-2.21.so
  64. 7fcb372b2000-7fcb374b2000 ---p 00191000 08:01 9437453 /lib64/libc-2.21.so
  65. 7fcb374b2000-7fcb374b6000 r--p 00191000 08:01 9437453 /lib64/libc-2.21.so
  66. 7fcb374b6000-7fcb374b8000 rw-p 00195000 08:01 9437453 /lib64/libc-2.21.so
  67. 7fcb374b8000-7fcb374bc000 rw-p 00000000 00:00 0
  68. 7fcb374bc000-7fcb375be000 r-xp 00000000 08:01 9437326 /lib64/libm-2.21.so
  69. 7fcb375be000-7fcb377bd000 ---p 00102000 08:01 9437326 /lib64/libm-2.21.so
  70. 7fcb377bd000-7fcb377be000 r--p 00101000 08:01 9437326 /lib64/libm-2.21.so
  71. 7fcb377be000-7fcb377bf000 rw-p 00102000 08:01 9437326 /lib64/libm-2.21.so
  72. 7fcb377bf000-7fcb377c7000 r-xp 00000000 08:01 9437459 /lib64/libcrypt-2.21.so
  73. 7fcb377c7000-7fcb379c6000 ---p 00008000 08:01 9437459 /lib64/libcrypt-2.21.so
  74. 7fcb379c6000-7fcb379c7000 r--p 00007000 08:01 9437459 /lib64/libcrypt-2.21.so
  75. 7fcb379c7000-7fcb379c8000 rw-p 00008000 08:01 9437459 /lib64/libcrypt-2.21.so
  76. 7fcb379c8000-7fcb379f6000 rw-p 00000000 00:00 0
  77. 7fcb379f6000-7fcb379f8000 r-xp 00000000 08:01 9437340 /lib64/libdl-2.21.so
  78. 7fcb379f8000-7fcb37bf8000 ---p 00002000 08:01 9437340 /lib64/libdl-2.21.so
  79. 7fcb37bf8000-7fcb37bf9000 r--p 00002000 08:01 9437340 /lib64/libdl-2.21.so
  80. 7fcb37bf9000-7fcb37bfa000 rw-p 00003000 08:01 9437340 /lib64/libdl-2.21.so
  81. 7fcb37bfa000-7fcb37c00000 r-xp 00000000 08:01 9437461 /lib64/librt-2.21.so
  82. 7fcb37c00000-7fcb37e00000 ---p 00006000 08:01 9437461 /lib64/librt-2.21.so
  83. 7fcb37e00000-7fcb37e01000 r--p 00006000 08:01 9437461 /lib64/librt-2.21.so
  84. 7fcb37e01000-7fcb37e02000 rw-p 00007000 08:01 9437461 /lib64/librt-2.21.so
  85. 7fcb37e02000-7fcb37e19000 r-xp 00000000 08:01 9437244 /lib64/libpthread-2.21.so
  86. 7fcb37e19000-7fcb38018000 ---p 00017000 08:01 9437244 /lib64/libpthread-2.21.so
  87. 7fcb38018000-7fcb38019000 r--p 00016000 08:01 9437244 /lib64/libpthread-2.21.so
  88. 7fcb38019000-7fcb3801a000 rw-p 00017000 08:01 9437244 /lib64/libpthread-2.21.so
  89. 7fcb3801a000-7fcb3801e000 rw-p 00000000 00:00 0
  90. 7fcb3801e000-7fcb38254000 r-xp 00000000 08:01 552009 /usr/lib64/libruby20.so.2.0.0
  91. 7fcb38254000-7fcb38453000 ---p 00236000 08:01 552009 /usr/lib64/libruby20.so.2.0.0
  92. 7fcb38453000-7fcb38458000 r--p 00235000 08:01 552009 /usr/lib64/libruby20.so.2.0.0
  93. 7fcb38458000-7fcb3845b000 rw-p 0023a000 08:01 552009 /usr/lib64/libruby20.so.2.0.0
  94. 7fcb3845b000-7fcb3847c000 rw-p 00000000 00:00 0
  95. 7fcb3847c000-7fcb3849e000 r-xp 00000000 08:01 9437444 /lib64/ld-2.21.so
  96. 7fcb38561000-7fcb38667000 rw-p 00000000 00:00 0
  97. 7fcb38697000-7fcb38698000 rw-p 00000000 00:00 0
  98. 7fcb38698000-7fcb38699000 ---p 00000000 00:00 0
  99. 7fcb38699000-7fcb3869d000 rw-p 00000000 00:00 0 [stack:1615]
  100. 7fcb3869d000-7fcb3869e000 r--p 00021000 08:01 9437444 /lib64/ld-2.21.so
  101. 7fcb3869e000-7fcb3869f000 rw-p 00022000 08:01 9437444 /lib64/ld-2.21.so
  102. 7fcb3869f000-7fcb386a0000 rw-p 00000000 00:00 0
  103. 7ffc603fb000-7ffc6041d000 rw-p 00000000 00:00 0
  104. 7ffc6048c000-7ffc6048e000 r--p 00000000 00:00 0 [vvar]
  105. 7ffc6048e000-7ffc60490000 r-xp 00000000 00:00 0 [vdso]
  106. ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
  107.  
  108.  
  109. [NOTE]
  110. You may have encountered a bug in the Ruby interpreter or extension libraries.
  111. Bug reports are welcome.
  112. For details: http://www.ruby-lang.org/bugreport.html
  113.  
  114. Abortado
  115.  
  116. ruby_setup();
  117. rb_require("./file"); // ou "./file.rb"
  118. ruby_finalize();
Add Comment
Please, Sign In to add comment