# eric4.DebugClients.Ruby.Debuggee

File implementing the real debugger, which is connected to the IDE frontend.

### Global Attributes

None

### Classes

Client | Class handling the connection to the IDE.
Context | Class defining the current execution context.
DEBUGGER__ | Class defining a singleton object for the debugger.
Mutex | Class implementing a mutex.
SilentObject | Class defining an object that ignores all messages.

### Modules

None

### Functions

context | Method returning the context of a thread.
debug_thread_info | Method handling the thread related debug commands.
eventLoop | Method calling the main event loop.
eventPoll | Method calling the main function polling for an event sent by the IDE.
get_thread | Method returning a thread by number.
interrupt | Method to stop execution at the next instruction.
make_thread_list | Method to create a thread list.
thread_list | Method to list the state of a thread.
thread_list_all | Method to list the state of all threads.
traceRuby? | Method to check, if we should trace into the Ruby interpreter libraries.

## Client

Class handling the connection to the IDE.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

eventLoop | Method calling the main event loop.
eventPoll | Method calling the main function polling for an event sent by the IDE.
initialize | Constructor
printf | Method to print something to the IDE.
printf_clear_breakpoint | Method to report the deletion of a temporary breakpoint to the IDE.
printf_clear_watchexpression | Method to report the deletion of a temporary watch expression to the IDE.
printf_excn | Method to report an exception to the IDE.
printf_exit | Method to report the exit status to the IDE.
printf_line | Method to report the current line and the current stack trace to the IDE.
printf_scriptExcn | Method to report a ScriptError to the IDE.
traceRuby? | Method to check, if we should trace into the Ruby interpreter libraries.

### Static Methods

None

#### Client.eventLoop

eventLoop()

Method calling the main event loop.

#### Client.eventPoll

eventPoll()

Method calling the main function polling for an event sent by the IDE.

#### Client.initialize

initialize()

Constructor

debugger
  reference to the object having the IDE connection.

#### Client.printf

printf()

Method to print something to the IDE.

*args
  Arguments to be printed.

#### Client.printf_clear_breakpoint

printf_clear_breakpoint(line)

Method to report the deletion of a temporary breakpoint to the IDE.

file
  filename of the breakpoint (String)
line
  line number of the breakpoint (int)

#### Client.printf_clear_watchexpression

printf_clear_watchexpression()

Method to report the deletion of a temporary watch expression to the IDE.

cond
  expression of the watch expression (String)

#### Client.printf_excn

printf_excn()

Method to report an exception to the IDE.

exclist
  info about the exception to be reported

#### Client.printf_exit

printf_exit()

Method to report the exit status to the IDE.

status
  exit status of the program (int)

#### Client.printf_line

printf_line()

Method to report the current line and the current stack trace to the IDE.

frames
  reference to the array containing the stack trace.

#### Client.printf_scriptExcn

printf_scriptExcn()

Method to report a ScriptError to the IDE.

exclist
  info about the exception to be reported

#### Client.traceRuby?

traceRuby?()

Method to check, if we should trace into the Ruby interpreter libraries.

Up

## Context

Class defining the current execution context.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

clear_suspend | Method to clear the suspend state.
current_binding | Method returning the binding object of the current execution frame.
current_frame | Method returning the current execution frame.
eventLoop | Method calling the main event loop.
eventPoll | Method calling the main function polling for an event sent by the IDE.
get_binding | Method returning the binding object of a specific execution frame.
get_frame | Method returning a specific execution frame.
initialize | Constructor
set_suspend | Method to suspend all threads.
step_continue | Method to continue execution until next breakpoint or watch expression.
step_out | Method to set the next stop point after the function call returns.
step_over | Method to set the next stop point skipping function calls.
step_quit | Method to stop debugging.
stop_next | Method to set the next stop point (i.e.
suspend_all | Method to suspend all threads.
traceRuby? | Method to check, if we should trace into the Ruby interpreter libraries.

### Static Methods

None

#### Context.clear_suspend

clear_suspend()

Method to clear the suspend state.

#### Context.current_binding

current_binding()

Method returning the binding object of the current execution frame.

Returns:
  binding object of the current execution frame

#### Context.current_frame

current_frame()

Method returning the current execution frame.

Returns:
  current execution frame

#### Context.eventLoop

eventLoop()

Method calling the main event loop.

#### Context.eventPoll

eventPoll()

Method calling the main function polling for an event sent by the IDE.

#### Context.get_binding

get_binding()

Method returning the binding object of a specific execution frame.

frameno
  frame number of the frame (int)

Returns:
  the requested binding object

#### Context.get_frame

get_frame()

Method returning a specific execution frame.

frameno
  frame number of the frame to be returned (int)

Returns:
  the requested execution frame

#### Context.initialize

initialize()

Constructor

#### Context.set_suspend

set_suspend()

Method to suspend all threads.

#### Context.step_continue

step_continue()

Method to continue execution until next breakpoint or watch expression.

#### Context.step_out

step_out()

Method to set the next stop point after the function call returns.

#### Context.step_over

step_over()

Method to set the next stop point skipping function calls.

counter
  defining the stop point (int)

#### Context.step_quit

step_quit()

Method to stop debugging.

#### Context.stop_next

stop_next()

Method to set the next stop point (i.e. stop at next line).

counter
  defining the stop point (int)

#### Context.suspend_all

suspend_all()

Method to suspend all threads.

#### Context.traceRuby?

traceRuby?()

Method to check, if we should trace into the Ruby interpreter libraries.

Up

## DEBUGGER__

Class defining a singleton object for the debugger.

### Derived from

None

### Class Attributes

MUTEX
SilentClient

### Class Methods

None

### Methods

add_break_point | Method to add a breakpoint.
add_watch_point | Method to add a watch expression.
attach | Method to connect the debugger to the IDE.
attached? | Method returning the attached state.
break_points | Method to return the list of breakpoints
check_break_points | Method to check, if the given position contains an active breakpoint.
check_suspend | Method to check the suspend state.
clear_break_point | Method to delete a specific breakpoint.
clear_watch_point | Method to delete a specific watch expression.
client | Method returning a reference to the client object.
context | Method returning the context of a thread.
debug_command | Method to execute the next debug command.
debug_silent_eval | Method to eval a string without output.
delete_break_point | Method to delete a breakpoint.
delete_watch_point | Method to delete a watch expression.
enable_break_point | Method to set the enabled state of a breakpoint.
enable_watch_point | Method to set the enabled state of a watch expression.
excn_handle | Method to handle an exception
frame_set_pos | Method to set the frame position of the current frame.
ignore_break_point | Method to set the ignore count of a breakpoint.
ignore_watch_point | Method to set the ignore count of a watch expression.
last_thread | Method returning the last active thread.
quit | Method to quit the debugger.
resume | Method to resume the program being debugged.
resume_all | Method to resume all threads.
set_client | Method to set the client handling the connection.
set_last_thread | Method to remember the last thread.
skip_it? | Method to filter out debugger files.
stdout | Method returning the stdout object.
stdout= | Method to set the stdout object.
suspend | Method to suspend the program being debugged.
thnum | Method returning the thread number of the current thread.
trace_func | Method executed by the tracing facility.
waiting | Method returning the waiting list.

### Static Methods

None

#### DEBUGGER__.add_break_point

add_break_point(pos, temp = false, cond = nil)

Method to add a breakpoint.

file
  filename for the breakpoint (String)
pos
  line number for the breakpoint (int)
temp
  flag indicating a temporary breakpoint (boolean)
cond
  condition of a conditional breakpoint (String)

#### DEBUGGER__.add_watch_point

add_watch_point(temp = false)

Method to add a watch expression.

cond
  expression of the watch expression (String)
temp
  flag indicating a temporary watch expression (boolean)

#### DEBUGGER__.attach

attach()

Method to connect the debugger to the IDE.

debugger
  reference to the object handling the communication with the IDE.

#### DEBUGGER__.attached?

attached?()

Method returning the attached state.

Returns:
  flag indicating, whether the debugger is attached to the IDE.

#### DEBUGGER__.break_points

break_points()

Method to return the list of breakpoints

Returns:
  Array containing all breakpoints.

#### DEBUGGER__.check_break_points

check_break_points(pos, binding_, id)

Method to check, if the given position contains an active breakpoint.

file
  filename containing the currently executed line (String)
pos
  line number currently executed (int)
binding_
  current binding object
id
  (ignored)

Returns:
  flag indicating an active breakpoint (boolean)

#### DEBUGGER__.check_suspend

check_suspend()

Method to check the suspend state.

#### DEBUGGER__.clear_break_point

clear_break_point(pos)

Method to delete a specific breakpoint.

file
  filename containing the breakpoint (String)
pos
  line number containing the breakpoint (int)

#### DEBUGGER__.clear_watch_point

clear_watch_point()

Method to delete a specific watch expression.

cond
  expression specifying the watch expression (String)

#### DEBUGGER__.client

client()

Method returning a reference to the client object.

Returns:
  reference to the client object.

#### DEBUGGER__.context

context()

Method returning the context of a thread.

th
  thread object to get the context for

Returns:
  the context for the thread

#### DEBUGGER__.debug_command

debug_command(line, id, binding_)

Method to execute the next debug command.

#### DEBUGGER__.debug_silent_eval

debug_silent_eval(binding_)

Method to eval a string without output.

str
  String containing the expression to be evaluated
binding_
  the binding for the evaluation

Returns:
  the result of the evaluation

#### DEBUGGER__.delete_break_point

delete_break_point(pos)

Method to delete a breakpoint.

file
  filename of the breakpoint (String)
pos
  line number of the breakpoint (int)

#### DEBUGGER__.delete_watch_point

delete_watch_point()

Method to delete a watch expression.

cond
  expression of the watch expression (String)

#### DEBUGGER__.enable_break_point

enable_break_point(pos, enable)

Method to set the enabled state of a breakpoint.

file
  filename of the breakpoint (String)
pos
  line number of the breakpoint (int)
enable
  flag indicating the new enabled state (boolean)

#### DEBUGGER__.enable_watch_point

enable_watch_point(enable)

Method to set the enabled state of a watch expression.

cond
  expression of the watch expression (String)
enable
  flag indicating the new enabled state (boolean)

#### DEBUGGER__.excn_handle

excn_handle(line, id, binding_)

Method to handle an exception

file
  filename containing the currently executed line (String)
pos
  line number currently executed (int)
id
  (ignored)
binding_
  current binding object

#### DEBUGGER__.frame_set_pos

frame_set_pos(line)

Method to set the frame position of the current frame.

#### DEBUGGER__.ignore_break_point

ignore_break_point(pos, count)

Method to set the ignore count of a breakpoint.

file
  filename of the breakpoint (String)
pos
  line number of the breakpoint (int)
count
  ignore count to be set (int)

#### DEBUGGER__.ignore_watch_point

ignore_watch_point(count)

Method to set the ignore count of a watch expression.

cond
  expression of the watch expression (String)
count
  ignore count to be set (int)

#### DEBUGGER__.last_thread

last_thread()

Method returning the last active thread.

Returns:
  active thread

#### DEBUGGER__.quit

quit()

Method to quit the debugger.

status
  exit status of the program

#### DEBUGGER__.resume

resume()

Method to resume the program being debugged.

#### DEBUGGER__.resume_all

resume_all()

Method to resume all threads.

#### DEBUGGER__.set_client

set_client()

Method to set the client handling the connection.

debugger
  reference to the object handling the connection

#### DEBUGGER__.set_last_thread

set_last_thread()

Method to remember the last thread.

th
  thread to be remembered.

#### DEBUGGER__.skip_it?

skip_it?()

Method to filter out debugger files.

Tracing is turned off for files that are part of the debugger that are called from the application being debugged.

file
  name of the file to be checked (String)

Returns:
  flag indicating, whether the file should be skipped (boolean)

#### DEBUGGER__.stdout

stdout()

Method returning the stdout object.

Returns:
  reference to the stdout object

#### DEBUGGER__.stdout=

stdout=()

Method to set the stdout object.

s
  reference to the stdout object

#### DEBUGGER__.suspend

suspend()

Method to suspend the program being debugged.

#### DEBUGGER__.thnum

thnum()

Method returning the thread number of the current thread.

Returns:
  thread number of the current thread.

#### DEBUGGER__.trace_func

trace_func(file, line, id, binding_, klass)

Method executed by the tracing facility.

event
  the tracing event (String)
file
  the name of the file being traced (String)
line
  the line number being traced (int)
id
  object id
binding_
  a binding object
klass
  name of a class

#### DEBUGGER__.waiting

waiting()

Method returning the waiting list.

Returns:
  the waiting list

Up

## Mutex

Class implementing a mutex.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

initialize | Constructor
lock | Method to lock the mutex.
locked? | Method returning the locked state.
unlock | Method to unlock the mutex.

### Static Methods

None

#### Mutex.initialize

initialize()

Constructor

#### Mutex.lock

lock()

Method to lock the mutex.

Returns:
  the mutex

#### Mutex.locked?

locked?()

Method returning the locked state.

Returns:
  flag indicating the locked state (boolean)

#### Mutex.unlock

unlock()

Method to unlock the mutex.

Returns:
  the mutex

Up

## SilentObject

Class defining an object that ignores all messages.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

method_missing | Method invoked for all messages it cannot handle.

### Static Methods

None

#### SilentObject.method_missing

method_missing(*a, &b)

Method invoked for all messages it cannot handle.

msg_id
  symbol for the method called
*a
  arguments passed to the missing method
&b
  unknown

Up

## context

context(thread=Thread.current)

Method returning the context of a thread.

th
  threat the context is requested for

Returns:
  context object for the thread

Up

## debug_thread_info

debug_thread_info(input, binding_)

Method handling the thread related debug commands.

input
  debug command (String)
binding_
  reference to the binding object

Up

## eventLoop

eventLoop()

Method calling the main event loop.

Up

## eventPoll

eventPoll()

Method calling the main function polling for an event sent by the IDE.

Up

## get_thread

get_thread(num)

Method returning a thread by number.

num
  thread number (int)

Returns:
  thread with the requested number

Up

## interrupt

interrupt()

Method to stop execution at the next instruction.

Up

## make_thread_list

make_thread_list()

Method to create a thread list.

Up

## thread_list

thread_list(num)

Method to list the state of a thread.

num
  thread number (int)

Up

## thread_list_all

thread_list_all()

Method to list the state of all threads.

Up

## traceRuby?

traceRuby?()

Method to check, if we should trace into the Ruby interpreter libraries.

Up