ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* How to debug ?
@ 2003-09-19  7:57 Torsten Rueger
  2003-09-19  9:22 ` ts
  0 siblings, 1 reply; 6+ messages in thread
From: Torsten Rueger @ 2003-09-19  7:57 UTC (permalink / raw
  To: ruby-core

Moi,

the following is probably not a ruby problem, but rather something I do 
in my extension.
My question is just, how do I debug such a problem ?

Any help appreciated

Torsten

PS:The "Recovering" lines are where I use rb_intern, with the given 
symbol
PPS: I'm not sure when my recovery code runs, but by the looks of it 
maybe before the full parsing is done.


(gdb) run -d test/all.rb
Starting program: /usr/local/bin/ruby -d test/all.rb
Recovering ./purple.db
Recovering symbol Test::Tester with purple id 614 + id 3061518
Recovering symbol @obj with purple id 615 + id 2673166
Recovering symbol Purple with purple id 624 + id 2551054
Recovering symbol new with purple id 625 + id 860430
Recovering symbol initialize with purple id 626 + id 758030

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00068da4 in st_lookup (table=0x1ddc40, key=3285456, value=0xbffea2c0) 
at st.c:259
259         FIND_ENTRY(table, ptr, hash_val, bin_pos);
(gdb) where
#0  0x00068da4 in st_lookup (table=0x1ddc40, key=3285456, 
value=0xbffea2c0) at st.c:259
#1  0x00034d2c in rb_intern (name=0x3221d0 "test_strings") at 
parse.y:5820
#2  0x0000aba4 in rb_obj_respond_to (argc=146714437, argv=0x3221d0, 
obj=3579144) at eval.c:3730
#3  0x0000d8a0 in rb_call0 (klass=2432160, recv=3579144, id=3943, 
oid=3943, argc=1, argv=0xbffea8c0, body=0x25010c, nosuper=0) at 
eval.c:4906
#4  0x0000e1b4 in rb_call (klass=2432160, recv=3943, mid=3221136224, 
argc=1, argv=0xbffea8c0, scope=704748) at eval.c:5123
#5  0x00008c94 in rb_eval (self=3579144, n=0x3221d0) at ruby.h:626
#6  0x00008380 in rb_eval (self=3579144, n=0x3221d0) at eval.c:2879
#7  0x00009564 in rb_eval (self=3579144, n=0x3221d0) at eval.c:3147
#8  0x0000750c in rb_eval (self=3579144, n=0x3221d0) at eval.c:2550
#9  0x0000dd4c in rb_call0 (klass=0, recv=0, id=3221156896, oid=0, 
argc=57780, argv=0x369dd0, body=0x1, nosuper=2301720) at eval.c:5034
#10 0x0000e1b4 in rb_call (klass=3683444, recv=0, mid=3221155584, 
argc=1, argv=0xbffefa50, scope=1) at eval.c:5123
#11 0x000110a8 in rb_obj_call_init (obj=3579144, argc=1, 
argv=0xbffefa50) at eval.c:6257
#12 0x00022c2c in rb_class_new_instance (argc=694224, argv=0x369d08, 
klass=3221136064) at object.c:761
#13 0x0000d8a0 in rb_call0 (klass=2432240, recv=3639304, id=3361, 
oid=3361, argc=1, argv=0xbffefa50, body=0x250b34, nosuper=0) at 
eval.c:4906
#14 0x0000e1b4 in rb_call (klass=2432240, recv=3361, mid=3221157104, 
argc=-1073808816, argv=0xbffefa50, scope=704748) at eval.c:5123
#15 0x00008c94 in rb_eval (self=3639304, n=0x3221d0) at ruby.h:626
#16 0x00008914 in rb_eval (self=3639304, n=0x3221d0) at eval.c:2988
#17 0x0000bae4 in rb_yield_0 (val=2779406, self=3639304, klass=0, 
flags=0, avalue=0) at eval.c:4155
#18 0x0001a0e4 in rb_f_catch (dmy=146714437, tag=2779406) at 
eval.c:10069
#19 0x0000d8a0 in rb_call0 (klass=2432160, recv=3639304, id=3993, 
oid=3993, argc=1, argv=0xbfff2ef0, body=0x24ff04, nosuper=0) at 
eval.c:4906
#20 0x0000e1b4 in rb_call (klass=2432160, recv=3993, mid=3221170576, 
argc=1, argv=0xbfff2ef0, scope=704748) at eval.c:5123
#21 0x00008c94 in rb_eval (self=3639304, n=0x3221d0) at ruby.h:626
#22 0x00007c08 in rb_eval (self=3639304, n=0x3221d0) at eval.c:2717
#23 0x0000bae4 in rb_yield_0 (val=3580944, self=3639304, klass=0, 
flags=0, avalue=0) at eval.c:4155
#24 0x00026cb8 in rb_ary_each (ary=3221181008) at array.c:817
#25 0x0000d8a0 in rb_call0 (klass=2404920, recv=3581724, id=3825, 
oid=3825, argc=0, argv=0x0, body=0x24ae14, nosuper=0) at eval.c:4906
#26 0x0000e1b4 in rb_call (klass=2404920, recv=3825, mid=3221182992, 
argc=0, argv=0x0, scope=704748) at eval.c:5123
#27 0x00008c94 in rb_eval (self=3639304, n=0x3221d0) at ruby.h:626
#28 0x00007c08 in rb_eval (self=3639304, n=0x3221d0) at eval.c:2717
#29 0x0000dd4c in rb_call0 (klass=1070952027, recv=1346109440, 
id=1086754455, oid=0, argc=0, argv=0x0, body=0xbfff87a0, 
nosuper=2300700) at eval.c:5034
#30 0x0000e1b4 in rb_call (klass=3683424, recv=0, mid=3221193344, 
argc=0, argv=0x0, scope=0) at eval.c:5123
#31 0x00008c94 in rb_eval (self=2427420, n=0x3221d0) at ruby.h:626
#32 0x00008914 in rb_eval (self=2427420, n=0x3221d0) at eval.c:2988
#33 0x0000bae4 in rb_yield_0 (val=3639304, self=2427420, klass=0, 
flags=0, avalue=0) at eval.c:4155
#34 0x00026cb8 in rb_ary_each (ary=3221203776) at array.c:817
#35 0x0000d8a0 in rb_call0 (klass=2404920, recv=3593544, id=3825, 
oid=3825, argc=0, argv=0x0, body=0x24ae14, nosuper=0) at eval.c:4906
#36 0x0000e1b4 in rb_call (klass=2404920, recv=3825, mid=3221205760, 
argc=0, argv=0x0, scope=704748) at eval.c:5123
#37 0x00008c94 in rb_eval (self=2427420, n=0x3221d0) at ruby.h:626
#38 0x00007c08 in rb_eval (self=2427420, n=0x3221d0) at eval.c:2717
#39 0x0000bae4 in rb_yield_0 (val=3598804, self=2427420, klass=0, 
flags=0, avalue=2) at eval.c:4155
#40 0x00013080 in proc_invoke (proc=3664704, args=3598804, self=6, 
klass=0) at ruby.h:626
#41 0x000115e8 in call_end_proc (data=3664704) at eval.c:6427
#42 0x000117b4 in rb_exec_end_proc () at eval.c:6461
#43 0x00004400 in ruby_finalize_0 (exp=0xbffffbf8) at eval.c:1332
#44 0x000045a0 in ruby_cleanup (ex=0) at eval.c:1368
#45 0x000046d4 in ruby_stop (ex=146714437) at eval.c:1395
#46 0x00002274 in main (argc=-1073751136, argv=0xbfffe360, 
envp=0xbffea2c0) at main.c:50

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to debug ?
  2003-09-19  7:57 How to debug ? Torsten Rueger
@ 2003-09-19  9:22 ` ts
  2003-09-19 11:13   ` Torsten Rueger
  0 siblings, 1 reply; 6+ messages in thread
From: ts @ 2003-09-19  9:22 UTC (permalink / raw
  To: ruby-core; +Cc: ruby-core

>>>>> "T" == Torsten Rueger <torsten.rueger@hiit.fi> writes:

T> #41 0x000115e8 in call_end_proc (data=3664704) at eval.c:6427

 Do you have defined end proc, via rb_set_end_proc() or any other
 mechanism ?

 If yes, verify that this proc don't use object which was GC'ed

p.s.:
  I really think that ruby-core is not adapted for problem specifics to
  extensions. 


Guy Decoux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to debug ?
  2003-09-19  9:22 ` ts
