Class: Debugger::Context
- Inherits:
-
Object
- Object
- Debugger::Context
- Defined in:
- lib/ruby-debug-base.rb,
ext/ruby_debug/ruby_debug.c
Instance Method Summary collapse
- #__c_frame_binding ⇒ Object
-
#breakpoint ⇒ Object
Returns a context-specific temporary Breakpoint object.
-
#dead? ⇒ Boolean
Returns
true
if context doesn’t represent a live context and is created during post-mortem exception handling. -
#frame_args(frame_position = 0) ⇒ Object
Returns frame’s argument parameters.
-
#frame_binding(frame_position = 0) ⇒ Binding
Returns frame’s binding.
-
#frame_class(frame_position) ⇒ Object
Returns the real class of the frame.
-
#frame_file(frame_position) ⇒ String
Returns the name of the file.
-
#frame_method(frame_position = 0) ⇒ Object
Returns the sym of the called method.
-
#frame_line(frame_position) ⇒ Integer
Returns the line number in the file.
-
#frame_locals(frame) ⇒ Hash
Returns frame’s local variables.
-
#frame_method(frame_position = 0) ⇒ Object
Returns the sym of the called method.
-
#frame_self(frame_postion = 0) ⇒ Object
Returns self object of the frame.
-
#ignored? ⇒ Boolean
Returns the ignore flag for the current context.
- #interrupt ⇒ Object
-
#jump(line, file) ⇒ Boolean
Returns
true
if jump toline
in filenamefile
was successful. -
#break ⇒ Boolean
Returns
true
if context is currently running and set flag to break it at next line. -
#resume ⇒ nil
Resumes the thread from the suspended mode.
-
#set_breakpoint(source, pos, condition = nil) ⇒ Object
Sets a context-specific temporary breakpoint, which can be used to implement ‘Run to Cursor’ debugger function.
-
#stack_dec ⇒ Object
Decrements the top of the call stack to the next valid frame, if possible.
-
#stack_inc ⇒ Object
Increments the top of the call stack to the previous valid frame, if possible.
-
#stack_size ⇒ Object
Returns the size of the context stack.
-
#step(steps, force = false) ⇒ Object
Stops the current context after a number of
steps
are made. -
#step_over(steps, frame = nil, force = false) ⇒ Object
Steps over a
steps
number of times. -
#stop_frame(frame) ⇒ Object
Stops when a frame with number
frame
is activated. -
#step(steps, force = false) ⇒ Object
Stops the current context after a number of
steps
are made. -
#stop_reason ⇒ Object
Returns the reason for the stop.
-
#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.
-
#tracing=(bool) ⇒ Object
Controls the tracing for this context.
Instance Method Details
#__c_frame_binding ⇒ Object
20 |
# File 'lib/ruby-debug-base.rb', line 20 alias __c_frame_binding frame_binding |
#breakpoint ⇒ Object
Returns a context-specific temporary Breakpoint object.
263 264 265 266 267 268 269 270 |
# File 'ext/ruby_debug/breakpoint.c', line 263
VALUE
context_breakpoint(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return debug_context->breakpoint;
}
|
#dead? ⇒ Boolean
Returns true
if context doesn’t represent a live context and is created during post-mortem exception handling.
2238 2239 2240 2241 2242 2243 2244 2245 |
# File 'ext/ruby_debug/ruby_debug.c', line 2238
static VALUE
context_dead(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_DEAD) ? Qtrue : Qfalse;
}
|
#frame_args(frame_position = 0) ⇒ Object
Returns frame’s argument parameters
1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 |
# File 'ext/ruby_debug/ruby_debug.c', line 1927
static VALUE
context_frame_args(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
if (cfp && cfp->iseq && cfp->iseq->local_table && cfp->iseq->argc)
{
int i;
VALUE list;
list = rb_ary_new2(cfp->iseq->argc);
for (i = 0; i < cfp->iseq->argc; i++)
{
if (!rb_is_local_id(cfp->iseq->local_table[i])) continue; /* skip flip states */
rb_ary_push(list, rb_id2str(cfp->iseq->local_table[i]));
}
return(list);
}
return(rb_ary_new2(0));
}
|
#frame_binding(frame_position = 0) ⇒ Binding
Returns frame’s binding.
1795 1796 1797 |
# File 'ext/ruby_debug/ruby_debug.c', line 1795 def frame_binding(frame) __c_frame_binding(frame) || hbinding(frame) end |
#frame_class(frame_position) ⇒ Object
Returns the real class of the frame. It could be different than context.frame_self(frame).class
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 |
# File 'ext/ruby_debug/ruby_debug.c', line 1980
static VALUE
context_frame_class(int argc, VALUE *argv, VALUE self)
{
VALUE klass;
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
if (cfp->iseq == NULL) return(Qnil);
klass = real_class(cfp->iseq->klass);
if(TYPE(klass) == T_CLASS || TYPE(klass) == T_MODULE)
return klass;
return Qnil;
}
|
#frame_file(frame_position) ⇒ String
Returns the name of the file.
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 |
# File 'ext/ruby_debug/ruby_debug.c', line 1866
static VALUE
context_frame_file(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
while (cfp <= debug_context->start_cfp)
{
if (cfp->iseq != NULL)
return(cfp->iseq->filename);
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
}
return(Qnil);
}
|
#frame_method(frame_position = 0) ⇒ Object
Returns the sym of the called method.
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 |
# File 'ext/ruby_debug/ruby_debug.c', line 1822
static VALUE
context_frame_id(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
if (cfp->iseq == NULL || cfp->iseq->defined_method_id == 0) return(Qnil);
#if defined HAVE_RB_CONTROL_FRAME_T_METHOD_ID
return(RUBYVM_CFUNC_FRAME_P(cfp) ? ID2SYM(cfp->method_id) : ID2SYM(cfp->iseq->defined_method_id));
#elif defined HAVE_RB_METHOD_ENTRY_T_CALLED_ID
return(RUBYVM_CFUNC_FRAME_P(cfp) ? ID2SYM(cfp->me->called_id) : ID2SYM(cfp->iseq->defined_method_id));
#endif
}
|
#frame_line(frame_position) ⇒ Integer
Returns the line number in the file.
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 |
# File 'ext/ruby_debug/ruby_debug.c', line 1847
static VALUE
context_frame_line(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
return(INT2FIX(rb_vm_get_sourceline(cfp)));
}
|
#frame_locals(frame) ⇒ Hash
Returns frame’s local variables.
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 |
# File 'ext/ruby_debug/ruby_debug.c', line 1891
static VALUE
context_frame_locals(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
int i;
rb_control_frame_t *cfp;
rb_iseq_t *iseq;
VALUE hash;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
iseq = cfp->iseq;
hash = rb_hash_new();
if (iseq != NULL && iseq->local_table != NULL)
{
/* Note rb_iseq_disasm() is instructive in coming up with this code */
for (i = 0; i < iseq->local_table_size; i++)
{
VALUE str = rb_id2str(iseq->local_table[i]);
if (str != 0)
rb_hash_aset(hash, str, *(cfp->dfp - iseq->local_size + i));
}
}
return(hash);
}
|
#frame_method(frame_position = 0) ⇒ Object
Returns the sym of the called method.
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 |
# File 'ext/ruby_debug/ruby_debug.c', line 1822
static VALUE
context_frame_id(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
if (cfp->iseq == NULL || cfp->iseq->defined_method_id == 0) return(Qnil);
#if defined HAVE_RB_CONTROL_FRAME_T_METHOD_ID
return(RUBYVM_CFUNC_FRAME_P(cfp) ? ID2SYM(cfp->method_id) : ID2SYM(cfp->iseq->defined_method_id));
#elif defined HAVE_RB_METHOD_ENTRY_T_CALLED_ID
return(RUBYVM_CFUNC_FRAME_P(cfp) ? ID2SYM(cfp->me->called_id) : ID2SYM(cfp->iseq->defined_method_id));
#endif
}
|
#frame_self(frame_postion = 0) ⇒ Object
Returns self object of the frame.
1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 |
# File 'ext/ruby_debug/ruby_debug.c', line 1961
static VALUE
context_frame_self(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;
frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
return(GET_CFP->self);
}
|
#ignored? ⇒ Boolean
Returns the ignore flag for the current context.
2222 2223 2224 2225 2226 2227 2228 2229 |
# File 'ext/ruby_debug/ruby_debug.c', line 2222
static VALUE
context_ignored(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_IGNORE) ? Qtrue : Qfalse;
}
|
#interrupt ⇒ Object
16 17 18 |
# File 'lib/ruby-debug-base.rb', line 16 def interrupt self.stop_next = 1 end |
#jump(line, file) ⇒ Boolean
Returns true
if jump to line
in filename file
was successful.
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 |
# File 'ext/ruby_debug/ruby_debug.c', line 2289
static VALUE
context_jump(VALUE self, VALUE line, VALUE file)
{
debug_context_t *debug_context;
int i;
rb_thread_t *th;
rb_control_frame_t *cfp;
rb_control_frame_t *cfp_end;
rb_control_frame_t *cfp_start = NULL;
Data_Get_Struct(self, debug_context_t, debug_context);
GetThreadPtr(context_thread_0(debug_context), th);
line = FIX2INT(line);
cfp_start = debug_context->cur_cfp;
cfp_end = RUBY_VM_END_CONTROL_FRAME(th);
cfp = cfp_start;
if (cfp_start == NULL)
return(INT2FIX(2)); /* couldn't find frame; should never happen */
if ((cfp->pc - cfp->iseq->iseq_encoded) >= (cfp->iseq->iseq_size - 1))
return(INT2FIX(1)); /* no space for opt_call_c_function hijack */
/* find target frame to jump to */
while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, cfp_end))
{
if ((cfp->iseq != NULL) && (rb_str_cmp(file, cfp->iseq->filename) == 0))
{
for (i = 0; i < cfp->iseq->line_info_size; i++)
{
if (cfp->iseq->line_info_table[i].line_no != line)
continue;
/* hijack the currently running code so that we can change the frame PC */
debug_context->saved_jump_ins[0] = cfp_start->pc[0];
debug_context->saved_jump_ins[1] = cfp_start->pc[1];
cfp_start->pc[0] = bin_opt_call_c_function;
cfp_start->pc[1] = (VALUE)do_jump;
debug_context->jump_cfp = cfp;
debug_context->jump_pc =
cfp->iseq->iseq_encoded + cfp->iseq->line_info_table[i].position;
return(INT2FIX(0)); /* success */
}
}
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
}
return(INT2FIX(3)); /* couldn't find a line and file frame match */
}
|
#break ⇒ Boolean
Returns true
if context is currently running and set flag to break it at next line
2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 |
# File 'ext/ruby_debug/ruby_debug.c', line 2347
static VALUE
context_pause(VALUE self)
{
debug_context_t *debug_context;
rb_thread_t *th;
Data_Get_Struct(self, debug_context_t, debug_context);
if (CTX_FL_TEST(debug_context, CTX_FL_DEAD))
return(Qfalse);
GetThreadPtr(context_thread_0(debug_context), th);
if (th == GET_THREAD())
return(Qfalse);
debug_context->thread_pause = 1;
return(Qtrue);
}
|
#resume ⇒ nil
Resumes the thread from the suspended mode.
2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 |
# File 'ext/ruby_debug/ruby_debug.c', line 2170
static VALUE
context_resume(VALUE self)
{
debug_context_t *debug_context;
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;
}
|
#set_breakpoint(source, pos, condition = nil) ⇒ Object
Sets a context-specific temporary breakpoint, which can be used to implement ‘Run to Cursor’ debugger function. When this breakpoint is reached, it will be cleared out.
source is a name of a file or a class. pos is a line number or a method name if source is a class name. condition is a string which is evaluated to true
when this breakpoint is activated.
285 286 287 288 289 290 291 292 293 294 295 |
# File 'ext/ruby_debug/breakpoint.c', line 285
VALUE
context_set_breakpoint(int argc, VALUE *argv, VALUE self)
{
VALUE result;
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
result = create_breakpoint_from_args(argc, argv, 0);
debug_context->breakpoint = result;
return result;
}
|
#stack_dec ⇒ Object
Decrements the top of the call stack to the next valid frame, if possible.
2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 |
# File 'ext/ruby_debug/ruby_debug.c', line 2051
static VALUE
context_stack_dec(VALUE self)
{
debug_context_t *debug_context;
rb_control_frame_t *cfp;
rb_thread_t *th;
Data_Get_Struct(self, debug_context_t, debug_context);
GetThreadPtr(context_thread_0(debug_context), th);
cfp = debug_context->start_cfp;
while (cfp >= debug_context->cur_cfp)
{
cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp);
if (cfp->iseq != NULL && cfp->pc != NULL)
{
debug_context->start_cfp = cfp;
if (GET_THREAD() == th)
set_cfp(debug_context);
return(Qtrue);
}
}
return(Qfalse);
}
|
#stack_inc ⇒ Object
Increments the top of the call stack to the previous valid frame, if possible.
2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 |
# File 'ext/ruby_debug/ruby_debug.c', line 2020
static VALUE
context_stack_inc(VALUE self)
{
debug_context_t *debug_context;
rb_control_frame_t *cfp;
rb_thread_t *th;
Data_Get_Struct(self, debug_context_t, debug_context);
GetThreadPtr(context_thread_0(debug_context), th);
cfp = debug_context->start_cfp;
while (cfp < RUBY_VM_END_CONTROL_FRAME(th))
{
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
if (cfp->iseq != NULL && cfp->pc != NULL)
{
debug_context->start_cfp = cfp;
if (GET_THREAD() == th)
set_cfp(debug_context);
return(Qtrue);
}
}
return(Qfalse);
}
|
#stack_size ⇒ Object
Returns the size of the context stack.
2006 2007 2008 2009 2010 2011 2012 |
# File 'ext/ruby_debug/ruby_debug.c', line 2006
static VALUE
context_stack_size(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return(INT2FIX(debug_context->cfp_count));
}
|
#step(steps, force = false) ⇒ Object
Stops the current context after a number of steps
are made. force
parameter (if true) ensures that the cursor moves from the current line.
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 |
# File 'ext/ruby_debug/ruby_debug.c', line 1684
static VALUE
context_stop_next(int argc, VALUE *argv, VALUE self)
{
VALUE steps, force;
debug_context_t *debug_context;
rb_scan_args(argc, argv, "11", &steps, &force);
if(FIX2INT(steps) < 0)
rb_raise(rb_eRuntimeError, "Steps argument can't be negative.");
Data_Get_Struct(self, debug_context_t, debug_context);
debug_context->stop_next = FIX2INT(steps);
if(RTEST(force))
CTX_FL_SET(debug_context, CTX_FL_FORCE_MOVE);
else
CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
return steps;
}
|
#step_over(steps, frame = nil, force = false) ⇒ Object
Steps over a steps
number of times. Make step over operation on frame
, by default the current frame. force
parameter (if true) ensures that the cursor moves from the current line.
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 |
# File 'ext/ruby_debug/ruby_debug.c', line 1712
static VALUE
context_step_over(int argc, VALUE *argv, VALUE self)
{
VALUE lines, frame, force;
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
if(debug_context->cfp_count == 0)
rb_raise(rb_eRuntimeError, "No frames collected.");
rb_scan_args(argc, argv, "12", &lines, &frame, &force);
debug_context->stop_line = FIX2INT(lines);
CTX_FL_UNSET(debug_context, CTX_FL_STEPPED);
if(frame == Qnil)
{
debug_context->dest_frame = debug_context->cfp_count;
}
else
{
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->cfp_count)
rb_raise(rb_eRuntimeError, "Destination frame is out of range.");
debug_context->dest_frame = debug_context->cfp_count - FIX2INT(frame);
}
if(RTEST(force))
CTX_FL_SET(debug_context, CTX_FL_FORCE_MOVE);
else
CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
return Qnil;
}
|
#stop_frame(frame) ⇒ Object
Stops when a frame with number frame
is activated. Implements finish
and next
commands.
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 |
# File 'ext/ruby_debug/ruby_debug.c', line 1749
static VALUE
context_stop_frame(VALUE self, VALUE frame)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->cfp_count)
rb_raise(rb_eRuntimeError, "Stop frame is out of range.");
debug_context->stop_frame = debug_context->cfp_count - FIX2INT(frame);
return frame;
}
|
#step(steps, force = false) ⇒ Object
Stops the current context after a number of steps
are made. force
parameter (if true) ensures that the cursor moves from the current line.
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 |
# File 'ext/ruby_debug/ruby_debug.c', line 1684
static VALUE
context_stop_next(int argc, VALUE *argv, VALUE self)
{
VALUE steps, force;
debug_context_t *debug_context;
rb_scan_args(argc, argv, "11", &steps, &force);
if(FIX2INT(steps) < 0)
rb_raise(rb_eRuntimeError, "Steps argument can't be negative.");
Data_Get_Struct(self, debug_context_t, debug_context);
debug_context->stop_next = FIX2INT(steps);
if(RTEST(force))
CTX_FL_SET(debug_context, CTX_FL_FORCE_MOVE);
else
CTX_FL_UNSET(debug_context, CTX_FL_FORCE_MOVE);
return steps;
}
|
#stop_reason ⇒ Object
Returns the reason for the stop. It maybe of the following values: :initial, :step, :breakpoint, :catchpoint, :post-mortem
2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 |
# File 'ext/ruby_debug/ruby_debug.c', line 2254
static VALUE
context_stop_reason(VALUE self)
{
debug_context_t *debug_context;
const char * sym_name;
Data_Get_Struct(self, debug_context_t, debug_context);
switch(debug_context->stop_reason)
{
case CTX_STOP_STEP:
sym_name = "step";
break;
case CTX_STOP_BREAKPOINT:
sym_name = "breakpoint";
break;
case CTX_STOP_CATCHPOINT:
sym_name = "catchpoint";
break;
case CTX_STOP_NONE:
default:
sym_name = "none";
}
if(CTX_FL_TEST(debug_context, CTX_FL_DEAD))
sym_name = "post-mortem";
return ID2SYM(rb_intern(sym_name));
}
|
#suspend ⇒ nil
Suspends the thread when it is running.
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 |
# File 'ext/ruby_debug/ruby_debug.c', line 2137
static VALUE
context_suspend(VALUE self)
{
debug_context_t *debug_context;
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.
2155 2156 2157 2158 2159 2160 2161 2162 |
# File 'ext/ruby_debug/ruby_debug.c', line 2155
static VALUE
context_is_suspended(VALUE self)
{
debug_context_t *debug_context;
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.
2096 2097 2098 2099 2100 2101 2102 2103 2104 |
# File 'ext/ruby_debug/ruby_debug.c', line 2096
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.
2082 2083 2084 2085 2086 2087 2088 |
# File 'ext/ruby_debug/ruby_debug.c', line 2082
static VALUE
context_thread(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return(id2ref(debug_context->thread_id));
}
|
#tracing ⇒ Boolean
Returns the tracing flag for the current context.
2188 2189 2190 2191 2192 2193 2194 2195 |
# File 'ext/ruby_debug/ruby_debug.c', line 2188
static VALUE
context_tracing(VALUE self)
{
debug_context_t *debug_context;
Data_Get_Struct(self, debug_context_t, debug_context);
return CTX_FL_TEST(debug_context, CTX_FL_TRACING) ? Qtrue : Qfalse;
}
|
#tracing=(bool) ⇒ Object
Controls the tracing for this context.
2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 |
# File 'ext/ruby_debug/ruby_debug.c', line 2203
static VALUE
context_set_tracing(VALUE self, VALUE value)
{
debug_context_t *debug_context;
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;
}
|