Task package

Module contents

Modules implementing Model-Centric Debugging for Platform 2012 environments.

Representation

Link, Endpoint and CommEntity provide the generic basis for building the debugger representation of task-based program structure.

class mcgdb.model.task.representation.CommComponent(*args, **kws)[source]

Bases: mcgdb.model.task.representation.CommEntity

Extention of generic communication entities. Represents a generic component.

dict_ = {}
classmethod get_selected_component(silent=False)[source]
Returns:the component currently active, or None.
Return type:CommComponent
classmethod init_dict(key, self)

Add the current object to its class dictionnary (in __init__).

Parameters:
  • key -- Unique id of this object instance.
  • self -- Object instance put in the dict.
classmethod key_to_value(key)

Get object identified with key key.

Parameters:key -- key to lookup.
last_number = 0
list_ = []
class mcgdb.model.task.representation.CommEntity(*args, **kws)[source]

Bases: object

Class representing a model entity that can communicate and build networks through Endpoints and Links.

TASK_MANAGER = None
add_endpoint(endpoint)[source]

Adds an endpoint to this entity.

Parameters:endpoint (Endpoint) -- the new endpoint.
assert_self_consistency()[source]

Virtual method. Hook point to assert that the entity is in a consistent state, or raise exceptions otherwise.

check_useless()[source]

Virtual method. Hook point to tell if we can get rid of this entity.

do_exit()[source]

Virtual method. Hook point to release internal resources.

endpoint_closed(endpoint)[source]

Notifies the entity that endpoint was closed.

Parameters:endpoint (Endpoint) -- the endpoint that was closed.
exit()[source]

Internal function. Tells the entity to quit.

classmethod get_current()[source]
Returns:the entity currently active, if any.
get_mark()[source]

Internal function. :returns: the task mark from the task manager if any, or an empty string. :rtype: String

get_messages()[source]

Virtual method.

classmethod get_selected_component(silent=False)[source]
init()[source]

Virtual method. Initialization hook point for subclasses.

is_alive()[source]

Virtual method. Hook point for implementation specific life checking.

is_current()

Virtual method. :returns: True if the entity is active in the context.

last_number = 0
list_ = []
switch(force=False)[source]

Internal function. Switches to this entity.

Parameters:force -- Should the task manager force the switch or not.
Returns:None if there is no inferior associated with this task,
Returns:False if it was not possible to switch,
Returns:True if GDB has switched to the entity.
class mcgdb.model.task.representation.Endpoint(comm_entity)[source]

Bases: object

Glue between an entity and a link.

Parameters:

comm_entity -- Entity to wich is endpoint is bound.

Variables:
  • link -- Link to wich this endpoint if connected, if any.
  • siblings -- Endpoints identical to this one.
comm_ent_exit()[source]

Internal function. Notifies the endpoint that its entity exited. Informs the associated link, if any.

endpoint_closed()[source]

Closes the endpoint. Unbinds the link, and tells the entity.

get_stop_next(reason=None)[source]

Internal function. Tells if this endpoint wants the execution to be stopped.

Returns:#1 True if the execution should stop, False otherwise.
Returns:#2 List of stop messages.
Return type:(#1:Boolean, #2List)
init()[source]

Virtual method. Initialization hook point for subclasses.

Notifies the end endpoint that its link was closed. Destructs the binding to the link and close the endpoint.

Notifies the end endpoint that it is now connected to link. Informs the associated link, if any.

Parameters:link (Link) -- the link connected to this endpoint.

Destructs the binding to the link.

stop_next(message=None, permanent=False, cb=None)[source]

Requests an execution stop next time a message is carried over this endpoint. All the parameters are optional.

Parameters:
  • message (String.) -- Message to display when the execution is stopped.
  • permanent (Boolean) -- False if the request should be destroyed after the first stop, True otherwise. Default: False.
  • cb (<string> Callable(<string>)) -- Function callback applied to the stop reason, that returns a stop message.
Returns:

StopRequest(arg, permanent, cb)

Return type:

StopRequest.

undo_request(rq)[source]

Internal function. Cancels a stop request.

Parameters:rq (StopRequest) -- a stop request generated by self.stop_next

Bases: object

Generic link between entity endpoints.

Parameters:endpoint (Endpoint) -- (optional) One of the endpoints connected to this link.
Variables:endpoints -- the list of endpoints associated with this link.
add_endpoint(endpoint)[source]

Connect another endpoint to this link.

Parameters:endpoint -- Endpoint to connect to the link.
destruct()[source]

Destructs this link and close the associated endpoints.

details()[source]

Virtual method.

endpoint_closed(closed_endpoint)[source]

Inform the Link that one if its endpoints was closed. The link will destruct itself when no more endpoints are connected to it.

param: closed_endpoint: endpoint that was closed.

static get_by_channel(channel)[source]
get_channel()[source]

Virtual method.

get_messages()[source]

Virtual method.

get_other_endpoints(endpoint)[source]

Returns the list of the _other_ endpoints connected to this link, if any.

Parameters:endpoint -- One end of the link.
last_number = 0
list_ = []
match_channel(channel)[source]

Tells if channel is identical with this link's.

: param channel: The channel to compare with this link's. :returns: True if the channel if this link is the same as channel.

class mcgdb.model.task.representation.Message(*args, **kws)[source]

Bases: object

Object transmitted between entities, over communication endpoints and links.

Parameters:
  • id -- identifier of the message's creation point
  • payload -- the content of the message.
  • name -- the name of the message.
Variables:
  • breakpoint -- True if the execution should be stopped when this message is processed.
  • breakpoint_cnt -- Breakpoint counter, incremented each time this message stops the execution.
  • checkpoints -- list of (id, payload) checkpoint crossed by this message.
static all_messages()[source]

Generator. Generator. Get all the messages stored in the entities and links.

Returns:Iterator yielding all the available messages.
check_breakpoint(src, dst)[source]

Requests an execution stop to GDB if this message is breakpointed.

Parameters:
  • src -- Source of the message's last hope.
  • dst -- Destination of the message's last hope.
checkpoint(id_, payload=None)[source]

Adds a new checkpoint on the way of the message.

Parameters:
  • id -- identifier of this checkpoint
  • payload -- content of the message at this checkpoint. If the payload is None, we reuse the previous one.
last_checkpoint()[source]
Returns:the last checkpoint crossed by this message.
Return type:(id, payload)
last_number = 0
last_payload()[source]
Returns:the payload of the last checkpoint crossed by this message.

Toolbox

mcgdb.model.task.toolbox.tasks.get_mark(task)[source]
mcgdb.model.task.toolbox.tasks.get_selected_host_task()[source]
mcgdb.model.task.toolbox.tasks.get_selected_task()[source]
mcgdb.model.task.toolbox.tasks.is_selected_task(task)[source]
mcgdb.model.task.toolbox.tasks.switch_to(task, force=False)[source]