@ 2003-09-19 11:13   ` Torsten Rueger
  2003-09-19 11:30     ` ts
  0 siblings, 1 reply; 6+ messages in thread
From: Torsten Rueger @ 2003-09-19 11:13 UTC (permalink / raw
  To: ruby-core

On Friday, Sep 19, 2003, at 12:22 Europe/Helsinki, ts wrote:
> T> #41 0x000115e8 in call_end_proc (data=3664704) at eval.c:6427
>
>  Do you have defined end proc, via rb_set_end_proc() or any other
>  mechanism ?
It's the unit test framework.

>  If yes, verify that this proc don't use object which was GC'ed

I don't understand, sorry.  How can any ruby code use an object that is 
GC'd.
And then, how would I check?

> p.s.:
>   I really think that ruby-core is not adapted for problem specifics to
>   extensions.

Well I though about that, especially 'cause you said it before: My 
conclusion was that what I sent is a "pure" ruby stack trace. No code 
of mine involved.
So I though it would at least be interesting to understand how such a 
thing can happen (for core developers I mean)

But then I'd like to ask this also: Is is possible to create a new 
list, english speaking, list for extension programmers, maybe 
ruby-ext-en ?
Is there someone on this list who could create such a list ?

Torsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to debug ?
  2003-09-19 11:13   ` Torsten Rueger
@ 2003-09-19 11:30     ` ts
  2003-09-19 12:13       ` Torsten Rueger
  0 siblings, 1 reply; 6+ messages in thread
From: ts @ 2003-09-19 11:30 UTC (permalink / raw
  To: ruby-core; +Cc: ruby-core

>>>>> "T" == Torsten Rueger <torsten.rueger@hiit.fi> writes:

T> Well I though about that, especially 'cause you said it before: My 
T> conclusion was that what I sent is a "pure" ruby stack trace. No code 
T> of mine involved.

 It take me a few seconds to write an extension which crash ruby : now I
 can send you a "pure" ruby stack trace and ask you to debug my extension
 without giving the source. Can you do it ?

T> So I though it would at least be interesting to understand how such a 
T> thing can happen (for core developers I mean)

 You don't give enough information : the problem is perhaps in your
 extension and nobody can know whith the information that you give.

 One rule is to first search the bug in your extension, before trying to
 look in ruby.


Guy Decoux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to debug ?
  2003-09-19 11:30     ` ts
@ 2003-09-19 12:13       ` Torsten Rueger
  2003-09-19 12:30         ` ts
  0 siblings, 1 reply; 6+ messages in thread
From: Torsten Rueger @ 2003-09-19 12:13 UTC (permalink / raw
  To: ruby-core

>  It take me a few seconds to write an extension which crash ruby : now 
> I
>  can send you a "pure" ruby stack trace and ask you to debug my 
> extension
>  without giving the source. Can you do it ?
You must be right, I am on the wrong list. This is not helpful at all.
It crashed in rb_intern, I should have though that's robust, or you'd 
be interested in getting it robust (I mean it's ok to raise an 
exception but ruby shouldn't really crash in it's own)
But if you're ok with this approach that you could write something to 
crash ruby in a few seconds extension coding, fine by me.
I'll sign off soon.

>  You don't give enough information : the problem is perhaps in your
>  extension and nobody can know whith the information that you give.
I had posted a link. purple.rubyforge.org .

>  One rule is to first search the bug in your extension, before trying 
> to look in ruby.
Thank you. Yes I did that. Extensively. I have lots of test code, in 
fact that's how I found this bug.
(And please remember, I wasn't asking you to fix it)

So my two questions remain open:

How can I debug such a problem: I mean how do I even find out what all 
thise eveal and funcalls do ? Is there some debug switch, so I can 
recompile ruby and it checks (asserts) all its assumptions about input 
to the functions? Along those lines. (I understand if noone wants to 
answer this after these comments)

But the other: Is there anyone here that can create a new list? 
(Because ruby-talk is way too full and general)

Thanks
   Torsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to debug ?
  2003-09-19 12:13       ` Torsten Rueger
@ 2003-09-19 12:30         ` ts
  0 siblings, 0 replies; 6+ messages in thread
From: ts @ 2003-09-19 12:30 UTC (permalink / raw
  To: ruby-core; +Cc: ruby-core

>>>>> "T" == Torsten Rueger <torsten.rueger@hiit.fi> writes:

T> How can I debug such a problem: I mean how do I even find out what all 
T> thise eveal and funcalls do ? Is there some debug switch, so I can 

 You have not given the most important information : it crash when you use
 testunit no ?

 Try first to run it out of testunit if you can.

 What is your version of ruby ?


Guy Decoux

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-09-19 12:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-19  7:57 How to debug ? Torsten Rueger
2003-09-19  9:22 ` ts
2003-09-19 11:13   ` Torsten Rueger
2003-09-19 11:30     ` ts
2003-09-19 12:13       ` Torsten Rueger
2003-09-19 12:30         ` ts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).