Class: Debugger::Context
- Inherits:
-
Object
- Object
- Debugger::Context
- Defined in:
- lib/ruby-debug-base.rb,
ext/ruby_debug.c
Instance Method Summary collapse
- #__c_frame_binding ⇒ Object
-
#dead?( = bool) ⇒ Boolean
Returns
true
if context doesn’t represent a live context and is created during post-mortem exception handling. -
#frame_binding(frame) ⇒ Binding
Returns frame’s binding.
-
#frame_file(frame) ⇒ String
Returns the name of the file.
-
#frame_id(frame) ⇒ Object
Returns the sym of the called method.
-
#frame_line(frame) ⇒ Integer
Returns the line number in the file.
-
#frame_locals(frame) ⇒ Hash
Returns frame’s local variables.
-
#frame_self(frame) ⇒ Object
Returns self object of the frame.
-
#ignored? ⇒ Boolean
Returns the ignore flag for the current context.
- #interrupt ⇒ Object
-
#resume ⇒ nil
Resumes the thread from the suspended mode.
-
#stack_size ⇒ Object
Returns the size of the context stack.
-
#step_over(steps) ⇒ Object
Steps over a
steps
number of times. -
#stop_frame(frame) ⇒ Object
Stops when a frame with number
frame
is activated. -
#stop_next=(steps) ⇒ Object
Stops the current context after a number
steps
are made. -
#suspend ⇒ nil
Suspends the thread when it is running.
-
#suspended? ⇒ Boolean
Returns
true
if the thread is suspended by debugger. -
#thnum ⇒ Integer
Returns the context’s number.
-
#thread ⇒ Object
Returns a thread this context is associated with.
-
#tracing ⇒ Boolean
Returns the tracing flag for the current context.
-
#tracking=(bool) ⇒ Object
Controls the tracing for this context.
Instance Method Details
#__c_frame_binding ⇒ Object
12 |
# File 'lib/ruby-debug-base.rb', line 12 alias __c_frame_binding frame_binding |
#dead?( = bool) ⇒ Boolean
Returns true
if context doesn’t represent a live context and is created during post-mortem exception handling.
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 |
# File 'ext/ruby_debug.c', line 1985
static VALUE
context_dead(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_DEAD) ? Qtrue : Qfalse;
}
|
#frame_binding(frame) ⇒ Binding
Returns frame’s binding.
1654 1655 1656 |
# File 'ext/ruby_debug.c', line 1654 def frame_binding(frame) __c_frame_binding(frame) || hbinding(frame) end |
#frame_file(frame) ⇒ String
Returns the name of the file.
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 |
# File 'ext/ruby_debug.c', line 1707
static VALUE
context_frame_file(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return rb_str_new2(GET_FRAME->file);
}
|
#frame_id(frame) ⇒ Object
Returns the sym of the called method.
1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 |
# File 'ext/ruby_debug.c', line 1670
static VALUE
context_frame_id(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
ID id;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
id = GET_FRAME->id;
return id ? ID2SYM(id): Qnil;
}
|
#frame_line(frame) ⇒ Integer
Returns the line number in the file.
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 |
# File 'ext/ruby_debug.c', line 1690
static VALUE
context_frame_line(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return INT2FIX(GET_FRAME->line);
}
|
#frame_locals(frame) ⇒ Hash
Returns frame’s local variables.
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 |
# File 'ext/ruby_debug.c', line 1758
static VALUE
context_frame_locals(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
debug_frame_t *debug_frame;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
debug_frame = GET_FRAME;
if(debug_frame->dead)
return debug_frame->info.copy.locals;
else
return context_copy_locals(debug_frame);
}
|
#frame_self(frame) ⇒ Object
Returns self object of the frame.
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 |
# File 'ext/ruby_debug.c', line 1780
static VALUE
context_frame_self(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
debug_frame_t *debug_frame;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
debug_frame = GET_FRAME;
return debug_frame->self;
}
|
#ignored? ⇒ Boolean
Returns the ignore flag for the current context.
1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 |
# File 'ext/ruby_debug.c', line 1967
static VALUE
context_ignored(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_IGNORE) ? Qtrue : Qfalse;
}
|
#interrupt ⇒ Object
8 9 10 |
# File 'lib/ruby-debug-base.rb', line 8 def interrupt self.stop_next = 1 end |
#resume ⇒ nil
Resumes the thread from the suspended mode.
1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 |
# File 'ext/ruby_debug.c', line 1909
static VALUE
context_resume(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(!CTX_FL_TEST(debug_context, CTX_FL_SUSPEND))
rb_raise(rb_eRuntimeError, "Thread is not suspended.");
context_resume_0(debug_context);
return Qnil;
}
|
#stack_size ⇒ Object
Returns the size of the context stack.
1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 |
# File 'ext/ruby_debug.c', line 1799
static VALUE
context_stack_size(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return INT2FIX(debug_context->stack_size);
}
|
#step_over(steps) ⇒ Object
Steps over a steps
number of times.
1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 |
# File 'ext/ruby_debug.c', line 1589
static VALUE
context_step_over(int argc, VALUE *argv, VALUE self)
{
VALUE lines, frame;
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(debug_context->stack_size == 0)
rb_raise(rb_eRuntimeError, "No frames collected.");
rb_scan_args(argc, argv, "11", &lines, &frame);
debug_context->stop_line = FIX2INT(lines);
if(argc == 1)
{
debug_context->dest_frame = debug_context->stack_size;
}
else
{
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->stack_size)
rb_raise(rb_eRuntimeError, "Destination frame is out of range.");
debug_context->dest_frame = debug_context->stack_size - FIX2INT(frame);
}
return Qnil;
}
|
#stop_frame(frame) ⇒ Object
Stops when a frame with number frame
is activated. Implements up
and down
commands.
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 |
# File 'ext/ruby_debug.c', line 1622
static VALUE
context_stop_frame(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->stack_size)
rb_raise(rb_eRuntimeError, "Stop frame is out of range.");
debug_context->stop_frame = debug_context->stack_size - FIX2INT(frame);
return frame;
}
|
#stop_next=(steps) ⇒ Object
Stops the current context after a number steps
are made.
1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 |
# File 'ext/ruby_debug.c', line 1569
static VALUE
context_stop_next(VALUE self, VALUE steps)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(FIX2INT(steps) < 0)
rb_raise(rb_eRuntimeError, "Steps argument can't be negative.");
debug_context->stop_next = FIX2INT(steps);
return steps;
}
|
#suspend ⇒ nil
Suspends the thread when it is running.
1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 |
# File 'ext/ruby_debug.c', line 1872
static VALUE
context_suspend(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(CTX_FL_TEST(debug_context, CTX_FL_SUSPEND))
rb_raise(rb_eRuntimeError, "Already suspended.");
context_suspend_0(debug_context);
return Qnil;
}
|
#suspended? ⇒ Boolean
Returns true
if the thread is suspended by debugger.
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 |
# File 'ext/ruby_debug.c', line 1892
static VALUE
context_is_suspended(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_SUSPEND) ? Qtrue : Qfalse;
}
|
#thnum ⇒ Integer
Returns the context’s number.
1832 1833 1834 1835 1836 1837 1838 1839 |
# File 'ext/ruby_debug.c', line 1832
static VALUE
context_thnum(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return INT2FIX(debug_context->thnum);
}
|
#thread ⇒ Object
Returns a thread this context is associated with.
1816 1817 1818 1819 1820 1821 1822 1823 1824 |
# File 'ext/ruby_debug.c', line 1816
static VALUE
context_thread(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return context_thread_0(debug_context);
}
|
#tracing ⇒ Boolean
Returns the tracing flag for the current context.
1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 |
# File 'ext/ruby_debug.c', line 1929
static VALUE
context_tracing(VALUE self)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_TRACING) ? Qtrue : Qfalse;
}
|
#tracking=(bool) ⇒ Object
Controls the tracing for this context.
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 |
# File 'ext/ruby_debug.c', line 1946
static VALUE
context_set_tracing(VALUE self, VALUE value)
{
debug_context_t *debug_context;
debug_check_started();
Data_Get_Struct(self, debug_context_t, debug_context);
if(RTEST(value))
CTX_FL_SET(debug_context, CTX_FL_TRACING);
else
CTX_FL_UNSET(debug_context, CTX_FL_TRACING);
return value;
}
|