ruby-debug-base19 0.11.21 → 0.11.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/ruby_debug/ruby_debug.c +15 -19
  2. metadata +2 -2
@@ -726,7 +726,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
726
726
 
727
727
  hook_count++;
728
728
 
729
- if ((iseq == NULL) && (event != RUBY_EVENT_RAISE))
729
+ if (((iseq == NULL) || (file == NULL)) && (event != RUBY_EVENT_RAISE))
730
730
  return;
731
731
  thread_context_lookup(thread->self, &context, &debug_context, 1);
732
732
 
@@ -1783,10 +1783,8 @@ context_frame_line(int argc, VALUE *argv, VALUE self)
1783
1783
  {
1784
1784
  VALUE frame;
1785
1785
  debug_context_t *debug_context;
1786
- debug_frame_t *debug_frame;
1787
- rb_control_frame_t *cfp;
1788
- rb_control_frame_t *cfp_end;
1789
1786
  rb_thread_t *th;
1787
+ rb_control_frame_t *cfp;
1790
1788
  VALUE *pc;
1791
1789
 
1792
1790
  debug_check_started();
@@ -1794,14 +1792,9 @@ context_frame_line(int argc, VALUE *argv, VALUE self)
1794
1792
  Data_Get_Struct(self, debug_context_t, debug_context);
1795
1793
  GetThreadPtr(context_thread_0(debug_context), th);
1796
1794
 
1797
- debug_frame = get_top_frame(debug_context);
1798
- if (debug_frame == NULL)
1799
- return(INT2FIX(0));
1800
-
1801
1795
  pc = GET_FRAME->info.runtime.last_pc;
1802
- cfp_end = RUBY_VM_END_CONTROL_FRAME(th);
1803
1796
  cfp = GET_FRAME->info.runtime.cfp;
1804
- while (cfp > (rb_control_frame_t*)th->stack)
1797
+ while (cfp > th->cfp)
1805
1798
  {
1806
1799
  if ((cfp->iseq != NULL) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
1807
1800
  return(INT2FIX(rb_vm_get_sourceline(cfp)));
@@ -1923,7 +1916,11 @@ context_copy_locals(debug_context_t *debug_context, debug_frame_t *debug_frame,
1923
1916
  {
1924
1917
  /* Note rb_iseq_disasm() is instructive in coming up with this code */
1925
1918
  for (i = 0; i < iseq->local_table_size; i++)
1926
- rb_hash_aset(hash, rb_id2str(iseq->local_table[i]), *(cfp->dfp - iseq->local_size + i));
1919
+ {
1920
+ VALUE str = rb_id2str(iseq->local_table[i]);
1921
+ if (str != 0)
1922
+ rb_hash_aset(hash, str, *(cfp->dfp - iseq->local_size + i));
1923
+ }
1927
1924
  }
1928
1925
 
1929
1926
  iseq = cfp->block_iseq;
@@ -1937,7 +1934,11 @@ context_copy_locals(debug_context_t *debug_context, debug_frame_t *debug_frame,
1937
1934
  if (block_frame->iseq == cfp->block_iseq)
1938
1935
  {
1939
1936
  for (i = 0; i < iseq->local_table_size; i++)
1940
- rb_hash_aset(hash, rb_id2str(iseq->local_table[i]), *(block_frame->dfp - iseq->local_table_size + i - 1));
1937
+ {
1938
+ VALUE str = rb_id2str(iseq->local_table[i]);
1939
+ if (str != 0)
1940
+ rb_hash_aset(hash, str, *(block_frame->dfp - iseq->local_table_size + i - 1));
1941
+ }
1941
1942
  return(hash);
1942
1943
  }
1943
1944
  block_frame = RUBY_VM_NEXT_CONTROL_FRAME(block_frame);
@@ -2363,11 +2364,10 @@ FUNC_FASTCALL(do_jump)(rb_thread_t *th, rb_control_frame_t *cfp)
2363
2364
  * Returns +true+ if jump to +line+ in filename +file+ was successful.
2364
2365
  */
2365
2366
  static VALUE
2366
- context_jump(int argc, VALUE *argv, VALUE self)
2367
+ context_jump(VALUE self, VALUE line, VALUE file)
2367
2368
  {
2368
2369
  debug_context_t *debug_context;
2369
2370
  debug_frame_t *debug_frame;
2370
- VALUE line, file;
2371
2371
  int i;
2372
2372
  rb_thread_t *th;
2373
2373
  rb_control_frame_t *cfp;
@@ -2382,10 +2382,6 @@ context_jump(int argc, VALUE *argv, VALUE self)
2382
2382
  if (debug_frame == NULL)
2383
2383
  rb_raise(rb_eRuntimeError, "No frames collected.");
2384
2384
 
2385
- if (argc != 2)
2386
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
2387
- rb_scan_args(argc, argv, "2", &line, &file);
2388
-
2389
2385
  line = FIX2INT(line);
2390
2386
 
2391
2387
  /* find topmost frame of the debugged code */
@@ -2476,7 +2472,7 @@ Init_context()
2476
2472
  context_breakpoint, 0); /* in breakpoint.c */
2477
2473
  rb_define_method(cContext, "set_breakpoint",
2478
2474
  context_set_breakpoint, -1); /* in breakpoint.c */
2479
- rb_define_method(cContext, "jump", context_jump, -1);
2475
+ rb_define_method(cContext, "jump", context_jump, 2);
2480
2476
  }
2481
2477
 
2482
2478
  /*
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-base19
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.21
4
+ version: 0.11.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kent Sibilev
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-04 00:00:00 -07:00
13
+ date: 2009-09-08 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency